prototype-pollution
Skill này làm gì
Skill này mô tả prototype pollution, một lỗi trong JavaScript và Node.js khi một khóa được tạo đặc biệt thay đổi đối tượng nền mà mọi đối tượng kế thừa. 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 kiểm thử.
Khi nào nên dùng
- ✓Khi lập trình viên yêu cầu agent kiểm tra xem ứng dụng Node.js có gộp JSON hoặc dữ liệu chuỗi truy vấn không đáng tin vào đối tượng không.
- ✓Khi agent rà soát phụ thuộc của dự án để tìm thư viện merge hoặc clone có phiên bản rủi ro đã biết.
- ✓Khi một đội cần xác nhận một phát hiện cho thấy tác động thật, không chỉ là một đối tượng bị thay đổi.
Liên kết skill
https://github.com/BitterSecurity/Decepticon/blob/main/packages/decepticon/decepticon/skills/standard/analyst/prototype-pollution/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 ứng dụng Node.js của chúng tôi xem JSON của người dùng có thể thay đổi đối tượng nền mà mọi đối tượng khác dùng 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 lệnh gọi deep merge và clone, theo dõi đầu vào không đáng tin đi vào chúng, và đối chiếu phiên bản phụ thuộc với danh sách phiên bản rủi ro đã biết.
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.
Prototype Pollution Playbook
Prototype pollution is the JavaScript equivalent of a universal gadget:
plant a property on Object.prototype and it appears on every object in
the runtime. Worthless in isolation, deadly in chain (__proto__.isAdmin = true → auth bypass; __proto__.shell = "/bin/bash" → RCE via spawn).
1. Sinks — the libraries that still introduce sinks
Keep a running list per engagement. These continue to ship sinks in 2026:
- Deep-merge:
lodash.merge,deepmerge(pre-fix),merge-deep,deepExtend,hoek.merge,mixme - Deep-clone:
lodash.defaultsDeep,lodash.zipObjectDeep,set-value(pre-3.0.3) - URL-to-obj:
qs,express-fileupload,jquery.extend(true, ...) - Config loaders:
node-configrecursive merge,dotenv-extended,rc - Template engines: Handlebars helpers fed from untrusted ctx
# Every JS/TS project: sweep known-bad versions
jq '.dependencies,.devDependencies | to_entries[] | select(.key | test("merge|lodash|set-value|dot-object|dot-prop|node-pg"))' /workspace/src/package.json
npm ls lodash set-value dot-prop 2>/dev/null | grep -E '[0-9]'
2. Sources
Any user input deserialized into a nested object:
- JSON body parsers (
body-parser,express.json) - Query string parsers (
qswith default config parsesa[b][__proto__][c]=1) - YAML uploads
- Form-data / multipart
3. Audit workflow
- Find every deep merge call site.
- Trace each one backwards — is the right-hand object user-controlled?
- If yes: check the merge function's prototype-pollution fix version.
- Even if the merge is fixed, check whether a copy (lodash.set, dot-path-value, jsonpath.set) creates a pollution path.
4. Exploitation gadgets
Poisoning Object.prototype doesn't do anything by itself — you need
a gadget that reads a property that didn't exist before.
Classic gadgets:
child_process.spawn(cmd, args, opts)— opts has ashelloption. Poison__proto__.shell = "/bin/bash"then any subsequent spawn call executes through bash and interprets args as shell strings.- Express middleware — most middlewares check
options.someFlagwithif (opts.someFlag). Poisoning that flag flips security defaults. - Templating — Handlebars and EJS read
helpersandpartialsfrom the context object; pollution adds helpers that execute code. lodash.template— if the template source is built from_.template(tpl, ctx)you can inject via pollutedescape/evaluatekeys.mongoose— pollutingSchema.Typescauses subsequent schema definitions to use attacker-controlled types.
5. PoC template
# Classic lodash.merge RCE via child_process.spawn
curl -X POST https://target.com/api/settings \
-H 'Content-Type: application/json' \
-d '{"__proto__": {"shell": "/bin/bash", "env": {"PATH": "/tmp:/usr/bin"}}}'
# Second request triggers the gadget
curl https://target.com/api/render-pdf
# → any subsequent child_process.spawn call now runs through /bin/bash
6. Success signals for validate_finding
- Server error with stack trace referencing
Object.prototype - Output of injected command reflected in next response
- Admin-only endpoint now returns 200 after poisoning
__proto__.isAdmin
Negative control: same payload with proto (no leading underscores) —
should have no effect. If it does, the endpoint is treating that key
specially and the finding is unrelated.
7. Default CVSS
| Variant | Vector | Score |
|---|---|---|
| DoS (crash Node process) | AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H | 7.5 |
Auth bypass via isAdmin pollution |
AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:N | 9.1 |
| RCE via spawn gadget | AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H | 10.0 |
8. Chain promotion
Prototype pollution is almost always the first hop of a chain. After
validation, add an enables edge from the pollution vuln to:
- the spawn / template gadget vuln (RCE chain)
- the auth check vuln (privilege escalation chain)
- the SSRF vuln if the downstream request lib has an options pollution surface
Chain weight 0.4 — pollution is cheap once the merge sink is known.
Câu hỏi thường gặp
Prototype pollution là gì?
Đó là khi một khóa được tạo đặc biệt thêm thuộc tính vào đối tượng nền, nên thay đổi xuất hiện ở nhiều đối tượng khác.
Những đầu vào nào có rủi ro?
Skill liệt kê thân JSON, chuỗi truy vấn, tệp YAML tải lên và dữ liệu form là các nguồn phổ biến.
Skill đề cập đến thư viện nào?
Skill liệt kê một số thư viện deep merge và clone, và nói rằng agent nên kiểm tra phiên bản đã cài.
Chi tiết
Mô tả gốc của tác giả
Hunt JavaScript prototype pollution (CWE-1321) — the 2023-2026 meta-vulnerability that chains into RCE, auth bypass, and SSRF on most Node.js stacks.
Độ phổ biến
- Sao GitHub
- 6.5k
- Vị trí xếp hạng
- #13967
- 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.