Live data from Hacker News

Log4j: The pain just keeps going

thenewstack.io

91–100 of 291 posts

Re: Log4j: The pain just keeps going

#91
post #53

Earlier quoted context omitted.

> The current software engineering paradigm has no meaningful answer to this The answer is to stop using garbage software written in garbage languages. Of course the current environment is too high-time-preference for this to be economical in many industries. We have lightweight-to-heavyweight formal systems which can almost completely or literally completely eliminate issues of the type seen with log4j, but due to t…

What counts as a garbage language? Java guys will tell you it's rust or go, go guys will tell you it's java or rust, rust guys will tell you it's java and go.

> What counts as a garbage language?

I assume it's one with GC.

Re: Log4j: The pain just keeps going

#92
post #61

Earlier quoted context omitted.

And what would you have anyone do? You could formally spec software and implement it, congrats you're now 1000x slower to market and any change you want to make is another 1000x investment to spec out and prove. And let's not even mention the ridiculous idea that open source developers be expected to do this. Moreover, this doesn't even handle hardware problems! Okay, but we could just build all the software internal…

It takes a lot longer to build houses that are up to building codes, and bridges that have 10x safety factors rather than 2x. There's a reason we have building codes and large safety factors. Software engineers are discovering this today.

Software engineers are mostly aware of this. There is just little market demand for this level of robustness.

Re: Log4j: The pain just keeps going

#93

If you automatically update your dependencies all the time, you will constantly get new bugs, issues and sometimes even malware. If you don't update your dependencies all the time, you will be vulnerable to old bugs and issues. The current software engineering paradigm has no meaningful answer to this , no matter what "security experts" tell you. In a sane industry this realization would lead to a change of the parad…

> We're fighting fragile complexity of too many tools ducktaped together by ducktaping more tools to the whole setup. Again and again and again.

You’ve brought up three relevant points: 1. The tools are software, which strength and weakness is being easy to change. 2. The tools rely on abstraction, which strength and weakness is summarizing/hiding complexity. 3. Communication between publishers/consumers of these tools is hard.

Armchair-coaching I now come up with at least three solutions: 1. Re the weakness of #3: ensure when an issue is found at one layer, communication happens to maintainers of all other layers up and down. 2. Re the weakness of #2: collapse the layers – analyze dependencies and don’t go past more than x number of abstractions. 3. Re the weakness of #1: don’t use software.

Re: Log4j: The pain just keeps going

#94
post #73

Does anyone know if log4net the .net version of log4j is effected?

Hey, English is not my first language. Is "effected" here the right word to use or would "affected" be the correct term? I see English speaking people use these two interchangeably so much online that I am starting to doubt what I learned in my English courses.

Affected would have been more correct.

"Affected means that something was influenced or changed (e.g. the lyrics affected him).

Effected means that something was brought about or facilitated (e.g. she effected the proposed changes)."

It's definitely a subtle change, and, similarly, affect and effect tend to be mixed up as well

- from https://prowritingaid.com/affected-vs-effected#:~:text=To%20....

I will also recommend the book Uncovering The Logic of English, which is primarily aimed at native (American) English speakers but has several nods to English-as-a-second-language lessons.

Cheers! Signed, an American who was corrected by his father quite often and now has an ear for these things.

Re: Log4j: The pain just keeps going

#95
post #39
post #24

Earlier quoted context omitted.

The log4j author already did this about a decade ago. No one could understand log4j back then, so the replacement is much, much simpler, and API compatible for 99+% of use cases. Few projects seem to have bothered moving to it, probably becuase log4j is such a collosal pain to set up or modify.

What is that replacement? java.util.logging?

I believe that replacement is Logback [1] + SLF4J, according to the intro section on Wikipedia's log4j article [2]

[1] https://logback.qos.ch/reasonsToSwitch.html

[2] https://en.wikipedia.org/wiki/Log4j

Re: Log4j: The pain just keeps going

#96
post #21

Had to deal with some automated scan tool telling a client "you have log4j - you're vulnerable!" when... we didn't. A project was including a dependency on SLF4J and that project pulled in slf4j-log4j (IIRC). But it was not configured, wasn't compiled in to the final jar, and ... even it was, it was very old log4j (1.1 or 1.2 IIRC?). The vulnerability didn't affect that older version. We had to spend a week back and…

I thought Log4j 1.1 was vulnerable, just to a lesser extent, and there wasn't a lot of information on it because 1.x is end of life

See https://logging.apache.org/log4j/1.2/ . Plenty of vulnerabilities. Just different ones

