Join our Newsletter — 33% off our NHI Course
Home› Glossary› Cyber Security› Object Prototype Pollution
Cyber Security

Object Prototype Pollution

← Back to Glossary
By NHI Mgmt Group Updated November 25, 2026 Domain: Cyber Security

Object prototype pollution is a JavaScript vulnerability where an attacker modifies an object's prototype, causing inherited properties to change for other objects. It usually happens through unsafe property assignment, object merging, or parsing attacker-controlled keys, and can alter application behaviour, access checks, or data handling.

What Object Prototype Pollution Does

Object prototype pollution is dangerous because one unsafe write can affect many objects that inherit from the modified prototype. In JavaScript applications, that can change default behaviour in surprising places, including authorization logic, feature flags, request handling, and sanitisation paths. The issue is especially relevant when code accepts attacker-controlled keys or merges nested objects without strict checks.

Common Ways It Happens

The vulnerable pattern is usually not the prototype itself, but the data flow into it. Deep merge helpers, permissive parsers, unsafe cloning routines, and ad hoc property assignment can all turn special keys into prototype writes. In both browser and Node.js code, keys such as __proto__, constructor, and prototype are especially sensitive when application code treats them like ordinary data.

Developers are often caught out because the immediate object looks harmless while the inherited behaviour changes elsewhere. That means the bug can survive basic testing, then surface only when a later code path reads a polluted property and trusts it as if it were application data.

Why Prototype Pollution Is Hard To Spot

Prototype pollution is subtle because the impact is indirect. A polluted property may not appear in the exact object being inspected, and the failure may depend on when another object is created or when a library reads an inherited value. That makes it difficult to trace the root cause from the visible symptom alone.

It is also a composition problem. A library, framework, or utility that is safe on its own can become risky when combined with permissive object handling elsewhere in the stack. For that reason, reviews need to look for object-merging behaviour, parser behaviour, and any code path that accepts structured attacker input and turns it into plain JavaScript objects.

See the Prototype Pollution Guide for a deeper explanation of how this class behaves in browsers and Node.js, and how to detect it.

Security Consequences And Exposure Points

When prototype pollution succeeds, the fallout can range from logic corruption to access-control bypass. Polluted inherited values can influence object defaults, request processing, role checks, template data, and other branches that assume a property came from the local object rather than the prototype chain. That can create integrity failures even when no code execution is involved.

In practice, the most exposed areas are any features that merge user-controlled data, hydrate objects from JSON or query parameters, or rely on shared utility code across many request paths. In Node.js applications, the same weakness can affect server-side logic repeatedly because polluted prototypes are process-wide in effect for ordinary object lookups.

For JavaScript and Node.js development teams, this is why secure coding guidance for object construction, property access, and merge behaviour matters. The Node.js Security Guide and the TypeScript and JavaScript Secure Coding Guide both cover the coding patterns that usually make this vulnerability possible.

How Defenders Prevent And Contain It

Defence starts with avoiding arbitrary property assignment into plain objects. Safer object design, strict schema validation, defensive key filtering, and use of null-prototype objects can reduce the attack surface materially. Where a merge or parsing helper is unavoidable, it should explicitly reject prototype-bearing keys and be tested against prototype pollution cases, not just ordinary malformed input.

Containment also matters. Even when a polluted property is introduced, limiting the blast radius with careful runtime boundaries, safer libraries, and narrow object semantics can stop the issue from becoming a broad application-wide integrity problem. The most effective fixes are usually architectural, because once polluted data reaches a shared object path, many later behaviours may inherit it.

The Secure Coding Guide is useful here because prototype pollution is ultimately a secure coding failure, not just a JavaScript quirk.

Standards & Framework Alignment

This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.

OWASP ASVS, NIST SP 800-53 Rev 5 and CIS Controls v8 set the governance and control requirements practitioners need to meet.

FrameworkControl / ReferenceRelevance
OWASP ASVSV15 — Secure Coding and ArchitecturePrototype pollution is a secure coding flaw in object handling and data flow.
Recommendation — Review object construction and merge logic for prototype-bearing keys during secure code review.
NIST SP 800-53 Rev 5SI-10 — Information Input ValidationThe issue is driven by unsafe handling of attacker-controlled input and keys.
CM-7 — Least FunctionalityReducing dangerous runtime features and object mutation paths lowers exploitation opportunity.
Recommendation — Validate structured input so attacker-controlled property names cannot alter object prototypes. Restrict unnecessary parsing and mutation paths that can write to shared object prototypes.
CIS Controls v8CIS-16 — Application Software SecurityPrototype pollution is a common application security weakness in JavaScript code.
CIS-6 — Access Control ManagementPolluted object properties can corrupt authorization decisions and access checks.
Recommendation — Test JavaScript application code and libraries for unsafe merges, parsing, and prototype writes. Verify that authorization decisions do not depend on mutable inherited object properties.

Free weekly newsletter

Subscribe to the NHI & AI Identity Journal

The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.

Bonus 33% off our NHI Course when you subscribe.

NHIMG Editorial Note
Reviewed and updated by the NHIMG editorial team on November 25, 2026.
NHI Mgmt Group — the #1 independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org