method-clobbering
Skill2 starsChanged 2 months agoMITView on GitHub
Detect method clobbering via user-controlled object keys that overwrite built-in methods like toString, valueOf, or hasOwnProperty, causing crashes or logic bypass.
In this repository255 other files it gives its agents.
- ad-acl-abuseSkill
- ad-adcs-access-and-relaySkill
- ad-adcs-persistenceSkill
- ad-adcs-template-abuseSkill
- ad-ad-discoverySkill
- ad-ad-persistenceSkill
- ad-auth-coercion-relaySkill
- ad-credential-dumpingSkill
- ad-gpo-abuseSkill
- ad-kerberos-delegationSkill
- ad-kerberos-roastingSkill
- ad-kerberos-ticket-forgingSkill
- ad-pass-the-hashSkill
- ad-sccm-exploitationSkill
- ad-trust-attacksSkill
- hunt-ntlm-infoSkill
- offensive-active-directorySkill
- hunt-llm-aiSkill
- hunt-rag-vectorSkill
- offensive-ai-securitySkill
- cloud-iam-deepSkill
- hunt-cloud-misconfigSkill
- hunt-k8sSkill
- m365-entra-attackSkill
- network-container-escapesSkill
- offensive-cloudSkill
- offensive-container-escapeSkill
- offensive-k8s-attacksSkill
- okta-attackSkill
- vmware-vcenter-attackSkill
- credential-password-sprayingSkill
- hunt-brute-forceSkill
- hunt-forgot-passwordSkill
- post-exploit-credential-recoverySkill
- meme-coin-auditSkill
- offensive-crypto-attacksSkill
- web3-auditSkill
- ctfSkill
- advisory-miningSkill
- auth-bypassSkill
- code-injection-codegenSkill
- command-injectionSkill
- cross-pollinationSkill
- cve-hunting-methodologySkill
- decompression-bombSkill
- entity-expansionSkill
- fp-checkSkill
- path-traversalSkill
- prototype-pollutionSkill
- recursion-dosSkill
- redosSkill
- sandbox-escapeSkill
- target-reconSkill
- web2-vuln-classesSkill
- evasion-av-edr-evasionSkill
- offensive-anti-forensicsSkill
- offensive-edr-evasionSkill
- offensive-keylogger-archSkill
- offensive-mitigationsSkill
- offensive-waf-bypassSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
2 rules. About 0 are common, 1 is distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 21
When a parser creates a plain object {} from user input, the attacker can set keys like toString, valueOf, hasOwnProperty to non-function …
- Distinctive: line 86
No demonstrated crash/bypass: likely rejected
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Method Clobbering Detection
When to Use
Audit CSV/form/query string parsers that create plain objects from untrusted input where the attacker can control property names (keys), not just values.
Key Insight
When a parser creates a plain object {} from user input, the attacker can set keys like toString, valueOf, hasOwnProperty to non-function values. Any code that later calls these methods on the object will throw a TypeError.
Important: JSON.parse can do the same thing. You MUST show why the library-specific clobbering is worse than what JSON.parse enables. Show a REAL crash path, not just theoretical property overwrite.
Dangerous Keys
| Key | Normal Type | Effect When Clobbered |
toString | Function | obj + "" throws TypeError |
valueOf | Function | obj == x or coercion throws TypeError |
hasOwnProperty | Function | obj.hasOwnProperty(k) throws TypeError |
constructor | Function | Type checks fail |
__proto__ | Object | Prototype pollution (see prototype-pollution skill) |
__defineGetter__ | Function | Legacy getter/setter manipulation |
__defineSetter__ | Function | Legacy getter/setter manipulation |
__lookupGetter__ | Function | Legacy getter/setter introspection |
toJSON | undefined | JSON.stringify(obj) throws TypeError |
then | undefined | await obj or Promise.resolve(obj) treats obj as thenable |
Process
Step 1: Find Parsers That Create Objects
grep -rn "\[key\]\s*=" . --include="*.js" --include="*.ts"
grep -rn "\[header\]\|\[field\]\|\[name\]\|\[prop\]" .
grep -rn "result\[\|output\[\|obj\[\|data\[\|parsed\[" .Step 2: Check If Keys Are User-Controlled
Common sources of attacker-controlled keys:
- CSV column headers (first row)
- HTTP form field names
- Query string parameter names
- Configuration file keys
- JSON object keys (but JSON.parse already handles this)
Step 3: Check for Key Filtering
grep -rn "Object\.create(null)" . # Null prototype = safe
grep -rn "hasOwnProperty\|toString\|valueOf" . | grep -i "filter\|block\|skip"
grep -rn "Object\.keys\|Map\|new Map" .Step 4: Demonstrate Real Impact
You MUST show one of:
- TypeError crash: Code calls
obj.toString()orobj.hasOwnProperty()on the parsed result - Logic bypass: Code checks
obj.hasOwnProperty(x)for security decisions - Thenable confusion: Code uses
awaitor Promise.resolve() on the parsed object
# Find code that calls methods on parsed objects
grep -rn "\.toString()\|\.valueOf()\|\.hasOwnProperty(" .
grep -rn "JSON\.stringify(" . # Uses toJSON
grep -rn "await\|Promise\.resolve" . # Uses thenCVSS Guidance
- TypeError crash causing DoS (unauthenticated): HIGH 7.5
- Logic bypass via hasOwnProperty clobbering: HIGH 7.5
- Thenable confusion: MEDIUM 5.3-6.5
- No demonstrated crash/bypass: likely rejected
Self-Check Before Reporting
- Can JSON.parse achieve the same clobbering? If yes, why is this worse?
- Does code actually call methods on the parsed object?
- Is the crash catchable (try/catch around it)?
- Is the parser documented as expecting trusted input?
References
- Sinks -- Parser patterns creating objects from untrusted keys
- False Positive Indicators
- PoC Skeleton
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

