kolorbee/lnu-secllm/deserialization-testing
Claude Code and agent skill by kolorbee/lnu-secllm
- community
Checking that the SKILL.md file is still in the repository.
Install
npx vskill@latest install kolorbee/lnu-secllm/deserialization-testingSKILL.md
反序列化漏洞测试
概述
反序列化漏洞是一种利用应用程序反序列化不可信数据导致的漏洞,可能导致远程代码执行、拒绝服务等。本技能提供反序列化漏洞的检测、利用和防护方法。
漏洞原理
应用程序将序列化的数据反序列化为对象时,如果数据来源不可信,攻击者可以构造恶意序列化数据,在反序列化过程中执行任意代码。
常见格式
Java
常见库:
- Java原生序列化
- Jackson
- Fastjson
- XStream
- Apache Commons Collections
PHP
常见函数:
- unserialize()
- json_decode()
Python
常见模块:
- pickle
- yaml
- json
.NET
常见类:
- BinaryFormatter
- SoapFormatter
- DataContractSerializer
测试方法
1. 识别序列化数据
Java序列化特征:
PHP序列化特征:
Python pickle特征:
2. 检测反序列化点
常见位置:
- Cookie值
- Session数据
- API参数
- 文件上传
- 缓存数据
- 消息队列
3. Java反序列化
Apache Commons Collections利用:
常见Gadget链:
- CommonsCollections1-7
- Spring1-2
- ROME
- Jdk7u21
4. PHP反序列化
基础测试:
魔术方法利用:
- __destruct()
- __wakeup()
- __toString()
- __call()
5. Python pickle
基础测试:
利用技术
Java RCE
使用ysoserial:
手动构造:
PHP RCE
利用POP链:
Python RCE
Pickle RCE:
绕过技术
编码绕过
Base64编码:
URL编码:
过滤器绕过
使用不同Gadget链:
- 如果CommonsCollections被过滤,尝试Spring
- 如果某个版本被过滤,尝试其他版本
类名混淆
使用反射:
工具使用
ysoserial
PHPGGC
Burp Suite
- 拦截包含序列化数据的请求
- 使用插件生成Payload
- 替换原始数据
- 观察响应
验证和报告
验证步骤
- 确认可以控制序列化数据
- 验证反序列化触发代码执行
- 评估影响(RCE、数据泄露等)
- 记录完整的POC
报告要点
- 漏洞位置和序列化数据格式
- 使用的Gadget链或利用方式
- 完整的利用步骤和PoC
- 修复建议(输入验证、使用安全序列化等)
防护措施
推荐方案
- 避免反序列化不可信数据
- 使用JSON替代
- 使用安全的序列化格式
- 输入验证
```java // 白名单验证类名 private static final Set<String> ALLOWED_CLASSES = Set.of("com.example.SafeClass");
private Object readObject(ObjectInputStream ois) { // 验证类名 // ... } ```
- 使用安全配置
``java // Jackson配置 objectMapper.enableDefaultTyping(); objectMapper.setVisibility(PropertyAccessor.FIELD, JsonAutoDetect.Visibility.ANY); ``
- 类加载器隔离
- 使用自定义ClassLoader
- 限制可加载的类
- 监控和日志
- 记录反序列化操作
- 监控异常行为
注意事项
- 仅在授权测试环境中进行
- 注意不同版本库的Gadget链差异
- 测试时注意Payload大小限制
- 了解目标应用的依赖库版本
Security
- Security scanPassed, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/deserialization-testing/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/kolorbee/lnu-secllm/deserialization-testing)