# CVE-2021-45105: Apache Log4j2 does not always protect from infinite recursion in lookup evaluation

> Archived entry. Full-text search covers entries since 2026-11-10; exact IDs work for all years.

- **Severity:** MEDIUM 5.9
- **CVSS:** 5.9 (v3.1, CNA) `CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:N/A:H`
- **CVSS metrics:** Attack vector: Network; Attack complexity: High; Privileges required: None; User interaction: None; Scope: Unchanged; Confidentiality impact: None; Integrity impact: None; Availability impact: High
- **Exploited in the wild:** Not in CISA KEV
- **Public exploit / PoC:** None known
- **Remote exploitation:** Remote, no login needed
- **EPSS:** 100.00% (percentile 100, 2026-11-26)
- **CWE:** CWE-20, CWE-674
- **Aliases:** GHSA-p6xc-xr62-6r2g
- **Published:** 2021-12-18T11:55:08.000Z
- **Modified:** 2026-08-25T16:28:27.310Z

## Who should check

- Projects that depend on Maven package org.apache.logging.log4j:log4j-core (\>= 2.4.0, \< 2.12.3)
- Projects that depend on Maven package org.ops4j.pax.logging:pax-logging-log4j2 (\>= 1.8.0, \< 1.9.2)
- Anyone running Apache Software Foundation Apache Log4j2 \>= log4j-core, \< 2.17.0

## Description

Apache Log4j2 versions 2.0-alpha1 through 2.16.0 (excluding 2.12.3 and 2.3.1) did not protect from uncontrolled recursion from self-referential lookups. This allows an attacker with control over Thread Context Map data to cause a denial of service when a crafted string is interpreted. This issue was fixed in Log4j 2.17.0, 2.12.3, and 2.3.1.

## Affected and fixed versions

- Maven `org.apache.logging.log4j:log4j-core`: affected \>= 2.4.0, \< 2.12.3; fixed 2.12.3, 2.17.0, 2.3.1 (osv)
- Maven `org.ops4j.pax.logging:pax-logging-log4j2`: affected \>= 1.8.0, \< 1.9.2; fixed 1.9.2, 1.10.9, 1.11.12, 2.0.13 (osv)
- Apache Software Foundation Apache Log4j2: \>= log4j-core, \< 2.17.0 (cvelist)

## Mitigation

- Upgrade org.apache.logging.log4j:log4j-core to one of 2.12.3, 2.17.0, 2.3.1 (or later in the same release line).
- Upgrade org.ops4j.pax.logging:pax-logging-log4j2 to one of 1.9.2, 1.10.9, 1.11.12, 2.0.13 (or later in the same release line).
- Vendor workaround: Implement one of the following mitigation techniques:
- 
- \* Java 8 (or later) users should upgrade to release 2.17.0.
- 
- Alternatively, this can be mitigated in configuration:
- 
- \* In PatternLayout in the logging configuration, replace Context Lookups like \`${ctx:loginId}\` or \`$${ctx:loginId}\` with Thread Context Map patterns (%X, %mdc, or %MDC).
- \* Otherwise, in the configuration, remove references to Context Lookups like \`${ctx:loginId}\` or \`$${ctx:loginId}\` where they originate 
- from sources external to the application such as HTTP headers or user input.

## Check your systems with an agent

Paste this into a coding agent:

```text
Check whether anything I run is affected by CVE-2021-45105. Work read-only: do not install, upgrade, delete or change anything.

Details: https://flawdb.com/CVE-2021-45105.md
Affected: org.apache.logging.log4j:log4j-core >= 2.4.0, < 2.12.3; org.ops4j.pax.logging:pax-logging-log4j2 >= 1.8.0, < 1.9.2
Fixed in: 2.12.3, 2.17.0, 2.3.1, 1.9.2, 1.10.9, 1.11.12, 2.0.13

