prototype-pollution
できること
このスキルは、細工されたキーによってすべてのオブジェクトが継承する基底オブジェクトが変わってしまう、JavaScriptとNode.jsの欠陥であるプロトタイプ汚染を説明します。検査を許可されたコードを確認する開発者とレビュー担当者向けです。
使う場面
- ✓Node.jsのアプリが、信頼できないJSONやクエリのデータをオブジェクトにマージしていないかを、開発者が確認するよう依頼するとき。
- ✓プロジェクトが、既知の危険なバージョンを持つマージやクローンのライブラリを使っていないかを確認するとき。
- ✓発見が、単に変更されたオブジェクトではなく、実際の影響を示すかを確認する必要があるとき。
スキルのリンク
https://github.com/BitterSecurity/Decepticon/blob/main/packages/decepticon/decepticon/skills/standard/analyst/prototype-pollution/SKILL.mdコピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。
使い方
いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。
貼り付け用メッセージ
Claude Code、Codex、Cursorの場合:プロジェクトのフォルダで実行するとスキルがインストールされます。
SKILL.mdをダウンロードして、エージェントのスキル用フォルダに入れてください。
AIへの頼み方の例
“当社のNode.jsアプリで、ユーザーのJSONがすべての他のオブジェクトが使う基底オブジェクトを変えられないかを確認してもらえますか。”
毎週5つの新しいスキル。1分で読めます。
仕組み
エージェントは、深いマージやクローンの呼び出しを探し、信頼できない入力をそこまでたどります。依存関係のバージョンを、既知の危険なものと照らし合わせます。
技術的な内容(元のSKILL.md)
作者による元のテキスト(英語)をGitHubからそのまま表示しています。
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.
よくある質問
プロトタイプ汚染とは何ですか?
細工されたキーによって基底オブジェクトにプロパティが追加され、その変更が多くの他のオブジェクトに現れることです。
どの入力が危険ですか?
JSONの本文、クエリ文字列、YAMLのアップロード、フォームのデータが、よくある入力源として挙げられています。
どのライブラリに触れていますか?
いくつかの深いマージとクローンのライブラリを挙げており、エージェントはインストールされたバージョンを確認すべきだと述べています。
詳細
作者による元の説明
Hunt JavaScript prototype pollution (CWE-1321) — the 2023-2026 meta-vulnerability that chains into RCE, auth bypass, and SSRF on most Node.js stacks.
人気
- GitHubのスター
- 6.5k
- ランキング
- #13967
- ライセンス
- Apache-2.0
- 更新日
- 2026/11/1
コメント
- …
このリポジトリの他のスキル
detector-overview
6.5kエージェントが、スキャナーが指摘したコードを読み、本物のセキュリティバグと誤検知を見分けられるよう支援します。
exploiter-overview
6.5kエージェントが、確認済みの複数のセキュリティ上の弱点を一つのテストの連鎖にまとめ、その影響がどこまで及ぶかを確認できるよう支援します。
llm-redteam-overview
6.5kエージェントが、プロンプトインジェクションからモデルの悪用まで、15の戦術グループの中から適切なAIレッドチーム用ガイドを見つけられるよう支援します。
aatmf-t01-prompt-injection
6.5kプロンプトインジェクションを説明します。隠された指示でAIシステムを乗っ取ろうとする手口を、セキュリティテスターが確認できるようにします。
似ているスキル
reverse-engineer-anything
422kREAツールを使って、出荷済みのアプリやパッケージの中身を調べ、機能の説明、版の比較、再構築の手順をエージェントが支援します。
1password
394k1Password CLIをセットアップし、サインインして、秘密情報の値を会話に表示せずに読み取ったり注入したりするようエージェントを支援します。
healthcheck
394kOpenClawを動かすコンピューターやサーバーを、SSH、ファイアウォール、更新、バックアップなどのセキュリティリスクについて監査し、安全な修正案を提案するようエージェントを支援します。