Issues » log4j2 JNDI Remote Expoit

Issue: SI-58
Date: Dec 10, 2021, 8:30:00 AM
Severity: Critical
Requires Admin Access: No
Fix Version: 21.06.4lts,, 21.12
Credit: Chen Zhaojun of Alibaba Cloud Security Team

Like most enterprise java based systems, dotCMS relies on log4j2 for system logging.   Apache Log4j2 <=2.14.1 JNDI features that are used in configuration, log messages, and parameters do not protect against attacker controlled LDAP and other JNDI related endpoints. An attacker who can control log messages or log message parameters can execute arbitrary code loaded from LDAP servers when message lookup substitution is enabled.

How to test if dotCMS is vulnerable
Try to log in (native) using the following string as the username:
${jndi:ldap://}and any password.

If you see the following message in dotcms.log OR catalina.out (need to check both on binary installs), or in docker logs, then the site is vulnerable:
AsyncAppender-generic WARN Error looking up JNDI resource [ldap://]. javax.naming.CommunicationException: [Root exception is]
The following message is fine and expected, it does not indicate there is an issue:
ERROR ejb.UserManagerImpl - Invalid email throwing a UserEmailAddressException: ${jndi:ldap://}


There are a number of way to mitigate this vulnerability:

1. Upgrade dotCMS

Upgrade to one of the following dotCMS versions (all of which include the fix for this issue):

  • 21.06.5 LTS (or later version of 21.06)
  • LTS (or later version of 5.3.8)
  • 21.12

2. Remove the JndiLookup class from the log4j jar file

a. Find the path to the log4j jar file:
Run the following command from the root of the dotCMS installation directory:
find $DOTCMS_ROOT -name "*log4j-core-*.jar"

b. Find the path to the JndiLookup.class file within the jar
The path to the class varies in different dotCMS versions.  Run the following command from the root of the dotCMS installation directory:
unzip -l ${log4j_jar_path} | grep JndiLookup.class | awk '{print $4}'

c. Remove the class file from the jar
Run the following zip command, using the appropriate paths (from steps a. and b. above):

d. Restart dotCMS.

3. Block requests at the WAF
If you use a WAF, you can block any request that contains the following pattern in headers, parameters and/or POST data: ${jndi:
Most WAF providers (including AWS) have already instituted a rule to block such requests.

Verifying the Fix

You can test whether this behavior fixes the issue by going to the dotCMS back end login screen and trying to login with ${jndi:ldap://} as the user name/email. If your system is patched, you should only see a normal login error in your logs/catalina.out file similar to the following:Invalid email throwing a UserEmailAddressException: ${jndi:ldap://}

If your system is vulnerable, you will see an error in your logs/catalina.out similar to the following:

INFO: HV000001: Hibernate Validator 4.3.2.Final
2021-12-10 19:53:53,135 Log4j2-TF-1-AsyncLogger[AsyncContext@39ee94de]-1 WARN Error looking up JNDI resource [ldap://]. javax.naming.CommunicationException: [Root exception is]
at java.naming/com.sun.jndi.ldap.Connection.<init>(
at java.naming/com.sun.jndi.ldap.LdapClient.<init>(
at java.naming/com.sun.jndi.ldap.LdapClient.getInstance(
at java.naming/com.sun.jndi.ldap.LdapCtx.connect(
at java.naming/com.sun.jndi.ldap.LdapCtx.<init>(
at java.naming/com.sun.jndi.url.ldap.ldapURLContextFactory.getUsingURLIgnoreRootDN(
at java.naming/com.sun.jndi.url.ldap.ldapURLContext.getRootURLContext(
at java.naming/com.sun.jndi.toolkit.url.GenericURLContext.lookup(
at java.naming/com.sun.jndi.url.ldap.ldapURLContext.lookup(
at java.naming/javax.naming.InitialContext.lookup(
at org.apache.logging.log4j.core.lookup.JndiLookup.lookup(
at org.apache.logging.log4j.core.lookup.Interpolator.lookup(
at org.apache.logging.log4j.core.lookup.StrSubstitutor.resolveVariable(
at org.apache.logging.log4j.core.lookup.StrSubstitutor.substitute(
at org.apache.logging.log4j.core.lookup.StrSubstitutor.substitute(


For more information, see:

Examples of companies affected:

dotCMS remediation: