Apache Log4j2 versions up to 2.14.1 are vulnerable to JNDI injection attacks, which can execute arbitrary code via LDAP and other JNDI endpoints if log messages or parameters are attacker-controlled and message lookup substitution is enabled. This vulnerability has been mitigated in Log4j 2.15.0, where the JNDI features are disabled by default.
Upgrade Log4j2 to version 2.17.1 or newer to address JNDI injection vulnerabilities. For versions earlier than 2.17.1, mitigate the risk by setting the system property “log4j2.formatMsgNoLookups” to “true” or removing the JndiLookup class from the classpath. Additionally, Java 8u121 and later protect against remote code execution by defaulting “com.sun.jndi.rmi.object.trustURLCodebase” and “com.sun.jndi.cosnaming.object.trustURLCodebase” to “false”.