Skip to content
Prototype pollution Write-up Advanced

Prototype Confusion: abusing prototypes when prototype pollution

The report describes how prototype pollution can be used to create fake objects that bypass instanceof checks and validation, even when deep merge is not available. An attacker could craft serialized data to make a malicious object appear as a legitimate URL or string, potentially leading to SSRF or XSS.

Andrey Pyatko Follow

Published on medium.com

Prototype pollution is well known attack which leads to high severity vulnerabilities. To exploit it you need not just override prototype related properties, but also override prototype fields on deeper level, which usually requires something like vulnerable deep merge function.

Andrey Pyatko, on medium.com

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 relies on instanceof checks and prototype-based validation without verifying the actual type or sanitising the __proto__ key during deserialization.

Impact

An attacker could bypass validation to perform SSRF or XSS, depending on how the fake object is used.

What the attacker needed

Attacker controls serialized input; application uses vulnerable serializer

The fix

Sanitise the __proto__ key during deserialization and avoid relying solely on instanceof for type validation.

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.

JavaScript objects inherit properties from a prototype. If an attacker can set an object's prototype to a built-in type like URL, the object may pass checks like 'instanceof URL' even though it is not a real URL. This can trick code into using attacker-controlled values.

What is Prototype pollution?

Input changes JavaScript's shared object prototype, altering behaviour across the application, sometimes to XSS or code execution.

Similar reports

View all

Same bug class and techniques, clearest first.

Prototype pollution

The lesson behind this report.

Input changes JavaScript's shared object prototype, altering behaviour across the application, sometimes to XSS or code execution.