Skip to content

Exclude jdbc package from log4j#2761

Merged
jaschdoc merged 1 commit into
mainfrom
fix-log4j
Feb 6, 2026
Merged

Exclude jdbc package from log4j#2761
jaschdoc merged 1 commit into
mainfrom
fix-log4j

Conversation

@jaschdoc

@jaschdoc jaschdoc commented Jan 30, 2026

Copy link
Copy Markdown
Collaborator

CVE-2022-23305 is caused by misconfiguration of JDBCAppender which is now removed.

I have checked that the added validation logic fails if log4j is not filtered.

Fixes #2651

@jaschdoc jaschdoc marked this pull request as ready for review January 30, 2026 14:45
@jaschdoc jaschdoc marked this pull request as draft February 2, 2026 09:27
@jaschdoc

jaschdoc commented Feb 2, 2026

Copy link
Copy Markdown
Collaborator Author

Marking as draft for now. I will extend the build files to validate that the jdbc package is gone from the built jars.

@jaschdoc jaschdoc force-pushed the fix-log4j branch 4 times, most recently from d21aa45 to 1f31170 Compare February 2, 2026 10:30
CVE-2022-23305 is caused by misconfiguration of `JDBCAppender` which is now removed.
@jaschdoc jaschdoc marked this pull request as ready for review February 2, 2026 12:00
@jaschdoc jaschdoc requested a review from ting-yuan February 2, 2026 12:00

@ting-yuan ting-yuan left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My I know why not simply bumping log4j version, or switching to jetbrains' fork if still used, or completely removing it if not used?

Excluding the contents from the uber jar seems a bit tricky.

@jaschdoc

jaschdoc commented Feb 4, 2026

Copy link
Copy Markdown
Collaborator Author

My I know why not simply bumping log4j version, or switching to jetbrains' fork if still used, or completely removing it if not used?

Excluding the contents from the uber jar seems a bit tricky.

I attempted to remove it entirely, but Kotlin still requires it (and still depends on version 1.2.17.2 that we also have). We could probably update to version 1.2.17.3 since tests are green but it seems like a bad idea to introduce such a mismatch between KSP and Kotlin. For now this seems like the best local fix that we can apply.

@jaschdoc jaschdoc requested a review from ting-yuan February 4, 2026 13:52
@ting-yuan

Copy link
Copy Markdown
Contributor

I see. But isn't the Kotlin compiler also suffering from the same vulnerability? How do they handle it?

@jaschdoc

jaschdoc commented Feb 5, 2026

Copy link
Copy Markdown
Collaborator Author

I see. But isn't the Kotlin compiler also suffering from the same vulnerability? How do they handle it?

I'm not sure they really handle it at all, but I also do not think they are affected by it. The CVE requires that you misconfigure org.apache.log4j.jdb.JDBCAppender to allow for an attack in the first place, and Kotlin does not mention this class at all: https://github.com/search?q=repo%3AJetBrains%2Fkotlin+%22jdbc%22&type=code

Here is the important sentence from description of the CVE:

Note this issue only affects Log4j 1.x when specifically configured to use the JDBCAppender, which is not the default.

Here is the description of the CVE (I have highlighted the same sentence as above):

By design, the JDBCAppender in Log4j 1.2.x accepts an SQL statement as a configuration parameter where the values to be inserted are converters from PatternLayout. The message converter, %m, is likely to always be included. This allows attackers to manipulate the SQL by entering crafted strings into input fields or headers of an application that are logged allowing unintended SQL queries to be executed. Note this issue only affects Log4j 1.x when specifically configured to use the JDBCAppender, which is not the default. Beginning in version 2.0-beta8, the JDBCAppender was re-introduced with proper support for parameterized SQL queries and further customization over the columns written to in logs. Apache Log4j 1.2 reached end of life in August 2015. Users should upgrade to Log4j 2 as it addresses numerous other issues from the previous versions.

https://nvd.nist.gov/vuln/detail/cve-2022-23305

Of course, long-term it is better to suggest to them that they either also remove the class entirely or upgrade to log4j2.

@jaschdoc jaschdoc merged commit 719ad88 into main Feb 6, 2026
3 checks passed
@jaschdoc jaschdoc deleted the fix-log4j branch February 6, 2026 13:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

symbol-processing-aa-embeddable is now packing CVE-2022-23305 vulnerability (log4j files)

2 participants