Skip to main content
Mallory
CriticalExploited in the wildCISA KEVPublic exploitVulnerability

CVE-2021-45046: Apache Log4j Thread Context Lookup Injection and Code Execution

Published Dec 14, 2021 · Updated 13 days ago
Trending this weekNot trendingOutside this week’s top 100
Mention activity · 30 days2 mentions · peak 1 in a dayToday
CVSS9.0Critical · v3.1
EPSS100.0%100th percentile
CISA KEVYesAdded May 1, 2023
In the wildActivePer CISA KEV
Vendors
SiemensIntel CorporationCvatDebian ProjectSonicwallFedora ProjectApache Software Foundation
IdentifiersCVE-2021-45046CWE-917 · Improper Neutralization of Special…

CVE-2021-45046 is a lookup injection vulnerability in Apache Log4j 2 arising from the incomplete fix for CVE-2021-44228 in version 2.15.0. Certain non-default PatternLayout configurations evaluate attacker-controlled Thread Context Map (MDC) data containing malicious JNDI lookup expressions. Exploitable configurations include layouts containing a Context Lookup or Thread Context Map patterns such as %X, %mdc, or %MDC. Successful exploitation can cause information disclosure, local code execution, and remote code execution in some environments.

Do you run this?See affected versions in your environment and whether adversaries are exploiting this vulnerability against assets like yours.
Check your exposure
Analyst brief

Impact, mitigation & remediation

What it means and what to do now: patch path, interim mitigations, and the assume-compromise checklist.

Impact

What an attacker gets, and what they’ve been doing with it.

Exploitation can compromise the confidentiality, integrity, and availability of the affected Java application. Malicious JNDI lookups can disclose information and execute arbitrary code with the application's privileges; remote code execution depends on the runtime environment. Denial of service is also possible in affected configurations. Successful code execution can enable broader compromise within the application's permissions and network reach.

Mitigation

If you can’t patch tonight, do this now.

If upgrading is not immediately possible, remove the JndiLookup class from affected log4j-core archives and the runtime classpath, following vendor instructions, and restart affected applications. Setting log4j2.formatMsgNoLookups=true alone does not mitigate this vulnerability. Restrict network exposure and outbound connections from affected systems, segment vulnerable services, and run applications with least privilege as defense-in-depth measures. WAF rules and monitoring for suspicious JNDI activity or Java processes spawning shells can supplement, but not replace, remediation.

Remediation

Patch, then assume compromise.

Upgrade affected applications and embedded log4j-core dependencies to a current, supported, vendor-approved fixed release. The releases addressing this vulnerability are Log4j 2.16.0 for Java 8+, 2.12.2 for Java 7, and 2.3.1 for Java 6. These fixes remove message lookup support and disable JNDI functionality by default. These historical releases do not address every subsequently disclosed Log4j vulnerability. Update bundled, shaded, and indirect dependencies, redeploy affected applications, and keep log4j-api aligned with log4j-core where both are used. For packaged commercial products, follow the vendor's supported patching procedure.

Public exploits

Exploits

4 exploits validated by Mallory's analysis. Hidden: 19 rejected by Mallory's analysis as not a working exploit.

