Goal Reached Thanks to every supporter — we hit 100%!

Goal: 1000 CNY · Raised: 1000 CNY

100.0%

CVE-2021-44228 PoC — Apache Log4j2 JNDI features do not protect against attacker controlled LDAP and other JNDI related endpoints

Source
Associated Vulnerability
Title:Apache Log4j2 JNDI features do not protect against attacker controlled LDAP and other JNDI related endpoints (CVE-2021-44228)
Description:Apache Log4j2 2.0-beta9 through 2.15.0 (excluding security releases 2.12.2, 2.12.3, and 2.3.1) JNDI features used in configuration, log messages, and parameters do not protect against attacker controlled LDAP and other JNDI related endpoints. An attacker who can control log messages or log message parameters can execute arbitrary code loaded from LDAP servers when message lookup substitution is enabled. From log4j 2.15.0, this behavior has been disabled by default. From version 2.16.0 (along with 2.12.2, 2.12.3, and 2.3.1), this functionality has been completely removed. Note that this vulnerability is specific to log4j-core and does not affect log4net, log4cxx, or other Apache Logging Services projects.
Readme
# Log4j CVE-2021-44228

## Solutions

Think about if you actually really require Log4j2 Core.  Most likely, your own code (or some 3rd-party library you depend on) only need Log4j's Logging API façade - but can log to another back-end.  You could therefore simply completely exclude the [`org.apache.logging.log4j:log4j-core`](https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-core) dependency. 

Use one of several available _"Logging API Bridges"_ to connect (only) `log4j-api` with another Logging Implementation back-end:

1. Log4j2-SLF4j-Logback using [log4j-to-slf4j](https://logging.apache.org/log4j/2.x/log4j-to-slf4j/)

2. [Log4j2-to-JUL](https://github.com/apache/logging-log4j2/tree/release-2.x/log4j-to-jul) from [LOG4J2-3282](https://issues.apache.org/jira/browse/LOG4J2-3282) by me, as https://github.com/vorburger/Learning-Log4j2 illustrates. 

This makes particular sense if you, or your Cloud Provider, has existing infrastructure for the respective back-end:

* [Google Cloud Logging Logback Appender](https://cloud.google.com/logging/docs/setup/java#logback_appender_for), see [on GitHub](https://github.com/googleapis/java-logging-logback#about-cloud-logging-logback-appender), also [with Spring Framework integration](https://github.com/GoogleCloudPlatform/spring-cloud-gcp/tree/main/spring-cloud-gcp-starters/spring-cloud-gcp-starter-logging)

## Background

* https://logging.apache.org/log4j/2.x/security.html
* https://github.com/advisories/GHSA-jfh8-c2jp-5v3q
* https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-44228

## Detection & Scanning, Attack Surface

* https://github.com/github/codeql/pull/7354
* https://github.com/google/tsunami-security-scanner-plugins/issues/219
* https://github.com/YfryTchsGD/Log4jAttackSurface (with [Memes](https://github.com/YfryTchsGD/Log4jAttackSurface/blob/master/pages/MEME.md))

## Mitigations

* https://github.com/apache/logging-log4j2/pull/608
* https://spring.io/blog/2021/12/10/log4j2-vulnerability-and-spring-boot
* https://community.openhab.org/t/openhab-and-the-log4j-security-vulnerability/129901
* https://github.com/vorburger/MariaDB4j/issues/509

## Exploit

* https://www.lunasec.io/docs/blog/log4j-zero-day/#exploit-steps
File Snapshot

[4.0K] /data/pocs/c702b964c7164b93636c2426bb30d714bbb942e6 └── [2.2K] README.md 0 directories, 1 file
Shenlong Bot has cached this for you
Remarks
    1. It is advised to access via the original source first.
    2. Local POC snapshots are reserved for subscribers — if the original source is unavailable, the local mirror is part of the paid plan.
    3. Mirroring, verifying, and maintaining this POC archive takes ongoing effort, so local snapshots are a paid feature. Your subscription keeps the archive online — thank you for the support. View subscription plans →