# CVE-2021-45046: Apache Log4j2 Deserialization of Untrusted Data

> Attackers can achieve remote or local code execution and information disclosure via crafted JNDI inputs in specific non-default Log4j2 configurations.

- **Severity:** Critical 9.0 (`CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:C/C:H/I:H/A:H`)
- **Exploited in the wild:** Yes, since 1 May 2023 (CISA KEV), used in ransomware
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 14 Dec 2021
- **Updated:** 21 Oct 2025
- **Also known as:** DEBIAN-CVE-2021-45046, DSA-5022-1, GHSA-7rjr-3q55-vv33, MGASA-2021-0566, MINI-x4gq-qjph-q7m9, OESA-2021-1467, UBUNTU-CVE-2021-45046

## What is CVE-2021-45046?

CVE-2021-45046 is a critical code injection vulnerability in Debian Debian Linux, published on 14 Dec 2021. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official 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.

Weakness: CWE-917 (Improper Neutralization of Special Elements used in an Expression Language Statement)

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

14 open source packages ship an affected version, including org.ops4j.pax.logging:pax-logging-log4j2 and org.apache.logging.log4j:log4j-core. It affects 55 products.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `org.ops4j.pax.logging:pax-logging-log4j2` | Maven | From 1.10.0 | 1.10.8 |
| `org.ops4j.pax.logging:pax-logging-log4j2` | Maven | From 1.10.0 | 1.10.8 |
| `org.ops4j.pax.logging:pax-logging-log4j2` | Maven | From 1.11.0 | 1.11.11 |
| `org.ops4j.pax.logging:pax-logging-log4j2` | Maven | From 1.11.0 | 1.11.11 |
| `org.ops4j.pax.logging:pax-logging-log4j2` | Maven | From 1.8.0 | 1.9.2 |
| `org.ops4j.pax.logging:pax-logging-log4j2` | Maven | From 1.8.0 | 1.9.2 |
| `org.ops4j.pax.logging:pax-logging-log4j2` | Maven | From 2.0.0 | 2.0.12 |
| `org.ops4j.pax.logging:pax-logging-log4j2` | Maven | From 2.0.0 | 2.0.12 |
| `org.apache.logging.log4j:log4j-core` | Maven | All versions | 2.3.1 |
| `org.apache.logging.log4j:log4j-core` | Maven | All versions | 2.3.1 |
| `org.apache.logging.log4j:log4j-core` | Maven | From 2.13.0 | 2.16.0 |
| `org.apache.logging.log4j:log4j-core` | Maven | From 2.13.0 | 2.16.0 |
| `org.apache.logging.log4j:log4j-core` | Maven | From 2.4.0 | 2.12.2 |
| `org.apache.logging.log4j:log4j-core` | Maven | From 2.4.0 | 2.12.2 |

Products: Apache Log4j, Cvat Computer Vision Annotation Tool, Debian Debian Linux, Fedoraproject Fedora, Intel Audio Development Kit, Intel Datacenter Manager, Intel Genomics Kernel Library, Intel Oneapi, Intel Secure Device Onboard, Intel Sensor Solution Firmware Development Kit, Intel System Debugger, Intel System Studio, Siemens 6bk1602-0aa12-0tp0 Firmware, Siemens 6bk1602-0aa22-0tp0 Firmware, Siemens 6bk1602-0aa32-0tp0 Firmware, Siemens 6bk1602-0aa42-0tp0 Firmware, Siemens 6bk1602-0aa52-0tp0 Firmware, Siemens Captial, Siemens Comos, Siemens Desigo Cc Advanced Reports and 35 more.

## How do I fix CVE-2021-45046?

Upgrade org.ops4j.pax.logging:pax-logging-log4j2 to a fixed version for your release line: 1.10.8, 1.11.11, 1.9.2 or 2.0.12. US federal agencies must fix it by 22 May 2023.

## Is CVE-2021-45046 being exploited?

Yes. Attackers have exploited CVE-2021-45046 in the wild since at least 1 May 2023, including in ransomware campaigns.

Public exploit code:

- Log4j 漏洞本地检测脚本。 Scan all java processes on your host to check whether it's affected by log4j2 remote code execution vulnerability (CVE-2021-45046) (github_poc): https://github.com/lijiejie/log4j2_vul_local_scanner
- Log4j 2.15.0 Privilege Escalation -- CVE-2021-45046 (github_poc): https://github.com/cckuailong/Log4j_CVE-2021-45046
- Public testing data.  Samples of log4j library versions to help log4j scanners / detectors improve their accuracy for detecting CVE-2021-45046 and CVE-2021-44228. TAG_TESTING, OWNER_KEN, DC_PUBLIC (github_poc): https://github.com/mergebase/log4j-samples
- Log4Shell / Log4J Payload - CVE-2021-45046 and CVE-2022-42889 (github_poc): https://github.com/ifconfig-me/Log4Shell-Payloads
- Oh no another one (github_poc): https://github.com/BobTheShoplifter/CVE-2021-45046-Info
- https://github.com/ludy-dev/cve-2021-45046 (github_poc): https://github.com/ludy-dev/cve-2021-45046

## Other vulnerabilities in Debian Debian Linux

- [CVE-2021-44228](https://insights.sbomify.com/CVE-2021-44228/): Apache Log4j2 Remote Code Execution (critical 10.0, exploited in the wild)
- [CVE-2022-23305](https://insights.sbomify.com/CVE-2022-23305/): SQL injection in JDBC Appender in Apache Log4j V1 (critical 9.8)
- [CVE-2017-5645](https://insights.sbomify.com/CVE-2017-5645/): Deserialization of Untrusted Data in Log4j (critical 9.8)
- [CVE-2022-23302](https://insights.sbomify.com/CVE-2022-23302/): Deserialization of untrusted data in JMSSink in Apache Log4j 1.x (high 8.8)
- [CVE-2023-26464](https://insights.sbomify.com/CVE-2023-26464/): Apache Log4j 1.x (EOL) allows DoS in Chainsaw and SocketAppender (high 7.5)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2021-45046 and fix it if it is affected.

What it is: CVE-2021-45046 is a critical code injection vulnerability in Debian Debian Linux, published on 14 Dec 2021. An attacker can exploit it over the internet without logging in, with no action from the victim.
Exploitation: Yes. Attackers have exploited CVE-2021-45046 in the wild since at least 1 May 2023, including in ransomware campaigns.

Affected packages and fixed versions:
- org.ops4j.pax.logging:pax-logging-log4j2 (Maven): affected from 1.10.0; fixed in 1.10.8
- org.ops4j.pax.logging:pax-logging-log4j2 (Maven): affected from 1.10.0; fixed in 1.10.8
- org.ops4j.pax.logging:pax-logging-log4j2 (Maven): affected from 1.11.0; fixed in 1.11.11
- org.ops4j.pax.logging:pax-logging-log4j2 (Maven): affected from 1.11.0; fixed in 1.11.11
- org.ops4j.pax.logging:pax-logging-log4j2 (Maven): affected from 1.8.0; fixed in 1.9.2
- org.ops4j.pax.logging:pax-logging-log4j2 (Maven): affected from 1.8.0; fixed in 1.9.2
- org.ops4j.pax.logging:pax-logging-log4j2 (Maven): affected from 2.0.0; fixed in 2.0.12
- org.ops4j.pax.logging:pax-logging-log4j2 (Maven): affected from 2.0.0; fixed in 2.0.12
- org.apache.logging.log4j:log4j-core (Maven): affected all versions; fixed in 2.3.1
- org.apache.logging.log4j:log4j-core (Maven): affected all versions; fixed in 2.3.1
- org.apache.logging.log4j:log4j-core (Maven): affected from 2.13.0; fixed in 2.16.0
- org.apache.logging.log4j:log4j-core (Maven): affected from 2.13.0; fixed in 2.16.0

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2021-45046/ (Markdown: https://insights.sbomify.com/CVE-2021-45046/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2021-45046
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2021-45046
- OSV: https://osv.dev/vulnerability/CVE-2021-45046

---
From sbomify Insights: https://insights.sbomify.com/CVE-2021-45046/
Summaries are generated and may contain mistakes; the official description above is the record.
