CVE-2026-54271: protobufjs-cli Code Injection Vulnerability

HIGH
Advisory Identifier: GHSA-pr59-h9ph-3fr8
CVSS 8.2
CWE-94
Published
Advisory Summary

CVE-2026-54271 is a HIGH (CVSS 8.2) code injection vulnerability (CWE-94: Improper Control of Generation of Code ('Code Injection')) affecting protobufjs-cli libraries in the npm ecosystem. The issue involves code injection in pbjs static output from crafted json descriptor names. Remediation is available by upgrading affected packages to version 1.3.2, 2.5.0.

CVE-2026-54271 at a Glance

CVE Identifier CVE-2026-54271
GHSA Identifier GHSA-pr59-h9ph-3fr8
Severity HIGH
CVSS v3.1 Base Score 8.2
CWE Classification CWE-94: Improper Control of Generation of Code ('Code Injection')
Affected Product protobufjs-cli
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 8.2

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

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

How to Fix CVE-2026-54271

To remediate this vulnerability, upgrade all affected protobufjs-cli 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-cli fixed: 1.3.2
npm install protobufjs-cli@1.3.2
protobufjs-cli fixed: 2.5.0
npm install protobufjs-cli@2.5.0
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-cli

How to Check if You Are Affected

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

npm ls protobufjs-cli

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

Note: The npm ls protobufjs-cli 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-cli, 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 A previous fix for unsafe name handling in `pbjs` static / static-module code generation was incomplete. Affected versions of `protobufjs-cli` could still emit unsafe JavaScript references when generating static output from crafted JSON descriptor input. The common case of parsing schemas from `.proto` files is not affected. This is a bypass of GHSA-6r35-46g8-jcw9 / CVE-2026-44295. ## Impact An attacker who can provide or influence pre-parsed JSON descriptors passed to `pbjs` static code generation may be able to cause generated JavaScript output to contain attacker-controlled code. The injected code may execute if the generated file is later executed or imported and an affected generated API path is invoked. ## Preconditions * The application or build process must run `pbjs` static code generation on a pre-parsed JSON descriptor influenced by an attacker. * The generated JavaScript file must subsequently be executed or imported. * An affected generated API path must be invoked. ## Workarounds Do not run affected versions of `pbjs` static or static-module generation on untrusted JSON descriptors. If untrusted JSON descriptors must be accepted, validate descriptor-derived names before code generation and reject names that could not have been produced by parsing a valid `.proto` file. Running code generation in an isolated environment can reduce impact.

CVE-2026-54271 Affected protobufjs-cli Versions

2 component(s)
Fixed Versions:
1.3.22.5.0
Product / Package Ecosystem Affected Versions Fixed Version
protobufjs-cli
npm
< 1.3.2
1.3.2
protobufjs-cli
npm
≥ 2.0.0
< 2.5.0
2.5.0

References

Frequently Asked Questions

What is CVE-2026-54271?
CVE-2026-54271 is a security vulnerability in protobufjs-cli involving Code injection in pbjs static output from crafted JSON descriptor names under CWE-94: Improper Control of Generation of Code ('Code Injection').
Which protobufjs-cli versions are affected?
Affected versions include releases prior to 1.3.2, 2.5.0 across affected packages: protobufjs-cli.
What version fixes CVE-2026-54271?
Upgrading to 1.3.2, 2.5.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is protobufjs-cli affected?
Yes, protobufjs-cli is affected in releases prior to 1.3.2, 2.5.0. Upgrade your dependency to 1.3.2, 2.5.0 or later.
What is the CVSS score of CVE-2026-54271?
CVE-2026-54271 has a CVSS v3.1 base score of 8.2 (HIGH) with vector string CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:C/C:H/I:H/A:L.
What CWE is associated with CVE-2026-54271?
CVE-2026-54271 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-54271?
Run the dependency tree command: 'npm ls protobufjs-cli'. 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-pr59-h9ph-3fr8",
  "modified" : "2026-07-15T22:06:57Z",
  "published" : "2026-06-15T20:13:54Z",
  "aliases" : [ "CVE-2026-54271" ],
  "summary" : "protobufjs-cli: Code injection in pbjs static output from crafted JSON descriptor names",
  "details" : "## Summary\n\nA previous fix for unsafe name handling in `pbjs` static / static-module code generation was incomplete. Affected versions of `protobufjs-cli` could still emit unsafe JavaScript references when generating static output from crafted JSON descriptor input. The common case of parsing schemas from `.proto` files is not affected.\n\nThis is a bypass of GHSA-6r35-46g8-jcw9 / CVE-2026-44295.\n\n## Impact\n\nAn attacker who can provide or influence pre-parsed JSON descriptors passed to `pbjs` static code generation may be able to cause generated JavaScript output to contain attacker-controlled code.\n\nThe injected code may execute if the generated file is later executed or imported and an affected generated API path is invoked.\n\n## Preconditions\n\n* The application or build process must run `pbjs` static code generation on a pre-parsed JSON descriptor influenced by an attacker.\n* The generated JavaScript file must subsequently be executed or imported.\n* An affected generated API path must be invoked.\n\n## Workarounds\n\nDo not run affected versions of `pbjs` static or static-module generation on untrusted JSON descriptors. If untrusted JSON descriptors must be accepted, validate descriptor-derived names before code generation and reject names that could not have been produced by parsing a valid `.proto` file. Running code generation in an isolated environment can reduce impact.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:C/C:H/I:H/A:L"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "protobufjs-cli"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.3.2"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 1.3.1"
    }
  }, {
    "package" : {
      "ecosystem" : "npm",
      "name" : "protobufjs-cli"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "2.0.0"
      }, {
        "fixed" : "2.5.0"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 2.4.2"
    }
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/protobufjs/protobuf.js/security/advisories/GHSA-pr59-h9ph-3fr8"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-54271"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/protobufjs/protobuf.js"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-94" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-06-15T20:13:54Z",
    "nvd_published_at" : "2026-06-22T18:16:45Z"
  }
}