GHSA-7rjr-3q55-vv33 CVE-2021-45046
Incomplete fix for Apache Log4j vulnerability
- Severity
- 9.0 / 10
- Critical · CVSS 3.1
- Exploit chance (EPSS)
- 99.98%
- Chance of exploitation in the next 30 days. Higher than 99.98% of scored vulnerabilities.
- Known exploited
- Yes
- In CISA's catalog since May 1, 2023
- Weakness
- CWE-502 Deserialization of Untrusted Data
- CWE-917 Improper Neutralization of Special Elements used in an Expression Language Statement ('Expression Language Injection')
- Fix
- Available
- 2 packages have a fixed version
Description
Impact
The fix to address CVE-2021-44228 in Apache Log4j 2.15.0 was incomplete in certain non-default configurations. This could allow 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 a remote code execution (RCE) attack.
Affected packages
Only the org.apache.logging.log4j:log4j-core package is directly affected by this vulnerability. The org.apache.logging.log4j:log4j-api should be kept at the same version as the org.apache.logging.log4j:log4j-core package to ensure compatability if in use.
Mitigation
Log4j 2.16.0 fixes this issue by removing support for message lookup patterns and disabling JNDI functionality by default. This issue can be mitigated in prior releases (< 2.16.0) by removing the JndiLookup class from the classpath (example: zip -q -d log4j-core-*.jar org/apache/logging/log4j/core/lookup/JndiLookup.class).
Log4j 2.15.0 restricts JNDI LDAP lookups to localhost by default. Note that previous mitigations involving configuration such as to set the system property log4j2.formatMsgNoLookups to true do NOT mitigate this specific vulnerability.
Affected versions
Maven
| Package | Vulnerable | Fixed in |
|---|---|---|
| org.apache.logging.log4j:log4j-core | >= 2.13.0, < 2.16.0 |
2.16.0 |
| org.apache.logging.log4j:log4j-core | >= 2.4.0, < 2.12.2 |
2.12.2 |
| org.apache.logging.log4j:log4j-core | < 2.3.1 |
2.3.1 |
| org.apache.logging.log4j:log4j-core | >= 2.13.0, < 2.16.0 |
2.16.0 |
| org.apache.logging.log4j:log4j-core | >= 2.4.0, < 2.12.2 |
2.12.2 |
| org.apache.logging.log4j:log4j-core | < 2.3.1 |
2.3.1 |
| org.ops4j.pax.logging:pax-logging-log4j2 | >= 1.8.0, < 1.9.2 |
1.9.2 |
| org.ops4j.pax.logging:pax-logging-log4j2 | >= 1.10.0, < 1.10.8 |
1.10.8 |
| org.ops4j.pax.logging:pax-logging-log4j2 | >= 1.11.0, < 1.11.11 |
1.11.11 |
| org.ops4j.pax.logging:pax-logging-log4j2 | >= 2.0.0, < 2.0.12 |
2.0.12 |
| org.ops4j.pax.logging:pax-logging-log4j2 | >= 1.8.0, < 1.9.2 |
1.9.2 |
| org.ops4j.pax.logging:pax-logging-log4j2 | >= 1.10.0, < 1.10.8 |
1.10.8 |
| org.ops4j.pax.logging:pax-logging-log4j2 | >= 1.11.0, < 1.11.11 |
1.11.11 |
| org.ops4j.pax.logging:pax-logging-log4j2 | >= 2.0.0, < 2.0.12 |
2.0.12 |
How to fix
Move to the fixed version or later with your package manager, update the lockfile, and run your tests. If the package only arrives through another dependency, upgrade that dependency first. If none of its releases pulls a fixed version yet, force the version with your package manager's override.
org.apache.logging.log4j:log4j-core Maven → 2.16.0
- maven
<dependency><groupId>org.apache.logging.log4j</groupId><artifactId>log4j-core</artifactId><version>2.16.0</version></dependency>- gradle
implementation("org.apache.logging.log4j:log4j-core:2.16.0")
org.ops4j.pax.logging:pax-logging-log4j2 Maven → 1.9.2
- maven
<dependency><groupId>org.ops4j.pax.logging</groupId><artifactId>pax-logging-log4j2</artifactId><version>1.9.2</version></dependency>- gradle
implementation("org.ops4j.pax.logging:pax-logging-log4j2:1.9.2")
Severity breakdown
CVSS 3.1 9.0
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:C/C:H/I:H/A:H
- Attack vector
- Network
- Attack complexity
- High
- Privileges required
- None
- User interaction
- None
- Scope
- Changed
- Confidentiality
- High
- Integrity
- High
- Availability
- High
Weakness
CWE-502: Deserialization of Untrusted Data
The product deserializes untrusted data without sufficiently ensuring that the resulting data will be valid.
How to prevent it
- Architecture and Design, Implementation: If available, use the signing/sealing features of the programming language to assure that deserialized data has not been tainted. For example, a hash-based message authentication code (HMAC) could be used to ensure that data has not been modified.
- Implementation: When deserializing data, populate a new object rather than just deserializing. The result is that the data flows through safe input validation and that the functions are safe.
- Implementation: Explicitly define a final object() to prevent deserialization.
- Architecture and Design, Implementation: Make fields transient to protect them from deserialization. An attempt to serialize and then deserialize a class containing transient fields will result in NULLs where the transient data should be. This is an excellent way to prevent time, environment-based, or sensitive variables from being carried over and used improperly.
- Implementation: Avoid having unnecessary types or gadgets (a sequence of instances and method invocations that can self-execute during the deserialization process, often found in libraries) available that can be leveraged for malicious ends. This limits the potential for unintended or unauthorized types and gadgets to be leveraged by the attacker. Add only acceptable classes to an allowlist. Note: new gadgets are constantly being discovered, so this alone is not a sufficient mitigation.
- Architecture and Design, Implementation: Employ cryptography of the data or code for protection. However, it's important to note that it would still be client-side security. This is risky because if the client is compromised then the security implemented on the client (the cryptography) can be bypassed.
- Operation: Use an application firewall that can detect attacks against this weakness. It can be beneficial in cases in which the code cannot be fixed (because it is controlled by a third party), as an emergency prevention measure while more comprehensive software assurance measures are applied, or to provide defense in depth [REF-1481].
CWE-917: Improper Neutralization of Special Elements used in an Expression Language Statement ('Expression Language Injection')
The product constructs all or part of an expression language (EL) statement in a framework such as a Java Server Page (JSP) using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended EL statement before it is executed.
How to prevent it
- Architecture and Design: Avoid adding user-controlled data into an expression interpreter when possible.
- Implementation: If user-controlled data must be added to an expression interpreter, one or more of the following should be performed: Validate that the user input will not evaluate as an expression Encode the user input in a way that ensures it is not evaluated as an expression
- System Configuration, Operation: The framework or tooling might allow the developer to disable or deactivate the processing of EL expressions, such as setting the isELIgnored attribute for a JSP page to "true".
References
Advisories
Other links
- logging.apache.org/log4j/2.x/security.html
- openwall.com/lists/oss-security/2021/12/14/4
- cve.org/CVERecord
- intel.com/content/www/us/en/security-center/advisory/intel-sa-00646.html
- cert-portal.siemens.com/productcert/pdf/ssa-661247.pdf
- cert-portal.siemens.com/productcert/pdf/ssa-714170.pdf
- kb.cert.org/vuls/id/930724
- debian.org/security/2021/dsa-5022
- psirt.global.sonicwall.com/vuln-detail/SNWLID-2021-0032
- oracle.com/security-alerts/alert-cve-2021-44228.html
- cert-portal.siemens.com/productcert/pdf/ssa-397453.pdf
- cert-portal.siemens.com/productcert/pdf/ssa-479842.pdf
- oracle.com/security-alerts/cpujan2022.html
- oracle.com/security-alerts/cpuapr2022.html
- oracle.com/security-alerts/cpujul2022.html
- security.gentoo.org/glsa/202310-16
- lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/SIG7F…
- lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/EOKPQ…
- sec.cloudapps.cisco.com/security/center/content/CiscoSecurityAdvisory/cisco-sa-apache-log4j-…
- cisa.gov/known-exploited-vulnerabilities-catalog
- openwall.com/lists/oss-security/2021/12/18/1
- openwall.com/lists/oss-security/2021/12/15/3
- logging.apache.org/security.html
- github.com/apache/logging-log4j2/compare/rel/2.3...rel/2.3.1
- lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/EOK…
- lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/SIG…
Timeline
- Published
- Added to CISA's Known Exploited Vulnerabilities catalog
- Remediation due for U.S. federal agencies
- Last updated by the source
- Latest EPSS score
Related advisories
| Advisory | Severity | Why it's related |
|---|---|---|
| GHSA-jfh8-c2jp-5v3q Remote code injection in Log4j | Critical Known exploited | Also affects org.apache.logging.log4j:log4j-core |
| CVE-2026-110879 jackson-databind validates the outer class of a class-name type ID but accepts attacker-selected classes inside its generic arguments, even when those classes… | Critical | Same weakness, CWE-502 |
| GHSA-6757-hggm-hp2w vLLM: Public multimodal SHM handle forgery reaches worker-side `pickle.loads()` with insecure serialization disabled | High | Same weakness, CWE-502 |
| GHSA-673q-mjm6-r5xr Next.js: Unauthenticated Remote Code Execution in `use cache` functions returning typed arrays | Critical | Same weakness, CWE-502 |
| GHSA-c27m-942f-rcfh Microsoft Security Advisory CVE-2026-87697 - .NET and Visual Studio Remote Code Execution Vulnerability | High | Same weakness, CWE-502 |
| GHSA-4w5f-7jp2-w48g Microsoft Security Advisory CVE-2026-83520 - .NET and Visual Studio Remote Code Execution Vulnerability | High | Same weakness, CWE-502 |
| GHSA-4j9v-h7pp-725h Microsoft Security Advisory CVE-2026-70035 - .NET and Visual Studio Remote Code Execution Vulnerability | High | Same weakness, CWE-502 |
| GHSA-gqvg-gmmx-x4hm MLFLOW_ALLOW_PICKLE_DESERIALIZATION=False safety control bypassed by mlflow.statsmodels flavor — RCE via crafted model artifact | High | Same weakness, CWE-502 |
Credits: afdesk, mrjonstrong, noren95, ppkarwasz
MergeHarbor checks every repository's dependencies against this database, ranks what matters by exploitability and reachability, routes it to the owning team and opens the fix pull request.
Check your repos with MergeHarbor