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

Source: https://junglewise.ai/threats/cve-2022-23305-apache-log4j-sql-injection-in-jdbcappender  
Publisher: Junglewise Threat Intelligence, https://junglewise.ai/threats  
Published: 2022-01-21. Updated: 2026-06-09  
License: CC BY 4.0 with a link back

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](https://junglewise.ai/threats/technologies/log4j), [log4j:log4j (Maven)](https://junglewise.ai/threats/technologies/log4j-log4j), [org.zenframework.z8.dependencies.commons:log4j-1.2.17 (Maven)](https://junglewise.ai/threats/technologies/org-zenframework-z8-dependencies-commons-log4j-1-2-17). Vendors: [Apache](https://junglewise.ai/threats/vendors/apache), [Maven](https://junglewise.ai/threats/vendors/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

- [https://api.github.com/users/SebGondron](https://api.github.com/users/SebGondron)
- [https://github.com/SebGondron](https://github.com/SebGondron)
- [https://api.github.com/users/SebGondron/gists%7B/gist_id%7D](https://api.github.com/users/SebGondron/gists%7B/gist_id%7D)
- [https://api.github.com/users/SebGondron/repos](https://api.github.com/users/SebGondron/repos)
- [https://avatars.githubusercontent.com/u/21343499?v=4](https://avatars.githubusercontent.com/u/21343499?v=4)
- [https://api.github.com/users/SebGondron/events%7B/privacy%7D](https://api.github.com/users/SebGondron/events%7B/privacy%7D)

## Related threats

- [Apache Log4j 1.x (EOL) allows Denial of Service (DoS)](https://junglewise.ai/threats/cve-2023-26464-apache-log4j-1-x-eol-allows-denial-of-service-dos)
- [Deserialization of Untrusted Data in Log4j 1.x](https://junglewise.ai/threats/cve-2022-23302-deserialization-of-untrusted-data-in-log4j-1-x)
- [Deserialization of Untrusted Data in Apache Log4j](https://junglewise.ai/threats/cve-2022-23307-deserialization-of-untrusted-data-in-apache-log4j)
- [JMSAppender in Log4j 1.2 is vulnerable to deserialization of untrusted data](https://junglewise.ai/threats/cve-2021-4104-jmsappender-in-log4j-1-2-is-vulnerable-to-deserialization-of)
- [Apache Log4j deserialization in SocketServer](https://junglewise.ai/threats/cve-2019-17571-apache-log4j-deserialization-in-socketserver)
