Denial of Service Vulnerability in Apache Log4j2: Uncontrolled Recursion in Thread Context Map

apache-log4j2 Updated 02 Oct 2025

Summary

18/12/2021
N/A
Yes i
Medium
5.9

CVE-2021-45105: 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. Affects apache-log4j2 across 3 version ranges.

< 2.17.0-1~deb11u1 < 02f8c6aee8df3cdc935e9bdd4f2d020306035dbe >= 8d9204a4b4c6016fa6b36513a46502689d6a45c1, < 38513a7d57343881f7bf58f37e67d6a87e0a47c5

Fixed in 2.17.0-1~deb11u1. How to fix ↓

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored Devnack Mobile apps built by Devnack Design, build and launch iOS and Android apps with a senior product team. From idea to store release Start a project

Background

Apache Log4j2 is a popular logging library used in Java applications for logging purposes. It provides a flexible and efficient logging framework that allows developers to log messages in various formats and destinations. The library is widely adopted due to its performance and ease of use. However, certain versions of Log4j2 are vulnerable to a denial of service attack due to uncontrolled recursion in self-referential lookups, which can be exploited by attackers.

Vulnerability Detail

The vulnerability, identified as CVE-2021-45105, affects Apache Log4j2 versions 2.0-alpha1 through 2.16.0 (excluding 2.12.3 and 2.3.1). It arises from the failure to protect against uncontrolled recursion when interpreting crafted strings in the Thread Context Map. An attacker who can control this data can trigger a denial of service, causing the application to become unresponsive. This vulnerability poses a significant risk, especially for applications that rely on user input for logging.

How To Fix

Minimum fixed version

2.17.0-1~deb11u1

This is the first release that contains the fix.

sudo apt-get install --only-upgrade apache-log4j2

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Workaround

If immediate upgrading is not feasible, consider implementing input validation to sanitize any user-controlled data before it is logged. This can help mitigate the risk of an attacker exploiting the vulnerability.

Conclusion

CVE-2021-45105 presents a significant risk to applications using vulnerable versions of Apache Log4j2. It is crucial to upgrade to the latest version to mitigate the risk of denial of service attacks. Additionally, using tools like Vulert can help monitor and identify vulnerabilities in your software effectively.

See every vulnerability recorded for apache-log4j2 →

Share this vulnerability

FAQ

CVE-2021-45105 is a vulnerability in Apache Log4j2 that allows for denial of service due to uncontrolled recursion in self-referential lookups.

Affected versions include Apache Log4j2 versions 2.0-alpha1 through 2.16.0, excluding 2.12.3 and 2.3.1.

You can use Vulert, which monitors and alerts for open-source vulnerabilities in your software by analyzing a manifest file like package-lock.json. Visit Vulert Scanner to check your application without signup.

The CVSS score for CVE-2021-45105 is 5.9, indicating a moderate severity level.

If you cannot upgrade, implement input validation to sanitize user-controlled data before logging to reduce the risk of exploitation.

Related vulnerabilities

Recent vulnerabilities recorded for apache-log4j2.

How To Fix

Minimum fixed version

2.17.0-1~deb11u1

This is the first release that contains the fix.

sudo apt-get install --only-upgrade apache-log4j2

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback