CVE-2022-23305: Apache Log4j SQL injection in JDBCAppender

CVE-2022-23305 · Severity: critical · CVSS 9.8 · Published 2022-01-21

Apache Log4j is a widely used logging library for Java applications. A vulnerability in an optional component called JDBCAppender allows attackers to execute unauthorized database commands by sending specially crafted data (such as web headers or form input) that the application then logs. This could lead to the theft of sensitive data, modification of database records, or a complete compromise of the connected database.

Technologies: Apache Log4j, log4j:log4j (Maven), org.zenframework.z8.dependencies.commons:log4j-1.2.17 (Maven). Vendors: Apache, Maven.

Quick answers

Is CVE-2022-23305 exploited in the wild?
No. Junglewise Threat Intelligence has no report of CVE-2022-23305 being exploited in the wild.
How severe is CVE-2022-23305?
Critical severity, with a CVSS score of 9.8, published 21 January 2022.
Which products and versions are affected?
Apache Log4j <= 1.2.17; log4j:log4j (Maven) <= 1.2.17, ECOSYSTEM:introduced=0,last_affected=1.2.17; org.zenframework.z8.dependencies.commons:log4j-1.2.17 (Maven) <= 2.0, ECOSYSTEM:introduced=0,last_affected=2.0.
Is there a fix for CVE-2022-23305?
No fixed version is recorded yet. Check the vendor's advisory in the references below. If you run it, Junglewise drafts a mitigation that fits your setup and applies it once you approve, with senior security engineers behind it.
How is CVE-2022-23305 attacked?
It is attacked over the network, in a software library.
Am I affected by CVE-2022-23305?
Check whether you run Apache Log4j, log4j:log4j (Maven) or org.zenframework.z8.dependencies.commons:log4j-1.2.17 (Maven) at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

Technical details

A SQL injection vulnerability exists in the JDBCAppender of Apache Log4j 1.2.x. The component constructs SQL statements by interpolating PatternLayout converters, such as the message converter (%m), directly into SQL strings without proper sanitization. An attacker can exploit this by providing crafted input (e.g., via HTTP headers or application fields) that is subsequently logged, allowing the execution of arbitrary SQL queries. This issue specifically affects Log4j 1.x when the non-default JDBCAppender is enabled. Because Log4j 1.2 reached end-of-life in 2015, no official patch is available; users are advised to migrate to Log4j 2.x, which uses parameterized queries.

Affected products

  • Apache Log4j <= 1.2.17

Identifiers

  • CVE-2022-23305
  • GHSA-65fg-84f6-3jq3

Timeline

  • 2015-08-05: other: Log4j 1.2 reached end of life
  • 2022-01-18: disclosed: NVD publication date
  • 2022-01-21: advisory: GitHub Advisory published

References

This page as Markdown. Free to reuse under CC BY 4.0 with a link back.