Written by Ruben Selby, founder and penetration tester at Wolfcore. Last reviewed 25 November 2026. Part of Vulnerabilities and exploitation.
In one sentence: Log4Shell is a flaw in a very common piece of Java software that writes activity logs, which let an attacker make a vulnerable server run their code just by getting a piece of text into its logs.
What it is
Log4j is an open-source Java logging library from the Apache Software Foundation. The NCSC describes it as a building block: software teams pull it in rather than write their own, and it keeps a journal of what an application does. Because it is a dependency inside other products, many organisations did not know they used it.
CVE-2021-44228, called Log4Shell, was disclosed in December 2021. Apache rates it CVSS 10.0, the top score. The NCSC said it requires very little expertise to exploit and called it potentially the most severe computer vulnerability in years.
How it works
- A vulnerable application logs some text an outsider controls, such as a web request header, a username or a chat message.
- Log4j, in affected versions, treats certain patterns in that text as instructions, not plain words. One feature is a JNDI lookup, a Java way of fetching resources from a directory server.
- The attacker’s text points the lookup at a server they run. Apache describes this as: an attacker who can control log messages or their parameters can execute arbitrary code loaded from LDAP servers.
- The victim server contacts the attacker’s server, loads what it is given and runs it, with the privileges of the application.
- The attacker then steals data, adds a back door or deploys ransomware.
Apache says only the log4j-core component is affected, not applications that use only log4j-api.
Who it affects and how badly
Any business running Java software, including in products it bought rather than built: SaaS start-ups, MSPs, manufacturers, retailers, healthcare systems and councils across the UK, EU, US and Armenia. The NCSC lists Apache Struts2, Solr, Druid and Flink, plus Netty, MyBatis and the Spring Framework, as software that uses the library.
Illustrative worst cases:
- Up to 10 staff: a supplier’s product runs Log4j. The business cannot patch it, so depends on the vendor.
- 10 to 50 staff: an in-house web app is exposed. A compromise can mean stolen customer data and several days of recovery.
- 250 plus or regulated: dozens of products contain Log4j. The work is finding all copies, and a missed one can lead to notifiable data loss.
Real examples
The NCSC states that scanning and exploitation were detected globally including in the UK, and that it knew of actors exploiting vulnerable instances of VMware Horizon, MobileIron and Ubiquiti UniFi Network Application. Proof-of-concept code was also published. Apache credits the discovery to Chen Zhaojun of the Alibaba Cloud Security Team.
Rules and regulators
- UK: the NCSC asks UK organisations compromised by this flaw to report to it, and recommends its Early Warning service.
- US: the NCSC points to a joint international advisory published with CISA (AA21-356A).
- EU: no EU agency page was opened for this entry. Personal data stolen through this flaw would be a breach under GDPR.
What we check on a test
Method, not findings:
- Which internet-facing and internal applications use Java, and which log4j-core versions they ship, including those nested inside application archives.
- Whether user-controlled fields reach logs, and whether the server can make unexpected outbound connections (LDAP, LDAPS, RMI, DNS).
- Whether a supplier’s product is on a list of known-affected software, and whether the supplier has issued fixes.
- Whether your monitoring would see an outbound connection to a new destination.
How to detect it
The NCSC suggests:
- Search file systems, including inside JAR, WAR and EAR files, for Log4j, and for the JndiLookup class.
- Search logs for user-controlled strings such as “jndi:ldap”.
- Look at network or EDR data for LDAP, LDAPS, RMI and DNS connections from servers to destinations not seen before 10 December 2021.
- Do not rely on a web application firewall alone, because variants of the attack string can bypass rules.
How to fix or prevent it
- Update Log4j. Apache lists the fixed versions as 2.15.0 for Java 8 and later, with 2.3.1 and 2.12.2 for Java 6 and 7. The NCSC later pointed to 2.17.0, because 2.15.0 was found incomplete in some settings (CVE-2021-45046) and a further denial of service issue (CVE-2021-45105) followed. Use the latest 2.x release.
- For vendor software, apply vendor updates and ask suppliers whether their products use Log4j.
- Where no update exists, the NCSC says removing the JndiLookup class from the classpath mitigates it. Use the NCSC’s published steps and check every copy.
- Block unexpected outbound connections from servers, after learning what normal looks like.
- Keep a list of the software components in your products, so the next flaw takes hours, not weeks.
Illustration: a small business
An illustration, not a real case. A 25-person logistics firm buys a booking portal from a supplier. It runs Log4j inside. The firm does not know. Attackers scan the internet, find the portal and run code on it. Customer addresses and contact details are taken. The firm spends a week with the supplier and reports to its regulator. One email to the supplier, asking what Java components the product contains, would have started the fix earlier.
Frequently asked questions
Is Log4j 1 affected? Apache says Log4j 1 has no lookups so the risk is lower, but it has been end of life since 2015 and a separate flaw (CVE-2021-4104) exists.
Which versions are fixed? 2.15.0 for Java 8 and later was the first fix, but use the latest 2.x release.
Can a firewall stop it? The NCSC says a WAF should not be the only control.
Related terms
CISA KEV catalogue: Known Exploited Vulnerabilities, What is a zero-day vulnerability? Meaning and risk, What is patch management? How to keep software updated safely, What is vulnerability scanning? How automated checks find known weaknesses, Port 389 (LDAP): How It Is Attacked and Secured, printnightmare-cve-2021-34527 See also: Spring4Shell (CVE-2022-22965): What It Is and How to Fix It.
How Wolfcore helps
A Wolfcore penetration test finds this the way an attacker would, by hand, not with a scanner. Start with the free web vulnerability scan at wolfcore.co.uk/free-web-vulnerability-scan, or see our penetration testing service.
Wolfcore
Would your staff click a phishing email?
Run a real, safe phishing test on your team with Phishy. Free for 14 days, up to 10 staff, no card. We help you set it up.
Start a free phishing testFree website security scanor book a 30 minute call