EncryptCodecencryptcodec
Simulations/Prototype Pollution

Prototype Pollution

Intermediate

JavaScript's prototype chain can be weaponized. Pollute the prototype to escalate privileges, bypass auth checks, and then learn the defenses.

Progress:
1
Pollute the Prototype
2
Exploit the Bypass
3
Fix the Vulnerability
merge-service.js
// Vulnerable merge function function merge(target, source) { return Object.assign(target, source); } // User input merged into config const config = {}; merge(config, userInput);
Prototype Chain State
Object.prototype.isAdmin = undefined
({}).isAdmin → undefined
Auth check simulation
const user = {}; // fresh object if (user.isAdmin) { grantAccess(); // would fail }

Challenges

1
Pollute the Prototype
Craft a JSON input with __proto__ to make all objects have isAdmin = true.
hints
2
Exploit the Bypass
Use the polluted prototype to bypass the admin check and access the admin panel.
hints
3
Fix the Vulnerability
Select the correct defenses against prototype pollution.
hints
How to fix prototype pollution
Multiple layers of defense against prototype chain attacks

Frequently Asked Questions