View more in app →
log4shell-corazaThis repository is a defensive Log4Shell lab rather than a standalone offensive exploit drop, but it does contain working exploit components. The structure combines: (1) a vulnerable target container (`log4shell-app`, based on a public Spring Boot Log4j 2.14.1 image), (2) an nginx reverse proxy with the Coraza WAF and OWASP CRS plus custom Log4Shell rules, (3) an attacker container that builds and packages multiple JNDI exploitation toolkits, and (4) Suricata/Wazuh monitoring for network and SIEM visibility. The main exploit capability lives under `attacker/`. `attacker/exploit-classes/Exploit.java` is a malicious Java class intended to be loaded through a JNDI/LDAP reference. Its static initializer executes immediately on class load and performs proof-of-exploitation actions: OS-specific command execution to write a marker file, creation of `/tmp/log4shell-exploited.txt`, and an optional reverse shell routine that connects to `172.20.0.2:4444`. There is also a stubbed environment-information collection method. This makes the repo more than a detector: it includes an actual RCE payload class. `attacker/scripts/start-ldap-server.sh` operationalizes exploitation by launching one of three JNDI infrastructures: marshalsec, JNDI-Exploit-Kit, or rogue-jndi. These are configured to serve the malicious class or execute simple commands/callbacks. `attacker/scripts/test-payloads.sh` is a payload spray/test harness that sends many Log4Shell payload variants to the nginx proxy using common injection points such as `User-Agent` and `X-Forwarded-For`. It includes LDAP, RMI, DNS, nested-expression, env/sys fallback, Unicode, whitespace, and colon-dash obfuscation variants. This script is primarily for validation of WAF/IDS coverage, but it also demonstrates realistic attack strings. The rest of the repository is focused on detection and containment. `coraza/config/log4shell-rules.conf` defines custom Coraza rules for standard and obfuscated JNDI patterns, alternate protocols, JSON/XML body inspection, and anomaly-score blocking. `nginx/` contains a multi-stage Docker build that compiles libcoraza and the coraza-nginx module, installs OWASP CRS, and exposes HTTP/HTTPS reverse proxying to the vulnerable app. `suricata/rules/log4shell.rules` adds network signatures for inbound JNDI payloads and outbound LDAP/RMI/DNS/HTTP callbacks that would indicate successful exploitation. Overall purpose: provide an isolated lab to demonstrate the full Log4Shell attack chain and, more importantly, how nginx+Coraza and Suricata can detect/block it. Because the repository includes a real malicious Java payload and scripts to stand up LDAP/JNDI exploit servers, it should be classified as a valid exploit-capable lab with operational payloads, not merely documentation or a pure detection script.tieupham267 · Disclosed Apr 28, 2026 · markdown · dockerfile · web · networkOperationalLog4j_CVE-2021-45046This repository is a proof-of-concept (PoC) exploit for CVE-2021-45046, a vulnerability in Apache Log4j 2.15.0 related to incomplete fixes for the original Log4Shell issue. The repository contains a simple Java web application using Log4j 2.15.0, with a vulnerable logging configuration (PatternLayout with Context Lookup) defined in 'log4j2.xml'. The main Java class ('Test.java') demonstrates how ThreadContext can be manipulated to inject a lookup string, and then logs an error message, which would trigger the vulnerable code path. The README provides background on the vulnerability and an example JNDI payload string that could be used to exploit the issue. The repository structure includes standard Java Maven project files, configuration files, and a JSP file that also performs logging. The exploit demonstrates how an attacker could leverage crafted input to trigger a JNDI lookup, potentially leading to remote code execution or denial of service on vulnerable systems.cckuailong · Disclosed Dec 15, 2021 · java · xml · networkPoCLog4Shell-obfuscated-payloads-generatorThis repository provides a Python script ('Log4Shell-obfuscated-payloads-generator.py') that generates obfuscated payloads for exploiting the Log4Shell vulnerabilities (CVE-2021-44228 and CVE-2021-45046) in Apache Log4j. The script supports generating both 'primary' and 'secondary' obfuscated payloads, which are designed to evade Web Application Firewalls (WAFs) by using various string obfuscation techniques. Payload templates and obfuscation patterns are stored in separate template files, allowing for flexible and randomized payload generation. The main script takes command-line arguments to specify the type and number of payloads to generate, as well as the attacker's callback server (typically a DNS or LDAP server under the attacker's control). The generated payloads are intended for use in penetration testing or red teaming to test the effectiveness of WAFs and detection systems against Log4Shell-style attacks. The repository is well-structured, with clear separation between code, templates, and documentation (including both English and Chinese README files).r3kind1e · Disclosed May 9, 2022 · python · networkPoClog4shell-chainThis repository contains standalone, effect-only proof-of-concept reproducers for the Log4j vulnerability family, not a working RCE delivery framework. Its 32 files include three Java main classes, one Python callback recorder, eight Dockerfiles, two GitHub Actions workflows, three case manifests, three Maven build files, four Log4j XML configurations, documentation and ignore rules. The code-file count includes the four application sources, eight Dockerfiles and two executable workflows; Bash occurs inside workflow steps. The original repository URL, analyzed ref and archive size were not supplied, so their metadata fields use empty/zero placeholders. Case A compares Log4j 2.14.1, 2.15.0 and 2.16.0 using logged LDAP JNDI strings, with a non-default ThreadContext layout intended to demonstrate CVE-2021-45046. Case B compares 2.16.0 and 2.17.0 using a recursive context value and stack-exhaustion canary. Case C compares 2.17.0 and 2.17.1 using an attacker-controlled JDBC appender configuration. These versions include negative controls and should not all be interpreted as vulnerable to every listed CVE. The Java drivers exercise their own bundled dependencies rather than attacking a supplied remote application endpoint. The Python collaborator listens on TCP 1389 by default, receives up to 4096 bytes with a two-second timeout, closes each connection without replying, and records peer address, timestamp and a 256-byte preview. It serves neither Java classes nor LDAP referrals. Initial LDAP traffic may be a bind request without the token-bearing search DN, so a connection record does not guarantee token correlation or successful RCE. Important correctness limitations prevent accepting the manifests' expected 'proven' verdicts as evidence. Case B uses a plain message containing ${ctx:x} and a %msg layout on Log4j 2.16.0, where message lookups are removed; the supplied configuration therefore lacks an evident path to the claimed recursion. Its external watchdog is also not supplied. Case A's exact 2.15.0 bypass and layout evaluation timing remain unvalidated. Case C's JDBC/JNDI initialization, version-specific enablement and dependency wiring also need validation. A dark callback can reflect configuration failure rather than a successful security fix. NOTES.md and the README explicitly state that builds and live trials remain outstanding, despite other prose describing platform-generated proofs. The cases/*.yaml files are declarative inputs for a separate Tegron platform service; no local prove/assert CLI, proof artifacts or platform implementation is included. prove.yml builds images and prints expected chains but does not execute the trials, and its build steps tolerate failure. A separate Ferralon workflow invokes an external pinned scanner with console linking enabled and explicitly configures /runs and /ingest API destinations. Those destinations are CI integration endpoints, not exploit infrastructure; comments claiming that the workflow names no Ferralon host contradict its actual inputs. No reverse shell, persistence, credential theft or malicious code-loading payload is present.ferralon-demo · Disclosed Jun 23, 2026 · java · python · network · local · filePoC
Exposure surface

