Apache Log4J Remote Code Execution Vulnerability (CVE-2021-44228)

Description

UPDATE 12/22: Updated Mitigation section for a joint advisory released by US-CERT.


FortiGuard Labs is aware of a remote code execution vulnerability in Apache Log4j. Log4j is a Java based logging audit framework within Apache. Apache Log4j2 2.14.1 and below are susceptible to a remote code execution vulnerability where a remote attacker can leverage this vulnerability to take full control of a vulnerable machine.


This vulnerability is also known as Log4shell and has the CVE assignment (CVE-2021-44228). FortiGuard Labs will be monitoring this issue for any further developments.


What are the Technical Details?

Apache Log4j2 versions 2.14.1 and below Java Naming and Directory Interface (JNDI) features do not protect against attacker controlled LDAP and other JNDI related endpoints. A remote code execution vulnerability exists where attacker controlled log messages or log message parameters are able to execute arbitrary code loaded from LDAP servers when message lookup substitution is enabled.


What Versions of Software are Affected?

Apache Log4J versions 2.0-beta9 to 2.14.1 are affected.


Is there a Patch or Security Update Available?

Yes, moving to version 2.15.0 mitigates this issue. Further mitigation steps are available from Apache as well. Please refer to the "Apache Log4j Security Vulnerabilities" in the APPENDIX for details.


What is the CVSS Score?

10 (CRITICAL)


What is Exactly Apache Log4j?

According to Apache:

Log4j is a tool to help the programmer output log statements to a variety of output targets. In case of problems with an application, it is helpful to enable logging so that the problem can be located. With log4j it is possible to enable logging at runtime without modifying the application binary. The log4j package is designed so that log statements can remain in shipped code without incurring a high performance cost. It follows that the speed of logging (or rather not logging) is capital.


At the same time, log output can be so voluminous that it quickly becomes overwhelming. One of the distinctive features of log4j is the notion of hierarchical loggers. Using loggers it is possible to selectively control which log statements are output at arbitrary granularity.


What is the Status of Protections?

FortiGuard Labs has IPS coverage in place for this issue as (version 19.215):


Apache.Log4j.Error.Log.Remote.Code.Execution


While we urge customers to patch vulnerable systems as soon as possible, FortiEDR monitors and protects against payloads delivered by exploitation of the vulnerability. The picture below demonstrates blocking of a PowerShell payload used as part of CVE-2021-44228 exploitation:




Detection of exploitable systems is possible via FortiEDR threat hunting by searching for loading of vulnerable log4j versions. This is an example of loading a vulnerable log4j library by a Apache Tomcat Server:




For further details on how FortiEDR protects against Log4j, please refer to the "Technical Tip : How FortiEDR protects against the exploitation of Log4shell" article located in the APPENDIX.

Any Suggested Mitigation? (UPDATED 12/22)

According to Apache, the specific following mitigation steps are available:


In releases >=2.10, this behavior can be mitigated by setting either the system property log4j2.formatMsgNoLookups or the environment variable LOG4J_FORMAT_MSG_NO_LOOKUPS to "true." For releases from 2.0-beta9 to 2.10.0, the mitigation is to remove the JndiLookup class from the classpath: zip -q -d log4j-core-*.jar org/apache/logging/log4j/core/lookup/JndiLookup.class


FortiGuard Labs recommends organizations affected by CVE-2021-44228 to update to the latest version of 2.15.0 immediately. Apache also recommends that users running versions 1.0 or lower install version 2.0 or higher as 1.0 has reached end of life in August 2015 for Log4j to obtain security updates. Binary patches are never provided and must be compiled. For further details, refer to the "Apache Log4j Security Vulnerabilities" in the APPENDIX.


If this is not possible, various counter measures such as isolating machines behind a firewall or VPN that are public facing is recommended.


US-CERT along with other global cybersecurity agencies have issued a joint advisory on Log4j titled "Alert (AA21-356A) Mitigating Log4Shell and Other Log4j-Related Vulnerabilities." This advisory contains mitigation tips and strategies for Log4j and affected vulnerabilities (CVE-2021-44228, CVE-2021-45046, and CVE-2021-45105. For further details, please refer to the link in the APPENDIX.

description-logoOutbreak Alert

A 0-day exploit was discovered on a popular Java library Log4j2 that can result to a Remote Code Execution (RCE). This is a widely deployed library, and while systems protected by Fortinet Security Fabric are secured by the protections below, all systems need to upgrade ASAP as this is 10.0 severity. Due to the high visibility and attention, subsequent vulnerabilities have since emerged

View the full Outbreak Alert Report

Telemetry