CVE-2021-4104

7.5 HIGH

📋 TL;DR

CVE-2021-4104 is a deserialization vulnerability in Log4j 1.2's JMSAppender that allows remote code execution when attackers can modify Log4j configuration files. This affects systems running Log4j 1.2 with JMSAppender explicitly enabled, which is not the default configuration. Log4j 1.2 reached end-of-life in 2015, making this particularly dangerous for legacy systems.

💻 Affected Systems

Products:
  • Apache Log4j
Versions: Log4j 1.2.x (all versions)
Operating Systems: All operating systems running Java applications
Default Config Vulnerable: ✅ No
Notes: Only vulnerable when JMSAppender is explicitly configured in log4j.properties or log4j.xml. Log4j 1.2 reached end-of-life in August 2015.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Full system compromise with remote code execution leading to data theft, ransomware deployment, or complete system takeover.

🟠

Likely Case

Limited exploitation due to non-default configuration requirement, but successful attacks result in application compromise and lateral movement.

🟢

If Mitigated

No impact if JMSAppender is disabled or proper access controls prevent configuration modification.

🌐 Internet-Facing: MEDIUM - Requires specific non-default configuration and write access to Log4j configs, but internet-facing systems are attractive targets.
🏢 Internal Only: MEDIUM - Internal systems with vulnerable configurations remain at risk from insider threats or compromised accounts.

🎯 Exploit Status

Public PoC: ⚠️ Yes
Weaponized: CONFIRMED
Unauthenticated Exploit: ✅ No
Complexity: MEDIUM

Exploitation requires write access to Log4j configuration files. Similar exploitation patterns to Log4Shell (CVE-2021-44228) but with additional prerequisites.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: N/A - Log4j 1.2 is end-of-life

Vendor Advisory: https://logging.apache.org/log4j/1.2/

Restart Required: Yes

Instructions:

1. Upgrade to Log4j 2.x immediately. 2. Remove Log4j 1.2 from all systems. 3. Restart affected applications after upgrade.

🔧 Temporary Workarounds

Disable JMSAppender

all

Remove or comment out JMSAppender configuration from log4j.properties/log4j.xml files

# Remove lines containing 'JMSAppender' from log4j configuration files
# Example: log4j.appender.jms=org.apache.log4j.net.JMSAppender

Remove JMSAppender class

all

Delete or restrict access to JMSAppender.class file to prevent loading

rm /path/to/log4j-1.2.x.jar org/apache/log4j/net/JMSAppender.class
# Or use Java security policies to restrict class loading

🧯 If You Can't Patch

  • Implement strict file permissions on Log4j configuration files (read-only for application users)
  • Use application allowlisting to prevent unauthorized configuration changes

🔍 How to Verify

Check if Vulnerable:

Check log4j configuration files for JMSAppender references and verify Log4j 1.2 version is in use

Check Version:

java -cp log4j-*.jar org.apache.log4j.Help 2>&1 | grep 'log4j version'

Verify Fix Applied:

Confirm JMSAppender is removed from configuration and Log4j 2.x is installed

📡 Detection & Monitoring

Log Indicators:

  • JMSAppender initialization
  • JNDI lookups in Log4j context
  • Unexpected network connections from logging processes

Network Indicators:

  • Outbound LDAP/RMI connections from applications using Log4j
  • Unexpected JMS traffic

SIEM Query:

source="*log4j*" AND ("JMSAppender" OR "TopicBindingName" OR "TopicConnectionFactoryBindingName")

🔗 References

📤 Share & Export