If you are running Solr as a docker, what you can do is mount the same log4j-core version that uses in Solr image, outside after removing JndiLookup.class
from the jar.
Let me go through the steps that I have used.
Find the log4j-core version that Solr image is using. You can do it by executing following command in your Solr running host machine or after go inside your Solr container
find / -name "log4j-core-*.jar"
There you will get two paths. According to Solr security news page, we can neglect the prometheus-exporter
path. What will remain is server/lib/ext/
path
Copy that particular .jar file or download the same version from the Internet. I have tested this with log4j-core-2.11.2.jar
Copy that jar file in to your Solr container running host machine and check it's vulnerability status using this log4j-detector.
It's nothing complicated, to check that vulnerability using above mentioned tool. What you need to do is download that log4j-detector-2021.12.16.jar
file to an accessible location and run the command against your log4j-core jar file.
java -jar log4j-detector-2021.12.16.jar 8.4.1-ext > hits_8.4.1_ext.txt
Then you will get an output like below by saying it is vulnerable.
/ext/log4j-core-2.11.2.jar contains Log4J-2.x >= 2.10.0 VULNERABLE
:-(
Now let's remove the JndiLookup.class
from that log4j-core jar file
zip -q -d 8.4.1-ext/ext/log4j-core-*.jar org/apache/logging/log4j/core/lookup/JndiLookup.class
Then, check the vulnerability again against the same log4j-core jar file and you will be able to see something like below.
/ext/log4j-core-2.11.2.jar contains Log4J-2.x <= 2.0-beta8
POTENTIALLY_SAFE :-| (or did you already remove JndiLookup.class?)
That means JndiLookup.class removal has done successfully.
Let's mount that log4j-core jar file using using docker-compose.yaml
volumes:
- ./log4j-core-2.11.2.jar:/opt/solr-8.4.1/server/lib/ext/log4j-core-2.11.2.jar
Now, restart your Solr docker container.
My personal preference is updating property with SOLR_OPTS
with environment variables, since it is nice and clean.