Affected products & vendors

Products and vendors Mallory has correlated with this vulnerability. Open in Mallory to drill down to specific CPE configurations and version ranges.

VendorProductType
Apache Software FoundationLog4japplication
CvatComputer Vision Annotation Toolapplication
Debian ProjectDebian Linuxoperating_system
Fedora ProjectFedoraoperating_system
Intel CorporationAudio Development Kitapplication
Intel CorporationDatacenter Managerapplication
Intel CorporationGenomics Kernel Libraryapplication
Intel CorporationOneapiapplication
Intel CorporationSecure Device Onboardapplication
Intel CorporationSensor Solution Firmware Development Kitapplication
Intel CorporationSystem Debuggerapplication
Intel CorporationSystem Studioapplication
Siemens6bk1602-0aa12-0tp0 Firmwareoperating_system
Siemens6bk1602-0aa22-0tp0 Firmwareoperating_system
Siemens6bk1602-0aa32-0tp0 Firmwareoperating_system
Siemens6bk1602-0aa42-0tp0 Firmwareoperating_system
Siemens6bk1602-0aa52-0tp0 Firmwareoperating_system
SiemensCaptialapplication
SiemensComosapplication
SiemensDesigo Cc Advanced Reportsapplication
SiemensDesigo Cc Info Centerapplication
SiemensE-Car Operation Centerapplication
SiemensEnergy Engageapplication
SiemensEnergyipapplication
SiemensEnergyip Prepayapplication
SiemensGma-Managerapplication
SiemensHead-End System Universal Device Integration Systemapplication
SiemensIndustrial Edge Managementoperating_system
SiemensIndustrial Edge Management Hubapplication
SiemensLogo! Soft Comfortapplication
SiemensMendixapplication
SiemensMindsphereapplication
SiemensNavigatorapplication
SiemensNxoperating_system
SiemensOpcenter Intelligenceapplication
SiemensOperation Schedulerapplication
SiemensSentron Powermanagerapplication
SiemensSiguard Dsaapplication
SiemensSipass Integratedapplication
SiemensSiveillance Commandapplication
SiemensSiveillance Control Proapplication
SiemensSiveillance Identityapplication
SiemensSiveillance Vantageapplication
SiemensSiveillance Viewpointapplication
SiemensSolid Edge Cam Proapplication
SiemensSolid Edge Harness Designapplication
SiemensSpectrum Power 4application
SiemensSpectrum Power 7application
SiemensSppa-T3000 Ses3000 Firmwareoperating_system
SiemensTeamcenterapplication
SiemensTracealertserverplusapplication
SiemensVesysapplication
SiemensXpedition Enterpriseapplication
SiemensXpedition Package Integratorapplication
SonicwallEmail Securityapplication
FAQ

