Scoped Prototype Pollution in smob via Symbol-keyed __proto__
Symbol-keyed __proto__ payload defeats smob's safe-merge guards in the else-branch of baseMerger. SSPP via Object.assign with computed-property literal.
GHSA(awaiting publication)- CVE Record
- Fix PR
Background
smob is a small TypeScript utility on npm that exposes a merge and an assign helper for combining plain JavaScript objects. The package is marketed in its README as a safer alternative to ad-hoc merge implementations, and its source code includes explicit guards against the classic prototype-pollution sinks: keys named __proto__ and constructor.prototype are filtered out before any property is written to the target object. The package sees moderate usage as a transitive dependency in the wider TypeScript ecosystem, including frameworks built by its author for HTTP routing and authentication scaffolding.
Prototype pollution is the class of bug where attacker-controlled input causes properties to be written onto Object.prototype, or onto the prototype of a built-in constructor. Because every plain object in JavaScript inherits from Object.prototype, any property defined there becomes globally readable through ordinary property access. A pollution sink turns user-controlled JSON into ambient state mutation. Depending on what downstream code reads from inherited properties, this can flip security-relevant booleans (isAdmin), inject template fragments, or in the worst documented cases lead to remote code execution by chaining into options bags consumed by child_process or vm.
The interesting sub-class here is Scoped Server-side Prototype Pollution (SSPP). Unlike the unscoped variant, the corruption flows through a merge helper rather than a direct obj[key] = value assignment, so it relies on the merge function failing to walk the depth of attacker input safely. Predecessors in the same family include CVE-2022-24802 in deepmerge-ts and CVE-2024-38986 in @75lb/deep-merge. Both were patched by adding key-name screening before recursion. smob had that screening on paper, which is what made the bypass worth reporting.
The bypass
The relevant code path lives in baseMerger, the internal helper that the public merge and assign wrappers call into. For each key in the source object, baseMerger branches on whether the target already owns a value for that key:
- If both sides own the key and both values are plain objects, it recurses.
- If only the source side has the key, it falls back to a shallow copy via
Object.assign({}, { [key]: source[key] }).
The pollution screen runs in the recursive branch. Keys named __proto__ or constructor short-circuit there, so a straightforward {"__proto__": {"polluted": true}} payload against an empty target is supposed to be filtered. The else-branch did not run the same screen. It went directly into the Object.assign shallow-copy.
Object.assign itself is not the problem in isolation. When you call Object.assign({}, {__proto__: {polluted: true}}), the engine treats __proto__ as a regular own-string-property on the source literal (per ECMAScript) and copies it as such, which results in an object whose own __proto__ property is a benign data property. But the moment that intermediate object is consumed by the next merge step or written back into the original target via property assignment, the spec'd __proto__ setter on Object.prototype fires, and the right-hand value becomes the new prototype of the receiver.
The route taken in smob is more subtle than I initially understood. My first GHSA submission framed it as a Symbol-keyed bypass, on the theory that Object.getOwnPropertySymbols was the missing screen. After Peter Placzek inspected the actual flow, the corrected description in the GHSA notes that the literal __proto__ reaches the assignment via a computed-property expression where the key resolves to a string at evaluation time, and the unguarded else-branch shallow-copies it back into the chain reachable by subsequent property lookups. The Symbol angle was a red herring in the writeup, although the fix has to cover Symbol-keyed entries anyway because Object.getOwnPropertySymbols is a legitimate side channel for the same class of payload. I think it's worth being upfront about that misclassification: the bug is real, the impact is the same, but the precise mechanism in the original report was wrong, and the corrected description in the advisory supersedes it.
Reproducer
The PoC is short. Tested against smob@1.6.1 on Node 20.11.
const { merge } = require('smob');
const malicious = JSON.parse('{"__proto__": {"polluted": true}}');
merge({}, malicious);
console.log(({}).polluted); // true on smob <= 1.6.1
On a vulnerable build the script prints true, demonstrating that the freshly constructed {} literal inherits a property that no caller ever set on it. On smob@1.6.2 the same script prints undefined. The JSON.parse wrapper matters: it forces the __proto__ key into a real own-string-property of the source rather than the literal-syntax form that some V8 versions optimise away. This is the same construction used in the predecessor advisories, which is why I was reasonably confident the vector would translate when I first looked at the baseMerger source.
Versions checked:
node --version # v20.11.1
npm view smob versions --json | tail -5
# "1.5.4", "1.6.0", "1.6.1", "1.6.2"
I did not re-run against Node 18 or Node 22. The pollution semantics of __proto__ are part of the language spec rather than V8-specific, so I expect identical behaviour across maintained Node lines, but I have not verified that empirically.
Impact
The vulnerability is network-reachable in any service that calls smob.merge or smob.assign on user-controlled JSON. Three realistic shapes:
- A REST endpoint that merges a request body into a defaults object before passing the result downstream. Almost any "options + overrides" pattern qualifies. Once the prototype is polluted, every subsequent request handler in the same process inherits the injected properties until the runtime restarts.
- A query-parameter parser that produces a nested object via
qsor similar, then folds that object into application config viasmob. The pollution survives the entire request lifecycle and any cached references. - An options bag consumed by lower-level Node APIs. If polluted properties land in a place that
child_process.spawnorvm.runInContextreads, the SSPP class has documented escalations to RCE. I have not constructed such a chain forsmobspecifically; the impact ceiling here is the same as for the canonical SSPP vector.
The CVSS 3.1 vector is AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:H, score 8.1, High (my assessment at the time of the report; the advisory itself carries AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:L, 8.2 High). This matches what deepmerge-ts and @75lb/deep-merge received for the same vector class. Confidentiality is rated None because pollution does not directly disclose data, only mutates the runtime; Integrity is High because attacker-controlled values land in objects the application trusts; Availability is High because corrupted prototype properties cascade into auth checks, template logic, and ORM scope construction in ways that frequently take services down.
The exposure of smob itself is limited compared to lodash-class libraries: it is not in the top 1000 by weekly downloads, and most usage is transitive through TypeScript meta-frameworks authored by the same maintainer. Anyone using those frameworks who exposes merge-fed endpoints inherits the issue. The bus factor of the package is one, which is normal for utility libraries but worth flagging when reasoning about supply-chain blast radius.
The fix
Peter Placzek's PR #446 makes two changes to baseMerger:
- Symbol-aware screening in the else-branch. The new code iterates
Reflect.ownKeysrather thanObject.keys, and rejects any key whose string coercion equals__proto__or whose owner isconstructor.prototype. This closes both the original computed-property route and the Symbol-keyed variant that the initial report described. - The shallow-copy step is replaced with
Object.defineProperty(target, key, {value: source[key], writable: true, enumerable: true, configurable: true}). UsingdefinePropertywith explicit own-property semantics bypasses the__proto__setter entirely, because the setter is aObject.prototypeaccessor that only fires on regular assignment, not ondefinePropertywith a data descriptor. This is the same hardening pattern used in thedeepmerge-tsand@75lb/deep-mergefixes.
The result is that even if a future regression reintroduces a missed key-name check, the assignment primitive itself can no longer trigger prototype mutation. Defence in depth.
The patched version is smob@1.6.2, published the same day the bug was reported.
Timeline
- 2026-05-13: Bug discovered while pattern-matching against the SSPP advisory family. GHSA draft prepared.
- 2026-05-14 morning CEST: GHSA submitted to
tada5hi/smobvia the GitHub Security Advisories flow. Peter Placzek acknowledged the same day. - 2026-05-14 20:38 CEST: GitHub Staff issued
CVE-2026-46435against the GHSA. First CVE assigned to my GitHub identity. - 2026-05-14 20:22 CEST: Peter requested a fleshed-out description for the public advisory.
- 2026-05-14:
smob@1.6.2published with PR #446 merged. - 2026-05-15 ~00:00 CEST: Description draft sent to Peter via email, containing summary, technical details, PoC, impact, CVSS vector, patch reference, and workarounds.
- 2026-05-16: Description-correction (Symbol-keyed vs computed-property) reflected in advisory draft. Pilot writeup published. Awaiting maintainer publish click on GHSA.
Once Peter clicks Publish, the GHSA transitions to public and the CVE record flows into the CVE List and NVD.
Coordination notes
What worked: the GHSA channel was the right entry point. Peter was responsive within hours, the fix landed the same day, and CVE assignment happened automatically through GitHub's role as a CNA. No back-channel email negotiation was needed for the initial steps. The disclosure embargo was effectively zero because the fix shipped immediately, which is the ideal outcome for a small package with a single maintainer and a clean reproducer.
What I would do differently: verify the exact engine route before writing the GHSA summary. My first pass framed the bypass as Symbol-keyed because that was the angle I had spent the most time on while reading the source, and the PoC worked. But the PoC worked for reasons other than what I claimed in the writeup, and the maintainer caught the discrepancy. The lesson is to keep the textual description tightly coupled to the actual code path the PoC exercises, not to a hypothesis about why the code path is reachable. For future reports I will run a console.trace inside the patched library to confirm which branch the payload actually hits before writing the summary.
What other researchers could take away: SSPP fixes that ship with a key-name screen on the recursive branch should be checked against the else-branch and any fallback shallow-copy paths. The pattern in smob is shared with at least two other libraries in the same family, and I would not be surprised to find more. A grep for Object.assign({}, next to a key-name guard is a reasonable starting point for audit work.
References
- GHSA:
https://github.com/tada5hi/smob/security/advisories/GHSA-v687-7qq8-xx7x - CVE Record:
https://www.cve.org/CVERecord?id=CVE-2026-46435 - Fix PR:
https://github.com/tada5hi/smob/pull/446 - CWE-1321: Improperly Controlled Modification of Object Prototype Attributes
CVE-2022-24802(deepmerge-ts): same vector classCVE-2024-38986(@75lb/deep-merge): same vector class