Java安全-反序列化
Java安全-反序列化
Java 安全 - 反序列化 - 原生序列化类函数
序列化是将 Java 对象转换成字节流的过程。而反序列化是将字节流转换成 Java 对象的
过程,java 序列化的数据一般会以标记 (ac ed 00 05) 开头,base64 编码的特征为
rO0AB,JAVA 常见的序列化和反序列化的方法有 JAVA 原生序列化和 JSON 类
(fastjson、jackson)序列化等。
1、黑盒发现(流量捕获)
2、白盒发现(特征类接口函数)
1、原生序列化类函数:
-SnakeYaml:完整的 YAML1.1 规范 Processor,支持 Java 对象的序列化 / 反序列化
-XMLDecoder:xml 语言格式序列化类函数接口
-ObjectInputStream.readObject ():任何类如果想要序列化必须实现
java.io.Serializable 接口
2、利用项目:
- Yakit https://yaklang.com/
- https://github.com/frohoff/ysoserial
- https://github.com/NotSoSecure/SerializedPayloadGenerator
Java 安全 - SpringBoot 框架 - 泄漏 & CVE
SpringBoot Actuator 模块提供了生产级别的功能,比如健康检查,审计,指标收
集,HTTP 跟踪等,帮助我们监控和管理 Spring Boot 应用。
0、检测清单:
https://github.com/LandGrey/SpringBootVulExploit
1、黑盒发现(人工识别,BP 插件)
https://github.com/API-Security/APIKit
1、白盒发现(pom.xml, 引用库)
org.springframework.boot spring-boot-starter-actuator
Actuator 设置全部暴露
management.endpoints.web.exposure.include=*
/actuator/env 利用:该端点可以返回全部环境变量以及一些配置信息,其中就包含了数据库配置信息
heapdump
利用条件:
可正常 GET 请求目标 /heapdump 或 /actuator/heapdump 接口
利用方法:
1、(1)下载 heapdump
127.0.0.1:8088/actuator/heapdump 下载 heapdump 文件,泄露 JAVA 堆 dump 信息:
(2)heapdump 文件解密
https://github.com/wyzxxz/heapdump_tool
2、泄漏安全(配置密码,AK/SK 等)
https://github.com/whwlsfb/JDumpSpider
https://github.com/wyzxxz/heapdump_tool
3、漏洞安全(利用类,CVE 漏洞等)