首页 > 其他分享 >spring heapdump泄露 heapdump_tool.jar

spring heapdump泄露 heapdump_tool.jar

时间:2023-04-26 12:12:15浏览次数:35  
标签:spring tool value heapdump input password class

https://github.com/wyzxxz/heapdump_tool

 

heapdump_tool
声明: 此工具仅用于企业安全人员自查验证自身企业资产的安全风险,或有合法授权的安全测试,请勿用于其他用途,如有,后果自负。
下载地址:https://toolaffix.oss-cn-beijing.aliyuncs.com/wyzxxz/20230425/heapdump_tool.jar


+ 20230425
+ 输出内容会写到当前目录下 文件名_output.txt,方便随时查询
+ 新增功能hashtable读取,可获取比较多的信息, 结果展示优化
+ 新增2个功能systemproperties,allproperties,读取properties数据


+ 20230406
+ 新增shirokey查找识别,输入shirokey即可
+ class方式信息模糊查询, 例如 class="shiro".web.mgt , class方式可以挖出来更多的数据,大家自己尝试

+ 使用体感和部分功能调优。
+ 对gz文件自动解压
+ 增加了模式选择,大于15W数据时,可以选择模式0 ,不用加载所有数据,直接快速查询数据


该工具是基于jhat,通过jhat解析heapdump文件,所以需要安装jdk和配置好环境变量,例如win \Java\jdk8\bin\jhat.exe,
在控制台输入jhat检查是否安装正确。

usage:> java -jar heapdump_tool.jar heapdump
查询方式:
1. 关键词 例如 password
2. 字符长度 len=10 获取长度为10的所有key或者value值
3. 按顺序获取 num=1-100 获取顺序1-100的字符
4. class模糊搜索 class="xxx" 获取class的instance数据信息
5. id查询 id=0xaaaaa 获取id为0xaaaaa的class或者object数据信息
4. re正则查询 re=xxx 自定义正则查询数据信息
获取url,file,ip
shirokey 获取shirokey的值
geturl 获取所有字符串中的url
getfile 获取所有字符串中的文件路径文件名
getip 获取所有字符串中的ip
默认不输出查询结果非key-value格式的数据,需要获取所有值,输入all=true,all=false取消显示所有值。

----------------------------------------------------

常见的heapdump泄露,大多都是spring heapdump泄露

这里以spring heapdump泄露 为例

访问 /actuator/env 得到部分信息如下

