Borrowing it
Nothing to install: this file belongs to zhaji2333/CkSKILLS. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.
curl -O https://raw.githubusercontent.com/zhaji2333/CkSKILLS/main/.agents/skills/deserialization-xxe/SKILL.mdgit clone --depth 1 https://github.com/zhaji2333/CkSKILLSWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/skills/zhaji2333/ckskills/deserialization-xxe)<a href="https://agentmods.dev/skills/zhaji2333/ckskills/deserialization-xxe"><img src="https://agentmods.dev/badge/skills/zhaji2333/ckskills/deserialization-xxe/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/skills/zhaji2333/ckskills/deserialization-xxe"><img src="https://agentmods.dev/badge/skills/zhaji2333/ckskills/deserialization-xxe.svg" alt="Reviewed on agentmods" width="80" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00078 | $0.01047 |
| Opus 5 | $0.00039 | $0.00524 |
| Sonnet 5 | $0.00016 | $0.00209 |
| Haiku 4.5 | $0.00008 | $0.00105 |
Grade C, and why
deserialization-xxe scanned grade C with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 10d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Cloud metadata endpointhighServer-side request forgery
One request to 169.254.169.254 can return temporary IAM credentials.
- SSRF:`SYSTEM "http://169.254.169.254/latest/meta-data/"` How it starts
The opening of the file, as written. The whole thing — 101 lines — stays where its author put it; the contents beside it link to each section on GitHub.
deserialization-xxe — 反序列化与解析器漏洞专项深度挖掘
何时调用(触发条件)
- XML 导入/上传、SOAP 接口、Office/Excel 解析
- 序列化数据入口(Java readObject、PHP unserialize、Python pickle、.NET BinaryFormatter)
- JSON 深合并/深拷贝(Node.js 原型污染)
- yaml.load 未指定安全 Loader
- 代码审计发现危险函数(见
source-code-audit)
一、漏洞类型全景
| 类型 | 语言/场景 | 修复 |
|---|---|---|
| H1. 反序列化 | Java/PHP/Python/.NET | 禁用危险反序列化、白名单 |
| H2. XXE | XML导入、SOAP、Office解析 | 禁用外部实体 |
| H3. 原型污染 | Node.js对象合并 | 过滤危险键 |
二、反序列化专项
各语言危险入口
Java: readObject / XMLDecoder / JNDI lookup / JdbcRowSetImpl / TemplatesImpl
PHP: unserialize / phar反序列化
Python: pickle.loads / yaml.load(Loader=Loader)
.NET: BinaryFormatter / XMLSerializer
利用工具
| 语言 | 工具 |
|---|---|
| Java | ysoserial / marshalsec(RMI/LDAP 起服务) |
| PHP | phpggc |
| Python | pickle 手工构造 |
利用链思路
- Java:Gadget 链(CommonsCollections、CommonsBeanutils 等)→ RMI/LDAP 打 JNDI
- PHP:POP 链(Laravel/ThinkPHP/Yii 框架 gadget)+ phar 协议触发
- Python:pickle 反序列化执行命令
- 入口识别:base64/hex 编码的序列化流、
rO0AB(Java)、a:{}(PHP)、O:8:(PHP对象)
三、XXE 专项
基础 Payload
<?xml version="1.0"?>
<!DOCTYPE foo [
<!ENTITY xxe SYSTEM "file:///etc/passwd">
]>
<foo>&xxe;</foo>
进阶利用
- 无回显:外部 DTD + 带外(OOB)读取文件
- SSRF:
SYSTEM "http://169.254.169.254/latest/meta-data/" - 文件读取:
file:///etc/passwd、php://filter/read=convert.base64-encode/resource=config.php - 协议:http/ftp/gopher
- Office 文档 XXE:docx/xlsx 内 XML 注入外部实体
触发场景
- XML/Excel/CSV 导入
- SOAP 接口
- 文档预览/转换
- SVG 上传(图片上传点也测 XXE)
四、原型污染专项(Node.js)
__proto__ / constructor.prototype / constructor.prototype.__proto__
触发场景
- JSON.parse 后深合并(lodash.merge、Object.assign 递归合并)
- 配置合并、查询参数合并
利用思路
- 污染
__proto__.isAdmin=true/__proto__.shell=... - 污染
__proto__.env(pug/ejs 模板引擎 RCE) - 污染
Object.prototype影响全局校验逻辑
五、验证要点
- 反序列化:先确认可控输入点与编码方式,再选 gadget 链验证 RCE
- XXE:先测回显(文件读取),无回显用 OOB DNSLog 验证
- 原型污染:控制台/接口验证
Object.prototype被污染 - 每个 payload 至少尝试到 Level 4 绕过(编码/变形/协议)
六、修复建议
- 禁用危险反序列化或使用白名单/黑名单过滤
- XML 解析禁用外部实体(XXE 防护)
- yaml 使用
SafeLoader - 深合并过滤
__proto__/constructor键 - 输入校验:拒绝序列化对象格式(按业务白名单)
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 10d ago First seen · 101 lines · 78 tokens per session scan C 01492f968dfa
deserialization-xxe is a skill published in the GitHub repository zhaji2333/CkSKILLS (80 stars, last pushed 9d ago), licensed MIT. It adds 78 tokens to every session and 1,047 once invoked, about $0.0004 per session on Opus 5. A static security scan graded it C with 1 finding (cloud metadata endpoint). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.
Other skills, from other repositories
new
Create a new project to start development quickly.
winui-setup
Install and verify the prerequisites the win-dev-skills WinUI 3 toolchain depends on — .NET SDK 8.0.100+, WinApp CLI 0.6+, and Developer Mode. Use only when the user explicitly asks to set up or repair the toolchain. Do not invoke automatically when another skill reports a missing prerequisite; tell the user what is…
winui-wpf-migration
Migrate WPF applications to WinUI 3 — namespace replacement (System.Windows → Microsoft.UI.Xaml), control mapping (DataGrid→ListView, WrapPanel→ItemsRepeater, TabControl→TabView), threading (Dispatcher→DispatcherQueue), imaging (System.Drawing→BitmapImage), MVVM conversion to CommunityToolkit.Mvvm, and…
xcode-compilation-analyzer
Analyze Swift and mixed-language compile hotspots using build timing summaries and Swift frontend diagnostics, then produce a recommend-first source-level optimization plan. Use when a developer reports slow compilation, type-checking warnings, expensive clean-build compile phases, long CompileSwiftSources tasks…
cli-builder
Build production-quality CLIs with language detection and a five-step approval-gated workflow. Use when wrapping an existing module or app. Don't use for GUI/TUI apps, web APIs, or one-off shell scripts.
rails-dev
Opinionated Rails conventions: rich models, concerns, CRUD-everything, state-as-records, minimal dependencies, Minitest with fixtures. Load this skill BEFORE any code-level thinking, not only before editing a file. It is required the moment a task touches Rails code in ANY way: designing or even just discussing a data…