CVE-2026-41242: Protobufjs Arbitrary Code Execution Vulnerability

CRITICAL
Advisory Identifier: GHSA-xq3m-2v4x-88gg
CVSS 9.8
CWE-94
Published
Advisory Summary

CVE-2026-41242 is a CRITICAL (CVSS 9.8) arbitrary code execution vulnerability (CWE-94: Improper Control of Generation of Code ('Code Injection')) affecting Protobufjs libraries in the npm ecosystem. The issue involves arbitrary code execution in protobufjs. Remediation is available by upgrading affected packages to version 8.0.1, 7.5.5.

CVE-2026-41242 at a Glance

CVE Identifier CVE-2026-41242
GHSA Identifier GHSA-xq3m-2v4x-88gg
Severity CRITICAL
CVSS v3.1 Base Score 9.8
CWE Classification CWE-94: Improper Control of Generation of Code ('Code Injection')
Affected Product Protobufjs
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 9.8

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality High (C:H)
Integrity High (I:H)
Availability High (A:H)

How to Fix CVE-2026-41242

To remediate this vulnerability, upgrade all affected Protobufjs dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

protobufjs fixed: 8.0.1
npm install protobufjs@8.0.1
protobufjs fixed: 7.5.5
npm install protobufjs@7.5.5
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

npm ls protobufjs

How to Check if You Are Affected

To determine whether your Node.js application is affected by CVE-2026-41242, inspect your project dependencies using npm:

npm ls protobufjs

Analyze the terminal output to locate any version of Protobufjs in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 8.0.1), your application is affected.

Note: The npm ls protobufjs command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-94: Improper Control of Generation of Code ('Code Injection'), where the product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment. In Protobufjs, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

## Summary protobufjs could execute generated JavaScript code derived from protobuf schema metadata. When loading a crafted JSON descriptor, schema-controlled type names and type references could reach runtime code generation without sufficient validation. ## Impact An attacker who can provide a malicious protobuf definition or JSON descriptor to an application may be able to execute arbitrary JavaScript in the context of the process using protobufjs. This requires control over the protobuf schema or descriptor being loaded. Applications that only decode messages using trusted, application-defined schemas are not directly affected by this issue. ## Preconditions - The application must allow an attacker to control or influence a protobuf definition or JSON descriptor. - The application must load that definition through protobufjs reflection APIs such as descriptor loading. - The affected generated-code path must be reached, for example by performing an operation on the loaded type. ## Workarounds Do not load protobuf definitions or JSON descriptors from untrusted sources with affected versions. If untrusted schemas must be accepted, validate or restrict them before loading and run schema processing in an isolated environment.

CVE-2026-41242 Affected Protobufjs Versions

2 component(s)
Fixed Versions:
8.0.17.5.5
Product / Package Ecosystem Affected Versions Fixed Version
protobufjs
npm
≥ 8.0.0
< 8.0.1
8.0.1
protobufjs
npm
< 7.5.5
7.5.5

References

Frequently Asked Questions

What is CVE-2026-41242?
CVE-2026-41242 is a security vulnerability in Protobufjs involving Arbitrary code execution in protobufjs under CWE-94: Improper Control of Generation of Code ('Code Injection').
Which Protobufjs versions are affected?
Affected versions include releases prior to 8.0.1, 7.5.5 across affected packages: protobufjs.
What version fixes CVE-2026-41242?
Upgrading to 8.0.1, 7.5.5 (or the latest patched release for your respective branch) resolves the vulnerability.
Is protobufjs affected?
Yes, protobufjs is affected in releases prior to 8.0.1, 7.5.5. Upgrade your dependency to 8.0.1, 7.5.5 or later.
What is the CVSS score of CVE-2026-41242?
CVE-2026-41242 has a CVSS v3.1 base score of 9.8 (CRITICAL) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H.
What CWE is associated with CVE-2026-41242?
CVE-2026-41242 is classified under CWE-94: Improper Control of Generation of Code ('Code Injection') (The product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment.).
How can I check npm dependencies for CVE-2026-41242?
Run the dependency tree command: 'npm ls protobufjs'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-xq3m-2v4x-88gg",
  "modified" : "2026-05-04T22:12:42Z",
  "published" : "2026-04-16T22:34:57Z",
  "aliases" : [ "CVE-2026-41242" ],
  "summary" : "Arbitrary code execution in protobufjs",
  "details" : "## Summary\n\nprotobufjs could execute generated JavaScript code derived from protobuf schema metadata. When loading a crafted JSON descriptor, schema-controlled type names and type references could reach runtime code generation without sufficient validation.\n\n## Impact\n\nAn attacker who can provide a malicious protobuf definition or JSON descriptor to an application may be able to execute arbitrary JavaScript in the context of the process using protobufjs.\n\nThis requires control over the protobuf schema or descriptor being loaded. Applications that only decode messages using trusted, application-defined schemas are not directly affected by this issue.\n\n## Preconditions\n\n- The application must allow an attacker to control or influence a protobuf definition or JSON descriptor.\n- The application must load that definition through protobufjs reflection APIs such as descriptor loading.\n- The affected generated-code path must be reached, for example by performing an operation on the loaded type.\n\n## Workarounds\n\nDo not load protobuf definitions or JSON descriptors from untrusted sources with affected versions. If untrusted schemas must be accepted, validate or restrict them before loading and run schema processing in an isolated environment.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H"
  }, {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:H/VI:H/VA:H/SC:H/SI:H/SA:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "protobufjs"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "8.0.0"
      }, {
        "fixed" : "8.0.1"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "npm",
      "name" : "protobufjs"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "7.5.5"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/protobufjs/protobuf.js/security/advisories/GHSA-xq3m-2v4x-88gg"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-41242"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/protobufjs/protobuf.js/commit/535df444ac060243722ac5d672db205e5c531d75"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/protobufjs/protobuf.js/commit/ff7b2afef8754837cc6dc64c864cd111ab477956"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/protobufjs/protobuf.js"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/protobufjs/protobuf.js/releases/tag/protobufjs-v7.5.5"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/protobufjs/protobuf.js/releases/tag/protobufjs-v8.0.1"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-94" ],
    "severity" : "CRITICAL",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-04-16T22:34:57Z",
    "nvd_published_at" : "2026-04-18T17:16:13Z"
  }
}