Re: Log4j: The pain just keeps going

#97
post #33

Earlier quoted context omitted.

So somehow false positives negate all the actual positives caught and corrected? The only true solution is what? Manual audit of everything by some perfect human security practitioner? I suppose the same applies to automated development tools then. I will concede there probably are some firms out there acting poorly that way. When aren't there? Humans sigh . But by in large automation and the problems inherent are re…

I was in this industry for a while (I did 5 years full time for a security company). > I will concede there probably are some firms out there acting poorly that way. This is a hilarious take. Here's mine: The vast majority of these firms are here for liability. They do not provide security, they provide security theater so that if/when something goes wrong, the client can claim to have followed best practices, and th…

Thank you, that is a very interesting take. I've always played with the idea of pivoting into the security industry because playing hack the box and the like is something I do in my free time and enjoy. Maybe I'll just do some bug bounties or something for fun instead. I think it's a bit different in Europe though at least anecdotally there seems to be more code audit and the like (more product security) instead of pen testing (more network/infrastructure security).

Re: Log4j: The pain just keeps going

#98
post #92

Earlier quoted context omitted.

It takes a lot longer to build houses that are up to building codes, and bridges that have 10x safety factors rather than 2x. There's a reason we have building codes and large safety factors. Software engineers are discovering this today.

Software engineers are mostly aware of this. There is just little market demand for this level of robustness.

there was no market demand for building codes, either. that's why they're laws

Re: Log4j: The pain just keeps going

#99
post #53

Earlier quoted context omitted.

> The current software engineering paradigm has no meaningful answer to this The answer is to stop using garbage software written in garbage languages. Of course the current environment is too high-time-preference for this to be economical in many industries. We have lightweight-to-heavyweight formal systems which can almost completely or literally completely eliminate issues of the type seen with log4j, but due to t…

What counts as a garbage language? Java guys will tell you it's rust or go, go guys will tell you it's java or rust, rust guys will tell you it's java and go.

I'm not any of those guys, and of those 3 rust is by far the least garbage. Garbagicity is a spectrum.

Re: Log4j: The pain just keeps going

#100
post #7

At this point I’m asking if it is ok to go nuclear: just slab aspectJ compiler as the last step and do comptime patch the log4j remote logging API. Have anyone thought of this? Btw who would use remote logging to begin with?

> Btw who would use remote logging to begin with?

It's not about remote logging like "we log to somewhere else" but rather about including information from remote sources (specifically JDNI) in your log messages. If you are ingesting logs from a bunch of microservices, it would obviously be desirable to know which instance you're in, and just include that in the logger pattern. Or if you have multiple containers in a single tomcat instance, you might want to have the log message include which container it's coming from (especially for the console). Multi-container tomcat used to be VERY common in pet-style legacy java deployments - it's much slimmer on memory, although it does come with the caveat that GC pauses affect all containers. But that container/server information isn't built into the jar, it's runtime data, and the easiest source for getting that information is... connecting to the tomcat server via JNDI and pulling instance information.

But oops, they populated the JDNI string values after the message was already built, meaning that any log message that included a JDNI handle would be executed automatically on its own. And JNDI is basically a whole inner-platform, including the ability to classload arbitrary code from remote sources, because "lol why not, it's java enterprise code, we're building the future here!", so basically any user-controlled log message could include a JDNI link to arbitrary code and it would be downloaded and run.

(the JDNI being built after the rest of the message was populated was obviously the wrong place to do it for exactly this reason... that is really the core problem here, user-controlled JDNI is absolutely not acceptable given the capabilities, but, it's not like I've never written bad code... there but by the grace of god, go I. Although again, that one is pretty obviously a problem just conceptually.)

Incidentally though "remote logging" really isn't inherently insane as a concept, it's conceptually reasonable that some kinds of important messages might want to be logged into Kafka or JDBC, and 15 years ago there wasn't the overwhelming consensus on "write to disk first, ingest it later" being the right way to get it there. If you want to be really really sure that certain super-important messages are committed, and you don't mind the latency, why not just poke it directly? Then you never have to worry about logs getting dropped on disk/etc and not making it there. And by running it through log4j you don't have to do anything special at an application level, you just define certain packages and message levels as being important and you don't have to re-invent the wheel on the message-building framework/etc. And sure log4j ended up having vulnerabilities but your personal implementation may have vulnerabilities too - how sure are you about your string handling and escaping, could a message spoof what looks like a valid log entry? that's a common one. It just turns out that JDNI was a vastly bigger attack surface than initially realized...

Post reply on HN