Prototype Pollution
How It Works
// JavaScript objects inherit from Object.prototype
let obj = {};
console.log(obj.toString); // inherited from Object.prototype
// Pollution occurs when attacker controls property assignment
obj.__proto__.polluted = "yes";
// OR
obj["__proto__"]["polluted"] = "yes";
// OR
obj.constructor.prototype.polluted = "yes";
// Now ALL objects have this property
let newObj = {};
console.log(newObj.polluted); // "yes"Detection
Manual Testing
Automated Detection
Common Sinks (Client-Side)
Exploitation Payloads
DOM XSS via Prototype Pollution
Gadgets for Common Libraries
Server-Side Prototype Pollution (Node.js)
Bypass Techniques
Tools & Resources
Related Topics
Last updated
Was this helpful?