Executive brief
protobufjs-cli is a command-line tool used to generate JavaScript code from Protocol Buffer schemas. A vulnerability in the code generation process allows an attacker to provide a specially crafted schema that injects malicious code into the resulting JavaScript files. If a developer or automated build system processes an untrusted schema and then executes the generated code, it could lead to a full system compromise or data theft.
Technical details
A code injection vulnerability (CWE-94) exists in the pbjs static code generation component of protobufjs-cli. The root cause is insufficient sanitization of identifiers derived from schema-controlled names, such as namespaces, enums, and service names. An attacker can craft a malicious .proto schema or JSON descriptor that, when processed by pbjs, embeds arbitrary JavaScript into the output file. Exploitation requires the attacker to influence the schema used during the build process and for the victim to subsequently execute or import the generated JavaScript. This vulnerability is fixed in versions 1.2.1 and 2.0.2.
Affected products
- protobufjs protobufjs-cli < 1.2.1, >= 2.0.0 < 2.0.2
Timeline
- 2026-05-12: advisory: GitHub Security Advisory GHSA-6r35-46g8-jcw9 published
- 2026-05-13: disclosed: CVE-2026-44295 published to NVD