This repository was archived by the owner on Apr 5, 2026. It is now read-only.
fix: check all path segments for dangerous keys (bypass of CVE-2023-2…#43
Merged
mickhansen merged 2 commits intomickhansen:masterfrom Feb 24, 2026
Merged
fix: check all path segments for dangerous keys (bypass of CVE-2023-2…#43mickhansen merged 2 commits intomickhansen:masterfrom
mickhansen merged 2 commits intomickhansen:masterfrom
Conversation
mickhansen
suggested changes
Feb 24, 2026
Owner
mickhansen
left a comment
There was a problem hiding this comment.
Please add unit tests to the PR
mickhansen
approved these changes
Feb 24, 2026
Owner
|
Thank you for your contribution, released in |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
The existing
__proto__guard introduced in commit7d3aee1(fix for CVE-2023-26132) only checkspieces[0], allowing a bypass when__proto__appears at any position other than the first segment.This PR extends the guard to check all path segments against dangerous keys (
__proto__,constructor,prototype) in bothset()andtransform().Important
This is a security fix. The bypass allows injecting properties into an object's prototype chain, which can lead to authorization bypass in downstream applications.
Vulnerability Details
Root Cause
The current guard only inspects the first element of the path:
A path like
'a.__proto__.polluted'passes this check becausepieces[0]is'a', not'__proto__'.Impact
Object.prototype)hasOwnProperty()andObject.keys()if (session.isAdmin))current['__proto__'] = {}replaces an object's prototype, breaking inherited methodsProof of Concept
<details> <summary>Click to expand PoC code</summary>Tested on Node.js v20/v22, dottie 2.0.6, Windows 11.
</details>Changes
dottie.jsset()function (line ~75):transform()function (line ~145):New test files
test/set.proto-bypass.test.js— 7 test cases forset()bypass preventiontest/transform.proto-bypass.test.js— 7 test cases fortransform()bypass preventionTesting
All 61 tests pass, including 14 new test cases:
Checklist
pieces[0]__proto__,constructor, andprototypeset()andtransform()are patchedReferences
- CVE-2023-26132 — Original prototype pollution vulnerability
- CWE-1321 — Improperly Controlled Modification of Object Prototype Attributes
## Description7d3aee1— Original fix (first-segment-only guard)The existing
__proto__guard introduced in commit[7d3aee1](https://github.com/mickhansen/dottie.js/commit/7d3aee1c9c3c842720506e131de7e181e5c8db68)(fix for [CVE-2023-26132](https://www.cve.org/CVERecord?id=CVE-2023-26132)) only checkspieces[0], allowing a bypass when__proto__appears at any position other than the first segment.This PR extends the guard to check all path segments against dangerous keys (
__proto__,constructor,prototype) in bothset()andtransform().Important
This is a security fix. The bypass allows injecting properties into an object's prototype chain, which can lead to authorization bypass in downstream applications.
Vulnerability Details
dottie.set(),dottie.transform()Root Cause
The current guard only inspects the first element of the path:
A path like
'a.__proto__.polluted'passes this check becausepieces[0]is'a', not'__proto__'.Impact
Object.prototype)hasOwnProperty()andObject.keys()if (session.isAdmin))current['__proto__'] = {}replaces an object's prototype, breaking inherited methodsProof of Concept
Click to expand PoC code
Tested on Node.js v20/v22, dottie 2.0.6, Windows 11.
Changes
dottie.jsset()function (line ~75):transform()function (line ~145):New test files
test/set.proto-bypass.test.js— 7 test cases forset()bypass preventiontest/transform.proto-bypass.test.js— 7 test cases fortransform()bypass preventionTesting
All 61 tests pass, including 14 new test cases:
Checklist
pieces[0]__proto__,constructor, andprototypeset()andtransform()are patchedReferences
[7d3aee1](https://github.com/mickhansen/dottie.js/commit/7d3aee1c9c3c842720506e131de7e181e5c8db68)— Original fix (first-segment-only guard)transform.proto-bypass.test.js
set.proto-bypass.test.js