Steps:
1. Search this machine and project for org.apache.logging.log4j:log4j-core (Maven), org.ops4j.pax.logging:pax-logging-log4j2 (Maven), Apache Software Foundation Apache Log4j2: dependency manifests and lockfiles, installed packages, container images and running services.
2. For each match, note the installed version and whether it is inside the affected range.
3. Report a table: location, installed version, affected (yes / no / unsure), evidence. If affected, say which fixed version or mitigation from the details link applies, but don't apply it.
```

## FAQ

### Is CVE-2021-45105 being exploited?

There is no confirmed exploitation: CVE-2021-45105 is not in the CISA Known Exploited Vulnerabilities catalog. No public exploit code is known. EPSS estimates a 100.00% chance of exploitation in the next 30 days (as of 2026-11-26).

### How serious is CVE-2021-45105?

Medium: CVSS 5.9 (v3.1, scored by CNA). Remote, no login needed. The attack needs conditions outside the attacker's control, which makes it harder.

### Which versions are affected by CVE-2021-45105?

org.apache.logging.log4j:log4j-core \>= 2.4.0, \< 2.12.3; org.ops4j.pax.logging:pax-logging-log4j2 \>= 1.8.0, \< 1.9.2.

### Is there a fix for CVE-2021-45105?

Yes. Fixed in 2.12.3, 2.17.0, 2.3.1, 1.9.2, 1.10.9, 1.11.12, 2.0.13. Upgrade org.apache.logging.log4j:log4j-core to one of 2.12.3, 2.17.0, 2.3.1 (or later in the same release line). Upgrade org.ops4j.pax.logging:pax-logging-log4j2 to one of 1.9.2, 1.10.9, 1.11.12, 2.0.13 (or later in the same release line). Vendor workaround: Implement one of the following mitigation techniques:  \* Java 8 (or later) users should upgrade to release 2.17.0.  Alternatively, this can be mitigated in configuration:  \* In PatternLayout in the logging configuration, replace Context Lookups like \`${ctx:loginId}\` or \`$${ctx:loginId}\` with Thread Context Map patterns (%X, %mdc, or %MDC). \* Otherwise, in the configuration, remove references to Context Lookups like \`${ctx:loginId}\` or \`$${ctx:loginId}\` where they originate  from sources external to the application such as HTTP headers or user input.

### How do I check if I'm affected by CVE-2021-45105?

Find where you use the affected software (dependency lockfiles, installed packages, container images, servers) and compare the installed version with the affected range above. The agent prompt on this page does this read-only.

## References

- vendor: <https://logging.apache.org/log4j/2.x/security.html>
- vendor: <https://tools.cisco.com/security/center/content/CiscoSecurityAdvisory/cisco-sa-apache-log4j-qRuKNEbd>
- vendor: <https://www.debian.org/security/2021/dsa-5024>
- vendor: <https://nvd.nist.gov/vuln/detail/CVE-2021-45105>
- patch: <https://www.oracle.com/security-alerts/cpujan2022.html>
- patch: <https://www.oracle.com/security-alerts/cpuapr2022.html>
- other: <https://psirt.global.sonicwall.com/vuln-detail/SNWLID-2021-0032>
- other: <https://www.kb.cert.org/vuls/id/930724>
- other: <http://www.openwall.com/lists/oss-security/2021/12/19/1>
- other: <https://cert-portal.siemens.com/productcert/pdf/ssa-479842.pdf>
- other: <https://security.netapp.com/advisory/ntap-20211218-0001/>
- other: <https://www.zerodayinitiative.com/advisories/ZDI-21-1541/>
- other: <https://cert-portal.siemens.com/productcert/pdf/ssa-501673.pdf>
- other: <https://www.oracle.com/security-alerts/cpujul2022.html>
- other: <https://www.zerodayinitiative.com/advisories/ZDI-21-1541>
- other: <https://security.netapp.com/advisory/ntap-20211218-0001>
- other: <https://sec.cloudapps.cisco.com/security/center/content/CiscoSecurityAdvisory/cisco-sa-apache-log4j-qRuKNEbd>
- other: <https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/SIG7FZULMNK2XF6FZRU4VWYDQXNMUGAJ>
- other: <https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/EOKPQGV24RRBBI4TBZUDQMM4MEH7MXCY>
- other: <https://lists.debian.org/debian-lts-announce/2021/12/msg00017.html>

## Attribution

- CVE Program: CVE® is a registered trademark of The MITRE Corporation. CVE records © 1999–2026 The MITRE Corporation. <https://www.cve.org/Legal/TermsOfUse>
- NVD: This product uses data from the NVD API but is not endorsed or certified by the NVD. <https://nvd.nist.gov/vuln/detail/CVE-2021-45105>
- OSV: CC-BY 4.0 <https://osv.dev/vulnerability/GHSA-p6xc-xr62-6r2g> (license: <https://creativecommons.org/licenses/by/4.0/>)

HTML: <https://flawdb.com/CVE-2021-45105> · JSON: <https://flawdb.com/api/v1/entries/CVE-2021-45105>
