Skip to content

fix: do not allow setting __proto__ in Message constructor#2126

Merged
alexander-fenster merged 1 commit intomasterfrom
message-prototype
Mar 11, 2026
Merged

fix: do not allow setting __proto__ in Message constructor#2126
alexander-fenster merged 1 commit intomasterfrom
message-prototype

Conversation

@alexander-fenster
Copy link
Copy Markdown
Contributor

Fixes #2125.

When a properties object passed to Message constructor contains __proto__, such as in

const properties = JSON.parse('{"__proto__": {"polluted": "yes"}}');
const message = new protobuf.Message(properties);

the resulting message object will have message.polluted defined which is not intended.

Filter out __proto__ when iterating over the keys of the properties.

When a properties object passed to Message constructor contains
__proto__, such as in

const properties = JSON.parse('{"__proto__": {"polluted": "yes"}}');
const message = new protobuf.Message(properties);

the resulting message object will have message.polluted defined
which is not intended.

Filter out __proto__ when iterating over the keys of the properties.
@alexander-fenster alexander-fenster merged commit f05e3c3 into master Mar 11, 2026
24 checks passed
@alexander-fenster alexander-fenster deleted the message-prototype branch March 11, 2026 02:32
@github-actions github-actions bot mentioned this pull request Mar 11, 2026
vasiliiperfilev pushed a commit to vasiliiperfilev/protobuf.js that referenced this pull request Apr 14, 2026
…s#2126)

When a properties object passed to Message constructor contains
__proto__, such as in

const properties = JSON.parse('{"__proto__": {"polluted": "yes"}}');
const message = new protobuf.Message(properties);

the resulting message object will have message.polluted defined
which is not intended.

Filter out __proto__ when iterating over the keys of the properties.
alexander-fenster added a commit that referenced this pull request Apr 15, 2026
When a properties object passed to Message constructor contains
__proto__, such as in

const properties = JSON.parse('{"__proto__": {"polluted": "yes"}}');
const message = new protobuf.Message(properties);

the resulting message object will have message.polluted defined
which is not intended.

Filter out __proto__ when iterating over the keys of the properties.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Critical Prototype Pollution Vulnerability in protobufjs <= 8.0.0 (Message Constructor)

3 participants