CVE-2021-45046 - Deserialization of Untrusted Data

Severity

37%

Complexity

22%

Confidentiality

23%

It was found that the fix to address CVE-2021-44228 in Apache Log4j 2.15.0 was incomplete in certain non-default configurations. This could allows attackers with control over Thread Context Map (MDC) input data when the logging configuration uses a non-default Pattern Layout with either a Context Lookup (for example, $${ctx:loginId}) or a Thread Context Map pattern (%X, %mdc, or %MDC) to craft malicious input data using a JNDI Lookup pattern resulting in a denial of service (DOS) attack. Log4j 2.15.0 makes a best-effort attempt to restrict JNDI LDAP lookups to localhost by default. Log4j 2.16.0 fixes this issue by removing support for message lookup patterns and disabling JNDI functionality by default.

It was found that the fix to address CVE-2021-44228 in Apache Log4j 2.15.0 was incomplete in certain non-default configurations. This could allows attackers with control over Thread Context Map (MDC) input data when the logging configuration uses a non-default Pattern Layout with either a Context Lookup (for example, $${ctx:loginId}) or a Thread Context Map pattern (%X, %mdc, or %MDC) to craft malicious input data using a JNDI Lookup pattern resulting in an information leak and remote code execution in some environments and local code execution in all environments. Log4j 2.16.0 (Java 8) and 2.12.2 (Java 7) fix this issue by removing support for message lookup patterns and disabling JNDI functionality by default.

CVSS 3.1 Base Score 3.7. CVSS Attack Vector: network. CVSS Attack Complexity: high. CVSS Vector: (CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:N/A:L).

CVSS 2.0 Base Score 2.6. CVSS Attack Vector: network. CVSS Attack Complexity: high. CVSS Vector: (AV:N/AC:H/Au:N/C:N/I:N/A:P).

CVSS 3.1 Base Score 9. CVSS Attack Vector: network. CVSS Attack Complexity: high. CVSS Vector: (CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:C/C:H/I:H/A:H).

CVSS 2.0 Base Score 5.1. CVSS Attack Vector: network. CVSS Attack Complexity: high. CVSS Vector: (AV:N/AC:H/Au:N/C:P/I:P/A:P).

Demo Examples

Deserialization of Untrusted Data

CWE-502

This code snippet deserializes an object from a file and uses it as a UI button:


               
}
in.close();

This code does not attempt to verify the source or contents of the file before deserializing it. An attacker may be able to replace the intended file with a file that contains arbitrary malicious code which will be executed when the button is pressed.

To mitigate this, explicitly define final readObject() to prevent deserialization. An example of this is:


               
throw new java.io.IOException("Cannot be deserialized"); }

Deserialization of Untrusted Data

CWE-502

In Python, the Pickle library handles the serialization and deserialization processes. In this example derived from [R.502.7], the code receives and parses data, and afterwards tries to authenticate a user based on validating a token.


               
}
raise AuthFail

Unfortunately, the code does not verify that the incoming data is legitimate. An attacker can construct a illegitimate, serialized object "AuthToken" that instantiates one of Python's subprocesses to execute arbitrary commands. For instance,the attacker could construct a pickle that leverages Python's subprocess module, which spawns new processes and includes a number of arguments for various uses. Since Pickle allows objects to define the process for how they should be unpickled, the attacker can direct the unpickle process to call Popen in the subprocess module and execute /bin/sh.

Overview

First reported 3 years ago

2021-12-14 19:15:00

Last updated 3 years ago

2021-12-27 03:15:00

Affected Software

Apache Software Foundation Log4j 2.0

2.0

Apache Software Foundation Log4j 2.0 Beta9

2.0

Apache Software Foundation Log4j 2.0 Release Candidate 1

2.0

Apache Software Foundation Log4j 2.0 Release Candidate 2

2.0

Debian Linux 9.0

9.0

Siemens SIMATIC WinCC 7.4

7.4

Siemens Spectrum Power 4

Siemens Logo! Soft Comfort

References

[oss-security] 20211214 CVE-2021-45046: Apache Log4j2 Thread Context Message Pattern and Context Lookup Pattern vulnerable to a denial of service attack

https://logging.apache.org/log4j/2.x/security.html

https://www.cve.org/CVERecord?id=CVE-2021-44228

https://www.intel.com/content/www/us/en/security-center/advisory/intel-sa-00646.html

[oss-security] 20211214 CVE-2021-45046: Apache Log4j2 Thread Context Message Pattern and Context Lookup Pattern vulnerable to a denial of service attack

Mailing List, Mitigation, Third Party Advisory

https://logging.apache.org/log4j/2.x/security.html

Mitigation, Release Notes, Vendor Advisory

https://www.cve.org/CVERecord?id=CVE-2021-44228

Not Applicable

https://www.intel.com/content/www/us/en/security-center/advisory/intel-sa-00646.html

Third Party Advisory

20211210 Vulnerabilities in Apache Log4j Library Affecting Cisco Products: December 2021

[oss-security] 20211215 Re: CVE-2021-45046: Apache Log4j2 Thread Context Message Pattern and Context Lookup Pattern vulnerable to a denial of service attack

https://cert-portal.siemens.com/productcert/pdf/ssa-661247.pdf

VU#930724

20211210 Vulnerabilities in Apache Log4j Library Affecting Cisco Products: December 2021

Third Party Advisory

[oss-security] 20211215 Re: CVE-2021-45046: Apache Log4j2 Thread Context Message Pattern and Context Lookup Pattern vulnerable to a denial of service attack

Mailing List, Third Party Advisory

https://cert-portal.siemens.com/productcert/pdf/ssa-661247.pdf

Third Party Advisory

VU#930724

Third Party Advisory, US Government Resource

https://cert-portal.siemens.com/productcert/pdf/ssa-714170.pdf

Third Party Advisory

DSA-5022

https://www.oracle.com/security-alerts/alert-cve-2021-44228.html

https://psirt.global.sonicwall.com/vuln-detail/SNWLID-2021-0032

[oss-security] 20211218 Re: CVE-2021-45046: Apache Log4j2 Thread Context Message Pattern and Context Lookup Pattern vulnerable to a denial of service attack

DSA-5022

Third Party Advisory

https://www.oracle.com/security-alerts/alert-cve-2021-44228.html

Third Party Advisory

https://psirt.global.sonicwall.com/vuln-detail/SNWLID-2021-0032

Third Party Advisory

[oss-security] 20211218 Re: CVE-2021-45046: Apache Log4j2 Thread Context Message Pattern and Context Lookup Pattern vulnerable to a denial of service attack

Mailing List, Third Party Advisory

https://cert-portal.siemens.com/productcert/pdf/ssa-397453.pdf

https://cert-portal.siemens.com/productcert/pdf/ssa-479842.pdf

FEDORA-2021-5c9d12a93e

FEDORA-2021-abbe24e41c

Stay updated

ExploitPedia is constantly evolving. Sign up to receive a notification when we release additional functionality.

Get in touch

If you'd like to report a bug or have any suggestions for improvements then please do get in touch with us using this form. We will get back to you as soon as we can.