Frequently asked questions

Is CVE-2021-45046 exploited in the wild?
Yes. As of Nov 4, 2026, Mallory has reports of exploitation in the wild, and CISA added it to KEV on May 1, 2023.
Is there a public exploit for CVE-2021-45046?
Yes. Mallory tracks 4 public exploits or proofs of concept for CVE-2021-45046, the earliest disclosed Dec 15, 2021.
Is there a patch for CVE-2021-45046?
Upgrade affected applications and embedded log4j-core dependencies to a current, supported, vendor-approved fixed release. The releases addressing this vulnerability are Log4j 2.16.0 for Java 8+, 2.12.2 for Java 7, and 2.3.1 for Java 6.
What products are affected by CVE-2021-45046?
Apache Software Foundation Log4j, Siemens 6bk1602-0aa12-0tp0 Firmware, Siemens 6bk1602-0aa22-0tp0 Firmware, Siemens 6bk1602-0aa32-0tp0 Firmware, Siemens 6bk1602-0aa42-0tp0 Firmware, and at least 50 more.
How severe is CVE-2021-45046?
CVE-2021-45046 has a CVSS v3.1 score of 9.0 (Critical) and an EPSS score of 100.0% (100th percentile) as of Nov 4, 2026.
Activity feed

Recent activity

141 sources tracked across advisories, community write-ups, and news. New activity surfaces here as Mallory finds it.

View more in app →
tenable nessus pluginsNews · Oct 4, 2026Unity Linux 20.1050e / 20.1060e / 20.1070e Security Update: av... | Tenable®An incomplete security fix in Apache Log4j 2.15.0 permits attackers controlling Thread Context Map (MDC) input to exploit certain non-default logging configurations. The advisory describes information leakage, remote code execution in some environments, and local code execution in all environments. The Unity Linux advisory identifies an affected avalon-framework package. Nessus detects exposure using self-reported version information rather than testing exploitation.Read more ↗tenable nessus pluginsNews · Aug 28, 2026Unity Linux 20.1050e / 20.1060e / 20.1070-8ae / 20.1070e Secur... | Tenable®A critical Apache Log4j vulnerability caused by an incomplete CVE-2021-44228 fix in Log4j 2.15.0. Under non-default Pattern Layout configurations using Context Lookup or Thread Context Map patterns, attacker-controlled MDC input can invoke JNDI lookups, leading to information disclosure and potentially remote code execution.Read more ↗tenable nessus pluginsNews · Aug 28, 2026Unity Linux 20.1050e / 20.1060e / 20.1070-8ae / 20.1070e Secur... | Tenable®A critical Apache Log4j vulnerability caused by an incomplete prior Log4j fix. In affected non-default logging configurations using Context Lookup or Thread Context Map patterns, attacker-controlled input can trigger JNDI lookup behavior, leading to information disclosure and remote code execution in some environments.Read more ↗tenable nessus pluginsNews · Aug 28, 2026Unity Linux 20.1050e / 20.1060e / 20.1070e Security Update: av... | Tenable®A vulnerability identified as CVE-2021-45046, covered by a Unity Linux local security-check plugin. The content reports available exploits and inclusion in CISA's Known Exploited Vulnerabilities catalog.Read more ↗
+90 more in the timeline. Sign up to see them
Do you run this?See affected versions in your environment and whether adversaries are exploiting this vulnerability against assets like yours.
Check your exposure
Mallory platform

The version that knows your environment.

This page is what’s public. Mallory adds the parts that aren’t: which of your assets are affected, which adversaries are exploiting it right now, and which detections to deploy tonight.
Exposure mappingQuery your assets running an affected version, and investigate the blast radius.
Threat actor evidence12Every report linking this CVE to a named adversary.
Associated malware13Malware families linked to this CVE, with evidence and IOCs.
Detection signatures1YARA, Sigma, Snort, and vendor rules, auto-deployed to your SIEM.
Vendor-by-vendor mappingCross-references every affected SKU, including bundled OEM variants.
Social activity2Community discussion across Reddit, Mastodon, and other social sources.