CVEfocus › CVE database › CVE-2021-45105

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

CVSS 5.9 MediumEPSS 99.9% (in the top 1% of all CVEs)Published 2021-12-18Updated 2026-05-29Assigner: apache

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.

CWE-20CWE-674

What to do

Likely to be exploited: EPSS gives a 100% chance of exploitation in the next 30 days. Treat it as urgent if you run an affected version.

Fixed builds are available from Debian, Maven, Ubuntu: see the table below for the fixed version per release.

Ubuntu has not shipped a fix for every release yet.

Is your server affected? One read-only command checks every installed package against this CVE and all others, using each vendor's fixed versions. Get started or get a free API key.

curl -sS "https://api.cvefocus.com/v1/check?format=text" -H "Authorization: Bearer $CVEFOCUS_KEY" \
  -H "Content-Type: text/plain" --data-binary @inventory.txt

Vendor status at a glance

7Fixed
1Fix pending
12Not affected

Status by vendor and release

From each vendor's own security data and VEX statements. "Fixed" means a fixed build is published for that release.

ReleasePackageStatusFixed versionAdvisory
Ubuntu 26.04apache-log4j2Not affected
vulnerable_code_not_present
Ubuntu 25.10apache-log4j2Not affected
vulnerable_code_not_present
Ubuntu 24.04apache-log4j2Not affected
vulnerable_code_not_present
Ubuntu 22.04apache-log4j2Not affected
vulnerable_code_not_present
Ubuntu 20.04apache-log4j2Fixed2.17.0-0.20.04.1UBUNTU-CVE-2021-45105
Ubuntu 18.04apache-log4j2Fixed2.12.4-0ubuntu0.1UBUNTU-CVE-2021-45105
Ubuntu 16.04apache-log4j2Fix pendingUBUNTU-CVE-2021-45105
Debian 14apache-log4j2Fixed2.17.0-1DEBIAN-CVE-2021-45105
Debian 13apache-log4j2Fixed2.17.0-1DEBIAN-CVE-2021-45105
Debian 12apache-log4j2Fixed2.17.0-1DEBIAN-CVE-2021-45105
Red Hat Enterprise Linux 8log4j12Not affected
Red Hat Enterprise Linux 8log4j12-javadocNot affected
Red Hat Enterprise Linux 7log4jNot affected
Red Hat Enterprise Linux 7log4j-javadocNot affected
Red Hat Enterprise Linux 7log4j-manualNot affected
Red Hat Enterprise Linux 6log4jNot affected
Red Hat Enterprise Linux 6log4j-javadocNot affected
Red Hat Enterprise Linux 6log4j-manualNot affected
Maven libraryorg.apache.logging.log4j:log4j-coreFixed2.3.1GHSA-p6xc-xr62-6r2g
Maven libraryorg.ops4j.pax.logging:pax-logging-log4j2Fixed2.0.13GHSA-p6xc-xr62-6r2g

What the vendor says

As published in the CVE record by apache, the CVE's assigner (usually the vendor). Check the vendor's advisory before acting.

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.

Vendor advisories:

References

About this page

Compiled by CVEfocus from the CVE List, the security data and VEX statements of Ubuntu, Debian, Red Hat, AlmaLinux, Rocky Linux and Microsoft, CISA's Known Exploited Vulnerabilities catalog and FIRST EPSS, refreshed several times a day (data status). Information only; see the disclaimer. Official record: cve.org · NVD.