Linux
View all Worklets
LinuxLinux

Log4j Temporary Vulnerability Fix

Removes the JndiLookup class from Log4j JAR files to temporarily mitigate the CVE-2021-44228 Log4Shell vulnerability

Worklet Details

What the Log4Shell temporary mitigation does

This Automox Worklet™ mitigates CVE-2021-44228, the critical Log4Shell vulnerability that allows remote code execution through Log4j's message lookup functionality. The vulnerability enables attackers to execute arbitrary code by sending specially crafted log messages containing JNDI lookup strings.

The Worklet uses the zip command to remove org/apache/logging/log4j/core/lookup/JndiLookup.class from the log4j-core JAR file. Removing this class disables the JNDI lookup feature that attackers exploit.

Why apply the Log4Shell temporary fix

Log4Shell (CVE-2021-44228) was assigned a CVSS score of 10.0, the maximum severity. It affects Log4j 2.x versions before 2.15.0. Attackers actively exploited this vulnerability within days of disclosure, deploying ransomware, cryptominers, and backdoors across thousands of organizations.

Upgrading to a patched Log4j version is the recommended permanent fix. This Worklet provides a temporary workaround when upgrades require extended testing or involve complex dependencies. It buys time while you prepare for a proper upgrade.

Be aware that this modification may break applications that legitimately use JNDI lookups in log messages. Always test in a non-production environment first. Your software development lifecycle (SDLC) pipeline may also overwrite these changes during deployment.

How Log4Shell mitigation works

  1. Evaluation phase: Always triggers remediation (exit 1) because this is a run-once mitigation action. You should only run this on endpoints with vulnerable Log4j installations.

  2. Remediation phase: Uses zip -q -d to remove JndiLookup.class from log4j-core-*.jar files in the specified log4jpath directory. Reports success or failure. Requires a full application restart afterward to make the change take effect.

Log4Shell mitigation requirements

  • Linux endpoints with Log4j 2.x installed

  • Modify log4jpath variable to point to your Log4j installation (e.g., /usr/local/apache-log4j-2.14.1-bin)

  • zip command available on the endpoint

  • Root privileges for the Automox agent

  • Thorough testing before production deployment

  • Full application restart after modification

Expected state after Log4j modification

After remediation, the JndiLookup.class is removed from the Log4j core JAR file. Verify with unzip -l log4j-core-*.jar | grep JndiLookup which should return no output. You can verify this change through the Automox Activity Log or by checking the endpoint configuration directly.

JNDI lookup functionality in log messages is disabled. Applications attempting to use this feature will receive errors instead of executing lookups. The Log4Shell vulnerability cannot be exploited through this Log4j installation. Plan to upgrade to Log4j 2.17.0 or later as your permanent solution.

How to validate log4j temporary vulnerability fix changes

  1. Run this Worklet on a pilot Linux endpoint and review evaluation output for log4j temporary vulnerability fix.

  2. Confirm Automox activity logs show successful completion and exit code 0.

  3. Verify endpoint state using checks aligned to evaluation script logic, such as exit.

  4. Validate remediation effects from script operations such as else, then rerun evaluation for compliance.

For technical validation, compare endpoint state to the Worklet evaluation logic and remediation flow for log4j temporary vulnerability fix. This supports repeatable security workflows, faster change control review, and auditable compliance evidence.

Useful script references for this Worklet include evaluation operations such as exit and remediation operations such as else. Use these indicators to verify that endpoint changes match intended policy outcomes.

View in app
evalutation image
remediation image

Consider Worklets your easy button

What's a Worklet?

A Worklet is an automation script, written in Bash or PowerShell, designed for seamless execution on endpoints – at scale – within the Automox platform. Worklet automation scripts perform configuration, remediation, and the installation or removal of applications and settings across Windows, macOS, and Linux.

do more with worklets