
Log4Shell Proof-Of-Concept derived from https://github.com/kozmer/log4j-shell-poc
This repository is a Proof-Of-Concept for CVE-2021-44228 vulnerability.
It is derived from This Repo.
In this repository I have made an example of a vulnerable application and a demonstration of how to exploit it.
I have modified the upstream python script to automate generation of this vulnarability.
In this repo there are two Dockerfiles for easy use as follows:
In this Docker image we download java jdk-8u20 from my google drive as you are required to make an account on oracle in order to download this.
If you do not trust this, you can modify the downloading file from the Dockerfile and download the jdk from here (Make sure you downlaod Java SE Development Kit 8u20 version for linux).
This Docker Image runs a modified version of the script provided by kozmer and it does the following:
Default ports used for this are 1389 for JNDI LDAP, 8000 for the SimpleHttpServer and 9001 for the reverse shell!
In order to compile and run this run:
sudo docker build -t log4j-ldap .
sudo docker run -d -p 8000:8000 -p 1389:1389 log4j-ldap
Use docker logs <containerID> in order to see logs from app and retreive the correct input that need to be provided to the vulnerable app
For this PoC I have considered the default IPs used by docker (172.17.0.1/24), you can change them in ./Docker-Ldap/run.sh script to match your scenario.
In this docker image run a vulnerable web application that uses the unpatched version of Log4J 2 and exposes it on port 8080.
The app source is also available in ./Docker-Vuln, credits to kozmer.
In order to compile and run this run:
sudo docker build -t log4j-ldap .
sudo docker run -d -p 8000:8000 -p 1389:1389 log4j-ldap
Username is the injectable field!
In order to accept the reverse shell you must create a netcat listener for port 9001
nc -lvnp 9001
After downloading the repo, make sure you have docker engine installed and do not have other dokcer images running on your machine.
config.sh script to build images and start them. (This script uses root privileges to run, you can modify them accordingly).9001.localhost:8080docker logs <containerID>).