I reproduced a $10,000 bug
A Node.js application used a vulnerable version of the deep-extend library to merge user-supplied JSON, allowing an attacker to pollute the global object prototype with an isAdmin property. As a result, any user could be treated as an administrator without authentication.
medium.com
Published on medium.com
It all starts with a small, seemingly harmless Node.js application. Users can update their profiles via a POST request to /update-profile.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the application used an outdated version of the deep-extend library that does not block special keys like __proto__, allowing prototype pollution when merging user input.
Impact
Any user on the application, without authentication or privilege, could be treated as an admin, gaining full access and control.
What the attacker needed
Access to the /update-profile endpoint; no authentication required
The fix
The application should avoid vulnerable libraries like deep-extend@<=0.5.0, sanitize keys to block __proto__, constructor, and prototype, and use safer tools like lodash.merge.
How it was found
- Launch the Node.js API server.
- Send a POST request to /update-profile with a JSON body containing a __proto__ key that sets isAdmin to true.
- Send a GET request to /check-admin to verify that the user is now treated as an admin.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
In JavaScript, objects inherit properties from a shared 'prototype' object. If an attacker can add a property like isAdmin to that shared prototype, then every object in the program will appear to have that property, even if it was never set. This can trick the application into thinking a normal user is an admin.
What is Prototype pollution?
Input changes JavaScript's shared object prototype, altering behaviour across the application, sometimes to XSS or code execution.