Parsed credential data used a caller-controlled language label as an object key. Set that label to __proto__ with an object value and you change the prototype of the record you hand downstream.
What goes wrong
The routine walks a list of localized values and builds a lookup keyed by each item's language field. The language string comes straight from the parsed input, and it is used as a property name with no checking. That is the whole bug.
Set the language to __proto__, give the item an object value, and the assignment does not create a normal entry. It walks into the special prototype setter and reparents the lookup object. Every property read on that object afterward can resolve through the attacker's injected prototype, so downstream code that trusts the returned credential reads values the attacker planted.
When a key comes from outside, it is data, not a field name. Build the map with a null prototype, or reject the reserved names before you assign.
The pattern
function buildLangMap(items) {
const map = {};
for (const item of items) {
map[item.language] = item.value; // language is attacker data
}
return map;
}function buildLangMap(items) {
const map = Object.create(null); // no prototype to poison
for (const item of items) {
if (typeof item.language !== "string") continue;
if (item.language === "__proto__") continue;
map[item.language] = item.value;
}
return map;
}Every gate held. The exploit path was reproduced against a negative control, the impact was calibrated, and the finding was signed report-ready.
Why it matters to you
This object gets returned and trusted by whatever consumes the credential. If any later check reads a property the injected prototype now supplies, the attacker has seeded a value into a place that skipped validation. Prototype pollution rarely crashes anything, which is why it survives long enough to do damage.
Check your own code
- Look for object keys assigned from parsed or user-supplied strings.
- Use Object.create(null) or a Map for any lookup built from untrusted keys.
- Block __proto__, constructor, and prototype as key names at the assignment site.