Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SOLR-15843 Update Log4J to 2.15 #454

Merged
merged 5 commits into from
Dec 10, 2021
Merged

SOLR-15843 Update Log4J to 2.15 #454

merged 5 commits into from
Dec 10, 2021

Conversation

madrob
Copy link
Contributor

@madrob madrob commented Dec 10, 2021

@ramenjosh
Copy link

Hey team, can this also be backported to 7.7 as a new 7.7.4 release? Many people still running Solr 7 will also require this fix.

Copy link
Contributor

@janhoy janhoy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, you can consider moving the changes entry to bugfix as our reason to upgrade is not to use new features but to get bugfixes...

@uschindler
Copy link
Contributor

Hey team, can this also be backported to 7.7 as a new 7.7.4 release? Many people still running Solr 7 will also require this fix.

This won't happen anymore as 7.x is out of maintenance. To fix it, just modify your local solr.in.sh and pass the extra command line parameter: -Dlog4j2.formatMsgNoLookups=true

We will add this to the release notes.

Copy link
Contributor

@uschindler uschindler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add the above instructions to release notes, so we inform users how to fix older versions (like 7.x, 6.x,...).

@madrob
Copy link
Contributor Author

madrob commented Dec 10, 2021

Release notes or the security page on the site (or both?)

Solr 7 is affected but AFAICT Solr 5 and 6 are not because they use log4j 1.2.17

@uschindler
Copy link
Contributor

Release notes or the security page on the site (or both?)

Solr 7 is affected but AFAICT Solr 5 and 6 are not because they use log4j 1.2.17

I would maybe do both. Let's add a notice with the fix to our news list (under security) and add the release note later when we publish a release.

In addition, depending on your configuration (not the default), log4j v1 is also affected. Theres a special appender doing the same style of JNDI stuff: apache/logging-log4j2#608 (comment)

@plumdog
Copy link

plumdog commented Dec 10, 2021

Should we expect patched releases for older 8.x versions? In my case, 8.9? Or will I have to take 8.11?

@plumdog
Copy link

plumdog commented Dec 10, 2021

Also, regarding Solr 5 and 6 and log4j: apache/logging-log4j2#608 (comment)

Based on that, I think they would be affected.

@madrob
Copy link
Contributor Author

madrob commented Dec 10, 2021

Should we expect patched releases for older 8.x versions? In my case, 8.9? Or will I have to take 8.11?

You should not expect additional 8.9.z releases

@uschindler
Copy link
Contributor

Also, regarding Solr 5 and 6 and log4j: apache/logging-log4j2#608 (comment)

This is only a problem if you use special appenders, which solr does not do.

@acdha
Copy link

acdha commented Dec 10, 2021

I was wondering whether someone could confirm that the top-level version lock will also affect the contrib prometheus-exporter. My scan of our container images turned up a second copy of log4j 2.14.1 in /opt/solr-8.11.0/contrib/prometheus-exporter/lib/.

@plumdog
Copy link

plumdog commented Dec 10, 2021

You should not expect additional 8.9.z releases

@madrob So if I want something both stable and patched, I'll need 8.11.next?

@uschindler
Copy link
Contributor

uschindler commented Dec 10, 2021

You should not expect additional 8.9.z releases

@madrob So if I want something both stable and patched, I'll need 8.11.next?

I would NOT wait for a release or asking the same question like this one all the time (ask them one time on mailing list please) and instead act NOW:

Just open your solr.in.sh in your favorite editor and add SOLR_OPTS="$SOLR_OPTS -Dlog4j2.formatMsgNoLookups=true". Restart Solr. Done, all safe.

solr/bin/solr.in.cmd Outdated Show resolved Hide resolved
@uschindler
Copy link
Contributor

uschindler commented Dec 10, 2021

You should not expect additional 8.9.z releases

@madrob So if I want something both stable and patched, I'll need 8.11.next?

I would NOT wait for a release or asking the same question like this one all the time (ask them one time on mailing list please) and instead act NOW:

Just open your solr.in.sh in your favorite editor and add SOLR_OPTS="$SOLR_OPTS -Dlog4j2.formatMsgNoLookups=true". Restart Solr. Done, all safe.

Here is the security advisory, it shows you how to harden your solr server: https://solr.apache.org/security.html#apache-solr-affected-by-apache-log4j-cve-2021-44228

@madrob madrob requested a review from uschindler December 10, 2021 18:12
@mario-canva
Copy link

The Apache log4j security advisory was updated recently stating the flag -Dlog4j2.formatMsgNoLookups=true is not a sufficient mitigation for log4j versions below 2.15.0. Which is the case for Solr 7.7.3 and below, so the Solr advisory also needs to be updated.

What other possible mitigations we can use for Solr 7.7.3? Any chances to get a patch for this version as well? I know it is stated out of maintenance but a patch it would really go a long way in helping people to mitigate this vulnerability. Let me know if create a PR helps in getting a patch moving and I will raise one.

@uschindler
Copy link
Contributor

Hi,

Solr does use MDC (the %X pattern), but the values are not user generated and all come from config files and are enforced to comply to certain formats (e.g., no $ possible). Shard, replica, collection names are sanitized.

In short all fine, no need to change the mitigation instructions. There is also no need to update log4j in older versions of Solr.

Uwe

@mario-canva
Copy link

mario-canva commented Dec 14, 2021

Thanks @uschindler appreciate the quick response! However, their advisory also states other attack vectors may be possible:

The reason these measures are insufficient is that, in addition to the Thread Context attack vector mentioned above, there are still code paths in Log4j where message lookups could occur: known examples are applications that use Logger.printf("%s", userInput), or applications that use a custom message factory, where the resulting messages do not implement StringBuilderFormattable. There may be other attack vectors.

At the moment we are going with the mitigation they suggested here:

remove the JndiLookup class from the classpath: zip -q -d log4j-core-*.jar org/apache/logging/log4j/core/lookup/JndiLookup.class

Although, if we could have a patch for 7.7.3 to upgrade the log4j version for 2.16.0 that would be best.

@uschindler
Copy link
Contributor

The other attack vectors are also not possible with Solr:

  • Logger.printf("%s", userInput) is not used
  • custom message factory is not used

Uwe

@mario-canva
Copy link

Understood. I still think pays off being a bit conservative here, it is a critical CVE after all and the log4j team stated other attack vectors may be possible (beyond the ones they have found already).

Internally we will follow Log4j advice to not use that flag as mitigation and remove the JndiLookup class from the jar.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants