Skip to content

Security/keycloak 11 log4j deser vuln - #39844

Closed
rileyseaburg wants to merge 6 commits into
keycloak:mainfrom
GSA-TTS:security/KEYCLOAK-11-log4j-deser-vuln
Closed

rileyseaburg wants to merge 6 commits into
keycloak:mainfrom
GSA-TTS:security/KEYCLOAK-11-log4j-deser-vuln

Conversation

@rileyseaburg

Copy link
Copy Markdown

Description

This PR addresses a security vulnerability in Log4j 1.2.x where the SocketServer class is vulnerable to deserialization of untrusted data. This vulnerability can be exploited to remotely execute arbitrary code when combined with a deserialization gadget when listening to untrusted network traffic for log data.

Changes

  • Removed Log4j 1.2.17 from root pom.xml
  • Migrated all modules to Log4j 2.24.3:
    • testsuite/model
    • testsuite/utils
    • testsuite/integration-arquillian/tests
    • util/embedded-ldap
  • Replaced slf4j-reload4j with log4j-slf4j2-impl
  • Updated logging configuration from log4j.properties to log4j2.xml
  • Updated org.jboss.logging.provider to use log4j2

Security Impact

This change mitigates a deserialization vulnerability that affects Log4j versions 1.2 up to 1.2.17. The vulnerability has no CVE assigned but was reported in Log4j's issue tracker.

Migration Notes

The change moves from Log4j 1.x to Log4j 2.x which is the recommended logging framework. Log4j 2 provides significant improvements in terms of performance, security, and features over Log4j 1.x.

Testing Done

  • Verify all tests pass with new logging implementation
  • Verify logging works correctly across all affected modules
  • Verify no regression in functionality

Related Issues

Fixes #11

Documentation Impact

No documentation changes required as this is an internal dependency update.

dependabot Bot and others added 6 commits May 19, 2025 17:20
Bumps commons-io:commons-io from 2.7 to 2.14.0.

---
updated-dependencies:
- dependency-name: commons-io:commons-io
  dependency-version: 2.14.0
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>
…n/tests/commons-io-commons-io-2.14.0

Bump commons-io:commons-io from 2.7 to 2.14.0 in /docs/documentation/tests
Signed-off-by: Riley Seaburg <riley.seaburg@gsa.gov>
Signed-off-by: Riley Seaburg <riley.seaburg@gsa.gov>
* Remove Log4j 1.2.17 from root pom.xml
* Migrate all modules to Log4j 2.24.3
* Replace slf4j-reload4j with log4j-slf4j2-impl
* Update logging configuration to log4j2.xml format
@rileyseaburg

rileyseaburg commented May 20, 2025 •

Copy link
Copy Markdown
Author

If you all want to merge this you can, I accidentally opened this.

It does fix the security issue but I'm not going to resign the commit.

Ref: https://github.com/GSA-TTS/keycloak/security/dependabot/11

@ahus1

ahus1 commented May 21, 2025

Copy link
Copy Markdown
Member

IMHO this change would need more updates:

  • The log4j.properties would need to be converted to the XML format (as referenced in the pom.xml)
  • There is a markdown file that seems unrelated.

Due to the comment "opened by accident" and "I'm not going to resign the commit", I'm closing this PR. If you want to continue working on it, please reopen it. And we would need a sign-off before merging it.

@ahus1 ahus1 closed this May 21, 2025
@rileyseaburg

Copy link
Copy Markdown
Author

The CVE still needs to be fixed. Please ensure it's patched.

@ahus1

ahus1 commented May 21, 2025

Copy link
Copy Markdown
Member

There is already issue #27932 for that. While this is used in tests, it isn't packaged in Keycloak.
Feel free to contribute a PR referencing that issue.

@rileyseaburg

Copy link
Copy Markdown
Author

No worries man I patched our fork already. Cheers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants