News for hackers. Stuff that matters.
Re:Log4j RCE Found by testplzignore on Thursday December 09, 2021 @08:20PM (#29505355)
I don't get what the point of this feature even is. What is a legitimate reason for a logging library to make network requests based on the contents of what is being logged? And is this enabled out-of-the-box with log4j2?
Re:Log4j RCE Found by BeefWellington on Thursday December 09, 2021 @08:39PM (#29505479)
> I don't get what the point of this feature even is.

This is basically the response to every type of vulnerability that is based on some spec nobody's read. Same deal with XML entity parsing. Why should it make web requests, FTP requests, etc.?

At some point someone had it as a requirement and everyone else gets to live with it.

Re:Log4j RCE Found by throw_nbvc1234 on Thursday December 09, 2021 @11:13PM (#29506307)
Which is why they removed the functionality in the latest version (per comments below) right?
Re:Log4j RCE Found by tmm1 on Friday December 10, 2021 @12:12AM (#29506646)
Re:Log4j RCE Found by Quekid5 on Friday December 10, 2021 @09:24AM (#29510165)
Holy moley, that's a lot of extra code... any bets on if it might contain new vulnerabilities? :)
Re:Log4j RCE Found by justinpombrio on Sunday December 19, 2021 @04:04PM (#29618403)
Hahaha, giving you an upvote because new vulnerabilities have, in fact, been found. (And I think one of them relates to this new code not being sufficient? Though I'm not following much anymore.)
Re:Log4j RCE Found by scottlamb on Friday December 10, 2021 @04:35PM (#29515730)
There are two bizarre design decisions that combined into this stunning security vulnerability: the automatic trust-the-world code execution (on by default) and the recursive parameter expansion (always on). They flipped the default on the former. They haven't done anything about the latter, AFAIK. I wonder if they will.
Re:Log4j RCE Found by BinaryRage on Friday December 10, 2021 @01:47AM (#29507123)
log4j2 supports lookups, which allows you to add additional logging context:

https://logging.apache.org/log4j/2.x/manual/lookups.html

The problem here is the JNDI lookup because for historical reasons there is code in these providers which causes Java to deserialize and load bytecode if it's found in a result for a lookup against an LDAP server. That exploit was partially fixed in the JDK in 2008, then in 2018, but there are multiple naming providers that are affected.

Yes, it's enabled by default before 2.15.0, released today to mitigate this issue.

Re:Log4j RCE Found by shp0ngle on Friday December 10, 2021 @09:12AM (#29510032)
I don’t understand these Java protocols enough to understand why was loading arbitrary bytecode from URLs even considered a feature, but I guess it was the 90s and Objects were all the rage
Re:Log4j RCE Found by AtNightWeCode on Friday December 10, 2021 @11:43AM (#29511948)
A lot of libs for logging have similar convenient ways for getting usernames and so on. The error here seems to be that even though you use the lib correctly a bug was introduced that made the injected parameters a part of the layout, at least that is what people are claiming. The example from the article though is an incorrect use of the lib and one can expect the same type of issues in a lot of libs when dealing with input parameters.
Re:Log4j RCE Found by shp0ngle on Friday December 10, 2021 @11:07PM (#29518325)
I understand that. I don’t understand JDNI, LDAP and why it ever downloads and runs remote bytecode and why was that ever considered a good feature.
Re:Log4j RCE Found by toyg on Saturday December 11, 2021 @03:53AM (#29519523)
LDAP is typically a behind-the-firewall protocol. At that point, in the "old school" mindset, it's considered a trusted service. Having features to automatically pick up stuff across your own network of boxes might be considered useful by many an admin.
Re:Log4j RCE Found by blincoln on Saturday December 11, 2021 @12:27PM (#29522587)
Also, my understanding is that Java deserialization (or deserialization in general) wasn't intended to explicitly allow actual code execution, just reconstitution of an object's state from storage on disk, the network, etc. Sometimes the state of certain types of object can be repurposed to result in arbitrary code execution, but AFAIK that wasn't an anticipated outcome or design goal back in the 90s.
Re:Log4j RCE Found by nijave on Thursday December 09, 2021 @08:36PM (#29505459)
I'm guessing some sort of auditing or routing functionality. For instance, you have debug logs going to some development server and login events going to so audit server.

I don't have experience with this feature but there's similar use cases in log shipping utilities like fluentd

Edit: I read the other link and it looks like some sort of poorly designed RPC functionality or something shrug

Edit 2: Reading https://docs.oracle.com/javase/7/docs/technotes/guides/jndi/..., it sounds like it's a form of service discover of sorts. You talk to a registry server and it provides some object pointing to the real destination

Re:Log4j RCE Found by shp0ngle on Friday December 10, 2021 @09:14AM (#29510059)
Reading about this got me to the words “servlet” and “BeanFactory”, which I don’t really want to uncover right now, as it might open some pandora’s box
Re:Log4j RCE Found by toyg on Saturday December 11, 2021 @03:54AM (#29519527)
Those are very famous '90s Java concepts (J2EE), and I feel old for talking to somebody who doesn't know what they are.
Re:Log4j RCE Found by shp0ngle on Saturday December 11, 2021 @10:51PM (#29526961)
I remember reading about them when I learned programming in 2000s, but never used them in reality. Luckily.
Re:Log4j RCE Found by est on Thursday December 09, 2021 @09:31PM (#29505796)
> What is a legitimate reason for a logging library to make network requests based on the contents of what is being logged

I encountered a similar problem recently, my own logger can get the current container/pod IP address, it's painful to tell which host from the IPs in logs, so I had to do a manual DNS lookup to include a hostname instead. I was hoping the logger could automatically do a lookup and cache it for me.

Re:Log4j RCE Found by Too on Saturday December 11, 2021 @08:59AM (#29520886)
Pretty sure the original rationale for this clusterfuck must have been something similar: “we only have user id here, but want the logs to contain user name”. Send this requirement to the cheapest bidder and here we are.
Re:Log4j RCE Found by suraci on Thursday December 09, 2021 @10:04PM (#29505980)
Why didn't write logs to stdout and scrape container log files by fluentbit/promtail/etc? I'm working on logging infrastructure now and really want to know the reason behind this(before I built it...)
Re:Log4j RCE Found by est on Friday December 10, 2021 @12:11AM (#29506639)
I do, but with a different log aggregator (vector.dev), there are three reasons:

1. the log aggregator doesn't exactly support DNS lookups

2. You have to parse the log first, exactly precisely where the IP part, then do a proper lookup. But sometimes the log is just a mess.

3. where the log aggregator located cannot do host lookup because of different network and different DNS server.

So overall the lookup would better be done locally.

Re:Log4j RCE Found by numpad0 on Friday December 10, 2021 @03:12AM (#29507612)
I think this hilarious surprise from "network is the computer" principle and "it just so happens to go through xyz" transparency is just awesome.
Re:Log4j RCE Found by keyle on Thursday December 09, 2021 @11:23PM (#29506362)
So if you have a null pointer exception or something similar in production, you want to send that information to a remote host or alert system to be looked at urgently.
Re:Log4j RCE Found by markburns on Friday December 10, 2021 @12:21AM (#29506688)
I might be missing something, but wouldn't the point be that it's not the log writer's responsibility to do this, but rather some other service that consumes the unparsed output and sends the notification?
Re:Log4j RCE Found by makeitdouble on Friday December 10, 2021 @12:33AM (#29506769)
This is the obvious solution now.

I think 20 years ago it would have been slammed as overkill to have a separate process just to send logs.

Even now actually, there is a flurry of libs/gems to send events/logs/analytics to a remote server (Datadog, NewRelic, Slack…)from the application itself. It’s usually not directly coupled with the logger, but it’s not far.

Re:Log4j RCE Found by Thorrez on Friday December 10, 2021 @12:37AM (#29506789)
Putting a feature in a logger to send logs remote is one thing. Putting a special syntax into the log message itself that gets parsed to decide where to send it is much weirder.
Re:Log4j RCE Found by tmd83 on Friday December 10, 2021 @01:22AM (#29506975)
Exactly and this being enabled by default seems specially more unusual. I can understand config being parseable even though log configurer directly pulling a remote config is a stretch specially by default. But I don't think it's unlikely that people would by default assume that their log message would be parsed that way and as someone said it even works if that's used as a user input using {} instead of +.
Re:Log4j RCE Found by spc476 on Friday December 10, 2021 @03:29AM (#29507709)
syslog() has been around for a lot longer than 20 years, and that's a function that logs to a separate process. What's so bad about syslog that people need to invent new logging systems?
Re:Log4j RCE Found by funcDropShadow on Friday December 10, 2021 @05:09AM (#29508278)
Because it is not portable and therefore not the blessed Java entreprise way of doing things. /rantoff
Re:Log4j RCE Found by abhishekjha on Friday December 10, 2021 @07:20PM (#29517144)
Apps do send metrics from the process itself. Dropwizard metrics comes to mind. Wonder what timing RCE is waiting to happen there.
Re:Log4j RCE Found by keyle on Friday December 10, 2021 @12:32AM (#29506765)
Agreed. It's all nice to have. People want push.

You can eat your pizza slice whichever way you want.

Arguably this would be useful for critical events.

Re:Log4j RCE Found by Merad on Friday December 10, 2021 @01:21AM (#29506972)
Encoding that in the log message itself still seems a bit crazy. I’m not familiar with log4j, but the .Net logging libraries I do know (NLog and Serilog) completely separate writing log events from processing (writing, sending, whatever) the events.
Re:Log4j RCE Found by ec109685 on Friday December 10, 2021 @11:28AM (#29511762)
I believe the idea is that it lets you augment your log line with additional information to make it easier to read versus having to do the lookup at parse time.
Re:Log4j RCE Found by neop1x on Saturday December 11, 2021 @08:37AM (#29520744)
I guess a full scripting language support in the log string should be the next big feature. Ideally with full FS and network access.
Re:Log4j RCE Found by anonymousiam on Thursday December 09, 2021 @10:03PM (#29505978)
NSA TIA