protobufjs Code Injection Vulnerability in Generated toObject Conversion

Vulnerability

A code injection vulnerability has been identified in protobufjs versions prior to 7.5.6 and 8.0.2. The issue arises in the JavaScript functions generated for 'toObject' conversion, where an unsafe expression could be introduced based on a schema-controlled default value of a bytes field. If a descriptor is crafted with a non-string default value for a bytes field, it can lead to the emission of attacker-controlled code into the conversion function. This vulnerability allows for the execution of arbitrary JavaScript in the context of the process using protobufjs, but only if the application loads an untrusted schema or descriptor and converts a message of the affected type with default values enabled.

Impact

Exploitation of this vulnerability could result in arbitrary code execution within the process that uses protobufjs.

Remediation

Users are advised to update to protobufjs versions 7.5.6 or 8.0.2. If untrusted schemas must be accepted, validate or restrict field options before loading them and run schema processing in an isolated environment.

Added: May 13, 2026, 5:25 PM
Updated: May 13, 2026, 5:25 PM

Vulnerability Rating

Custom Algorithm
spread
6.6
impact
7.5
exploitability
4.1
remediation
7.9
relevance
8.3
threat
0.0
urgency
2.9
incentive
0.0

Our algorithm analyzes dozens of metrics to generate these 8 key vulnerability categories, which are then combined to calculate the overall risk score.