Prototype Pollution in yayson Store and LegacyStore
The yayson library (<= 4.2.0) is vulnerable to prototype pollution when deserializing malicious JSON:API documents, allowing unauthenticated attackers to corrupt the global Object.prototype and potentially achieve RCE via gadget chains.
The yayson library for Node.js contains a critical prototype pollution vulnerability in its Store and LegacyStore components, tracked as CVE-2026-61534. The library uses incoming JSON:API document fields, specifically type and relationship names, as keys for internal lookup tables without proper sanitization. Because these tables are initialized as plain JavaScript objects, an attacker can supply a document where the type field is set to __proto__.
This operation writes directly onto the Object.prototype, affecting every object within the Node.js process lifetime. The vulnerability is highly impactful as it enables logic corruption or denial of service by design. Furthermore, if the host application contains suitable gadget chains, this pollution can be escalated to arbitrary code execution or authorization bypass. The vulnerability persists even when using included resources or custom type mappings, making it difficult to mitigate through standard input validation if the application relies on deeply nested data structures.
Attack Chain
- Attacker crafts a malicious JSON:API document containing a
dataobject withtypeset to__proto__. - The target application receives the document via a network request and passes it to the
yaysonStore.sync()orLegacyStoredeserialization method. yaysonparses the JSON:API object and processes thetypestring as a property key for the internalmodelslookup table.- The library performs an assignment operation:
models["__proto__"][id] = model, which effectively injects properties into the globalObject.prototypebecause__proto__references the prototype of themodelsobject. - The attacker includes malicious payloads within the
attributesoridfields of the JSON:API document, which are then persisted globally across the process. - The application performs subsequent object operations that trigger the injected malicious properties, leading to code logic alterations or unauthorized state changes.
- The attacker leverages existing gadget chains in the application environment to execute arbitrary code or bypass security controls based on the polluted prototype properties.
Impact
The vulnerability allows an unauthenticated attacker to permanently alter the behavior of the Node.js application process. Successful exploitation leads to process-wide logic corruption and denial of service. Depending on the downstream application code, the impact can extend to authorization bypass or full remote code execution. This affects all users of yayson versions 3.x and 4.x up to and including 4.2.0.
Recommendation
Prioritized actions for engineering teams:
- Update the
yaysonlibrary to version 4.3.0 or later to include null-prototype lookup table implementations. - Implement a temporary mitigation by rejecting incoming JSON documents where
typeor relationship names are set to__proto__,constructor, orprototype. - Execute Node.js processes with the
--disable-proto=throwflag to prevent prototype access if the environment permits. - Audit applications using
yaysonto identify usage of deep object merging or deserialization of untrusted user-supplied JSON:API payloads.
Immediate actions
Upgrade yayson dependency to 4.3.0
Mitigations
Enable Node.js flag --disable-proto=throw
CVE-2026-61534