properties: {
spring.datasource.driver-class-name: {
value: "com.mysql.cj.jdbc.Driver",
origin: "URL [file:/home/test/deploy/config/application-pressure.yml]:3:24"
},
spring.datasource.url: {
value: "jdbc:mysql://test.mysql.rds.aliyuncs.com:3306/test?useUnicode=true&characterEncoding=utf-8&useTimezone=true&serverTimezone=GMT%2B8",
origin: "URL [file:/home/test/deploy/config/application-pressure.yml]:4:10"
},
spring.datasource.username: {
value: "root",
origin: "URL [file:/home/test/deploy/config/application-pressure.yml]:5:15"
},
spring.datasource.password: {
value: "******",
origin: "URL [file:/home/test/deploy/config/application-pressure.yml]:6:15"
},

页面返回内容 spring.datasource.password 的值为 *******

下载 heapdump 文件, 然后使用工具
root@wy:~#
> java -jar heapdump_tool.jar heapdump.6
[-] Start jhat, waiting...
[-] fing object count: 100000
[-] too many object,please input 0/1 to choose mode.
0. (search data, may can't find some data, can't use function num=,len=).
1. (load all object, need wait a few minutes).
> 0
[-] please input keyword value to search, example: password,re=xxx,len=16,num=0-10,id=0x123a,class=org.xx,all=true,geturl,getfile,getip,shirokey,systemproperties,allproperties,hashtable 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,re=xxx,len=16,num=0-10,id=0x123a,class=org.xx,all=true,geturl,getfile,getip,shirokey,systemproperties,allproperties,hashtable 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,re=xxx,len=16,num=0-10,id=0x123a,class=org.xx,all=true,geturl,getfile,getip,shirokey,systemproperties,allproperties,hashtable input q/quit to quit.
> shirokey
>> kPH+bIxk5D2deZiIxcaaaA==
[-] please input keyword value to search, example: password,re=xxx,len=16,num=0-10,id=0x123a,class=org.xx,all=true,geturl,getfile,getip,shirokey,systemproperties,allproperties,hashtable input q/quit to quit.
> class="shiro".web.mgt
- > org.apache.shiro.web.mgt.CookieRememberMeManager
- - - -> org.apache.shiro.crypto.AesCipherService
- - - - - - - -> algorithmName -> AES
- - - - - - - -> blockSize -> 0
- - - - - - - -> generateInitializationVectors -> true
- - - - - - - -> initializationVectorSize -> 128
- - - - - - - -> keySize -> 128
- - - - - - - -> modeName -> CBC
- - - - - - - -> paddingSchemeName -> PKCS5Padding
- - - - - - - -> secureRandom -> <null>
- - - - - - - -> streamingBlockSize -> 8
- - - - - - - -> streamingBufferSize -> 512
- - - - - - - -> streamingModeName -> CBC
- - - - - - - -> streamingPaddingSchemeName -> PKCS5Padding
- - - - - - - -> streamingTransformationString -> <null>
- - - - - - - -> transformationString -> <null>
- - - -> cipherService ->
- - - -> org.apache.shiro.web.servlet.SimpleCookie
- - - - - - - -> comment -> <null>
- - - - - - - -> domain -> <null>
- - - - - - - -> httpOnly -> true
- - - - - - - -> maxAge -> 31536000
- - - - - - - -> name -> rememberMe
- - - - - - - -> path -> <null>
- - - - - - - -> secure -> false
- - - - - - - -> value -> <null>
- - - - - - - -> version -> -1
- - - -> cookie ->
- - - -> decryptionCipherKey -> xxxx
- - - -> encryptionCipherKey -> xxxx
- - - -> org.apache.shiro.io.DefaultSerializer
- - - -> serializer ->
[-] please input keyword value to search, example: password,re=xxx,len=16,num=0-10,id=0x123a,class=org.xx,all=true,geturl,getfile,getip,shirokey input q/quit to quit.
> q
[-] exit.

 

 

C:\Program Files\Java\jdk1.8.0_341\bin>java -jar D:\shell\net\heapdump_tool.jar D:\shell\net\web02\heapdump

 

链接:https://pan.baidu.com/s/1ViJtkAVHUvdQdQYRvjtQpQ?pwd=o19r
提取码:o19r

标签:spring,tool,value,heapdump,input,password,class
From: https://www.cnblogs.com/websec80/p/17355242.html

相关文章

  • SpringSecurity从入门到精通:从数据库查询权限信息&自定义失败处理
    从数据库查询权限信息      记得打开redis      自定义失败处理我们还希望在认证失败或者是授权失败的情况下也能和我们的接口一样返回相同结构的json,这样可以让前端能对响应进行统一的处理。要实现这个功能我们需要知道SpringSecurity......
  • springcloud OpenFeign的使用
    在这里只记录OpenFeign关键的使用步骤,A、B两个项目是基于springboot、springcloud实现的,并且在nacos中有服务注册。第一步:导入依赖<dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-starter-openfeign</a......
  • SpringBoot2 hikari关于 Failed to validate connection com.mysql.cj.jdbc.Connectio
    项目启动不报错,如果静默15分钟没有数据库操作就报上述错误WARN不影响程序运行Failedtovalidateconnectioncom.mysql.cj.jdbc.ConnectionImpl@16244d67(Nooperationsallowedafterconnectionclosed.).PossiblyconsiderusingashortermaxLifetimevalue.发现Spri......
  • Spring
     第1步:启动一个新的Spring引导项目用start.spring.io以创建“网络”项目。在“依赖项”对话框中,搜索并添加“Web”依赖项,如屏幕截图所示。点击“生成”按钮,下载zip,然后将其解压缩到计算机上的文件夹中。  创建者start.spring.io包含弹簧启动,一个框架,使Spring准备好......
  • 自定义实现SpringBoot Starter
    在日常的开发中,会将开发的公共jar包发布的仓库,这样可以实现代码的复用。这里介绍的是自定义SpringBootStarter的方式,对于采用SpringBoot开发的项目来说,引入和使用非常的方便。1、SpringBootStarter介绍SpringBoot和Spring相比,在配置上简化了很多,核心就是因为Starter引入了一些......
  • 3.springbean的作用域
    https://baijiahao.baidu.com/s?id=1610298792072480906&wfr=spider&for=pc一共是5种作用域,低版本的是下面两种作用域的种类Spring容器在初始化一个Bean的实例时,同时会指定该实例的作用域。Spring3为Bean定义了五种作用域,具体如下。1)singleton单例模式,使用singleton定......
  • Spring注入接口,接口多个实现类调用哪个实现类的三种方案
    https://blog.csdn.net/JingXu1114/article/details/124747047代码所示:···@AutowiredUserServiceuserService···在这个接口有多个实现类的情况下三种方式定义调用实现类:方法1:···`@Autowired UserServiceuserServiceImpl_1`···在变量名中直接写成想要调用......
  • SpringBoot的自动装配原理
    前言因为最近在准备知识框架的学习,对springboot的自动装配原理学习了一番,也看了一些视频和一些博客,根据自己的理解在此记录一下,有什么理解得不对的,可以指出一起讨论。本文主要根据以下的几个点对自动装配原理进行介绍:什么是springboot的自动装配springboot的自......
  • Spring Boot 项目代码混淆,实战来了,再也不用担心代码泄露了!
    编译简单就是把代码跑一哈,然后我们的代码.java文件就被编译成了.class文件反编译就是针对编译生成的jar/war包里面的.class文件逆向还原回来,可以看到你的代码写的啥。比较常用的反编译工具JD-GUI,直接把编译好的jar丢进去,大部分都能反编译看到源码:那如果不想给......
  • SMU Spring 2023 Trial Contest Round 10
    SMUSpring2023TrialContestRound10 A-RemoveDuplicates#include<bits/stdc++.h>usingnamespacestd;typedefpair<int,int>PII;typedefpair<string,int>PSI;constintN=2e2+5,INF=0x3f3f3f3f,Mod=1e6;constdoubleeps=1e-6;typedef......