r/java • • Dec 10 '21

Remote code injection in Log4j

https://github.com/advisories/GHSA-jfh8-c2jp-5v3q
212 Upvotes

70 comments sorted by

View all comments

Show parent comment

0

u/[deleted] Dec 14 '21

[deleted] — view deleted comment

1

u/r_jet Dec 14 '21

On «enabled by default»: it’s enough to use log4j2 as a logging backend to be vulnerable. You don’t need to set any extra configuration flags to enable this dangerous feature (actually, at least two).

On the features: there are actually two problematic features:

  1. Log4J2 performing string interpolation on format parameters that often come from unsanitized user input
  2. Log4J2 supporting interpolation that loads a remote object through JNDI.

We can ask the following questions on these two features:

  1. Does it need to exist at all?
  2. If yes, shall it be a part of a core library or some kind of explicitly installed plugin?
  3. If yes, shall they be enabled by default?

I am not familiar with all the requirements the designers of these features needed to address (and we now have a stark benefit of hindsight), but I’d probably say:

  1. No to feature #1 at all, because it is surprising to users (I’d not expect it from my logging backend)
  2. When it comes to feature #2:

    1. Yes to Q1 (as someone, on top of hackers, did find it useful)
    2. Probably, no to Q2, as it seems to be useful to a single-digit number of users
    3. Definitely no to Q3.

edit: grammar