agentleFS
awarexoneawarexone/AXguard/prototype-pollution/SKILL.md

prototype-pollution

Skill18 starsChanged 3 months agoMITView on GitHub

Analyze JavaScript prototype pollution risks — use when reviewing deep merges, recursive object assigns, query-to-object parsers, or untrusted JSON key merges (CWE-1321 / A03:2021).

7 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use csrf and ssrf.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • blacklanternsecuritySkill

    csrf

    Exploit Cross-Site Request Forgery (CSRF) vulnerabilities during authorized penetration testing.

    Also in 3 projects that use this

  • blacklanternsecuritySkill

    ssrf

    Guide server-side request forgery (SSRF) exploitation during authorized penetration testing.

    Also in 3 projects that use this

The file

We split this skill into the rules it gives an agent

7 rules. 0 are common, 1 is distinctive, and 6 are very specific to this project.

  • 0

    Common

    Most of the 7 edited versions we read keep these.

  • 1

    Distinctive

    This author's own choices. Worth a look.

  • 6

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    No JavaScript/TypeScript object merge of untrusted structures (Python/Java dict updates are different classes).

    line 46
  2. Very specific:

    Check for blocking of __proto__, constructor, prototype at every nesting level.

    line 65
  3. Very specific:

    Prefer safe structures: Object.create(null), Map, schema validation (reject unknown keys).

    line 66
  4. Very specific:

    Search for gadgets: property checks without hasOwn, HTML sinks reading options, template/compile flags.

    line 67
  5. Very specific:

    Use of Map / null-prototype objects only

    line 82
  6. Very specific:

    Use Map or Object.create(null) for dictionaries.

    line 89
  7. Very specific:

    Prefer Object.hasOwn / hasOwnProperty.call for security checks.

    line 90

“Common” is measured: kept by at least 6 in 10 of the 7 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Prototype Pollution Analysis

Purpose

Teach defensive reasoning about prototype pollution: attacker-controlled property keys (__proto__, constructor, prototype) modify Object.prototype (or other prototypes) via unsafe merge/clone/path assignment, affecting unrelated code paths (gadgets).

When to Use / When Not to Use

Use when:

  • Node/browser code deep-merges user JSON, parses nested query objects, uses vulnerable lodash.merge-class APIs, recursive for..in assigns, or settings import endpoints.
  • Client-side URL/hash parsers feed object merges (DOM XSS gadget hunts).
  • AuthZ checks rely on property presence/truthiness that could be inherited.

Do not use when:

  • No JavaScript/TypeScript object merge of untrusted structures (Python/Java dict updates are different classes).
  • Data is stored only in Map / Object.create(null) with no prototype-affecting assignment.

Security Concepts

Pollution is usually a two-stage issue: (1) pollution sink succeeds; (2) a gadget reads the polluted property (XSS sink, isAdmin, template options, env). Severity depends on gadgets, not on pollution alone.

Threat Model

Attacker goals:

  1. Flip security flags (isAdmin, authenticated).
  2. Unlock DOM XSS via client gadgets.
  3. DoS (override built-ins) or server RCE via known Node gadgets.

Analysis Workflow

  1. Find recursive merge/clone/assign utilities and query parsers that build nested objects.
  2. Confirm untrusted keys flow into those sinks without key filtering.
  3. Check for blocking of __proto__, constructor, prototype at every nesting level.
  4. Prefer safe structures: Object.create(null), Map, schema validation (reject unknown keys).
  5. Search for gadgets: property checks without hasOwn, HTML sinks reading options, template/compile flags.
  6. Separate client vs server impact; do not claim RCE without a concrete gadget path.
  7. Review dependency versions known for merge CVEs.

Evidence Requirements

  • Merge/assign sink file:line
  • Untrusted key path
  • Missing dangerous-key rejection
  • At least a plausible gadget or explicit “pollution without known gadget” downgrade

False Positive Controls

  • Schema validators that strip unknown keys
  • Explicit rejection of dangerous keys before assign
  • Use of Map / null-prototype objects only
  • Merges of trusted server config only

Remediation

  1. Reject __proto__, constructor, prototype keys recursively.
  2. Validate with strict schemas; avoid recursive merge of untrusted objects.
  3. Use Map or Object.create(null) for dictionaries.
  4. Prefer Object.hasOwn / hasOwnProperty.call for security checks.
  5. Patch vulnerable merge dependencies; consider Object.freeze(Object.prototype) only after compatibility testing.

Verification

Find merge sinks → Add key deny + schema → Re-run review → Confirm no untrusted recursive assign

Related Skills

  • xss-analysis — common client gadget class
  • authorization-analysis — polluted auth flags
  • api-security, security-triage, security-remediation

Framework Mapping

  • CWE-1321
  • OWASP Top 10 2021 A03:2021 Injection

References

Research Provenance

Primary sources:

  • CWE-1321 (accessed 2026-09-15; verified title: Improperly Controlled Modification of Object Prototype Attributes)
  • OWASP Top 10:2021 A03 (accessed 2026-09-15)

Secondary / internal:

  • AXGuard injection/XSS rule adjacency; practitioner merge-sink review patterns
  • AwareXone Agentic-Bug-Hunter prototype-pollution methodology (concepts only; not copied)

Datasets:

  • UVID HF dataset — category linkage concepts only (MIT license metadata review 2026-09-15)

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.