[Aikido] Fix security issue in log4j-core via minor version upgrade from 2.14.0 to 2.25.4 in services#2
Open
aikido-autofix[bot] wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Upgrade log4j-core to fix critical RCE vulnerabilities via JNDI injection and MDC exploitation, plus XML sanitization issues. This update includes breaking changes that require manual migration.
1. JNDI functionality disabled by default (2.16.0)
Where your code is affected:
services/identity/src/main/java/com/crapi/service/Impl/UserServiceImpl.java(lines 48-50, 95-103) - The code instantiatesLog4jContextFactoryand usesLOG4J_LOGGERto log user input containing JNDI expressions.Impact: The code appears to be intentionally testing Log4j JNDI vulnerability behavior. With JNDI disabled by default in 2.16.0+, the
LOG4J_LOGGER.error()call with JNDI expressions will no longer trigger JNDI lookups, changing the application's behavior whenENABLE_LOG4Jenvironment variable is set to true.Remediation: If JNDI functionality is required for testing purposes, set the system property
log4j2.enableJndiLookup=true(though this is not recommended for security reasons). Otherwise, update the test logic to reflect that JNDI lookups are now disabled by default.2. Message Lookups completely removed (2.16.0)
Where your code is affected: Same location as above -
services/identity/src/main/java/com/crapi/service/Impl/UserServiceImpl.java(line 103)Impact: Any message lookups in log statements will no longer be processed. The JNDI expression
${jndi:ldap://127.0.0.1/a}in the email field will be logged as a literal string rather than being evaluated.Remediation: Update test expectations to reflect that lookup expressions are now treated as literal strings in log messages.
Note: The codebase uses
logback.xmlfor configuration (not log4j2.xml), but explicitly imports and uses log4j-core classes (Log4jContextFactory,LogManager) alongside the default SLF4J/Logback setup. This dual logging setup means the log4j breaking changes will affect theLOG4J_LOGGERusage specifically.All breaking changes by upgrading org.apache.logging.log4j:log4j-core from version 2.14.0 to 2.25.4 (CHANGELOG)
%msg{lookup}in Pattern Layout. Thelog4j2.formatMsgNoLookupsproperty andnolookupsmessage pattern converter option have been removed.Referenceableinterface and restricts Serializable classes to Java primitive classes by default, requiring an allow list for remote LDAP servers.log4j2.enableJndisystem property to be set to true to enable it.log4j2.enableJndiproperty has been replaced with three individual properties:log4j2.enableJndiContextSelector,log4j2.enableJndiJms, andlog4j2.enableJndiLookup.log4j-slf4j-impl,log4j-slf4j2-impl,log4j-to-jul,log4j-to-slf4j) have had their module names changed.log4j2.disableJmx=falseto enable.log4j1.compatibilityisfalse.{ansi}option in exception converters has been removedDateTimeFormatterinstead of custom formatters (FixedDateFormatandFastDateFormat), which may cause formatting issues withnorxdirectivesGraalVmProcessorwill fail the build if requiredlog4j.graalvm.groupIdandlog4j.graalvm.artifactIdparameters are not provided when building third-party Log4j plugins✅ 7 CVEs resolved by this upgrade, including 2 critical 🚨 CVEs
This PR will resolve the following CVEs: