/

CVE-2026-44293

Severity:

HIGH RISK

(8.8)

Code Injection in protobufjs

CVE-2026-44293

Modified

Vulnerability type

Category:

Code Injection

CWE:

CWE-94

Impact:

Arbitrary Code Execution in Code Generation Pipeline

Severity:

HIGH RISK

(8.8)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

protobufjs compiles Protocol Buffer definitions into JavaScript conversion functions, and prior to versions 7.5.6 and 8.0.2 its toObject generator could emit attacker-controlled expressions.

A crafted descriptor with a non-string default value for a bytes field could inject arbitrary JavaScript into the generated conversion code, potentially allowing code execution during serialization or object conversion where untrusted schemas are used.

Affected context

This vulnerability affects applications that use protobufjs to compile Protocol Buffer descriptors into JavaScript code, particularly when:

  • Descriptors (schema definitions) are loaded dynamically or supplied from external/untrusted sources
  • The toObject conversion functions are generated and executed at runtime
  • Schema authors can control default values for bytes fields without strict validation

In typical, closed, build-time-only setups where all .proto files are trusted and controlled, the risk is significantly lower, but environments that accept or transform descriptors at runtime are exposed.

Exploit preconditions

  • Attack surface: The Protobuf schema/descriptor ingestion interface (e.g., dynamic loading of .proto files, JSON descriptors, or plugin-provided schemas).
  • Required access: Ability to supply or modify Protocol Buffer descriptors consumed by protobufjs, including the default value of a bytes field.
  • Trigger point: Execution of the generated toObject conversion function for affected message types after code generation.
  • Why exploitation is possible: The code generator incorporates the default value of a bytes field into JavaScript source without enforcing that it is a safe string literal, enabling injection of arbitrary JavaScript expressions into the generated conversion function.

Why this happens

The underlying flaw is an instance of CWE-94: Improper Control of Generation of Code ('Code Injection') in the code generation phase of protobufjs.

When constructing JavaScript for toObject conversion, the generator treated schema-controlled default values for bytes fields as if they were safe to embed directly into source code.

Because these values were not restricted to plain strings or properly escaped, a crafted descriptor could supply a non-string value that, once interpolated into the generated function body, becomes executable JavaScript.

This reflects the broader bug class where structured configuration or metadata (here, Protobuf descriptors) are treated as trusted code fragments during generation, blurring the line between data and executable logic.

Potential impact

  • Execution of attacker-controlled JavaScript within the process that runs the generated protobufjs conversion functions
  • Compromise of the application using protobufjs, including access to in-process secrets and sensitive data
  • Lateral movement within a service environment if compromised services hold credentials or tokens for other systems
  • Data tampering or manipulation of serialized/deserialized messages
  • Interference with logging, monitoring, or security checks executed in the same runtime

General mitigation guidance

Effective mitigation focuses on treating schemas and descriptors as untrusted data and constraining how they flow into code generation:

  • Restrict who can define or modify Protobuf schemas; treat .proto files and descriptors as part of trusted source code, not user input.
  • Enforce strict validation of descriptors before passing them to protobufjs, especially for bytes field defaults, ensuring they conform to expected types (e.g., strings or binary-safe representations only).
  • Avoid runtime code generation from externally supplied schemas; prefer a build-time compilation step where schemas are reviewed and checked.
  • Apply output encoding or safe templating patterns when generating code from metadata to ensure that schema fields are never interpolated into raw JavaScript expressions.
  • Run services that process potentially untrusted schemas in isolated or least-privilege environments to limit the blast radius of any code execution in the generation pipeline.

How teams detect issues like this

Organizations can look for this bug pattern through a combination of static and process-focused detection:

  • Static analysis patterns: Search codebases for dynamic protobufjs schema loading and runtime code generation, focusing on paths where descriptors may originate from configuration files, network input, or plugins.
  • Code review signals: Flag any code that:
  • Accepts arbitrary .proto/descriptor input at runtime
  • Passes unvalidated descriptor objects into protobufjs compilation or generator APIs
  • Emits or evaluates generated JavaScript strings derived from configuration or schema data
  • Policy enforcement: Establish policies that disallow runtime compilation of schemas from unverified sources and require schema changes to go through code review.
  • Automated tooling: Use SAST or custom linters to detect direct interpolation of descriptor fields into generated JavaScript or direct use of code-evaluation constructs around schema-driven strings.

Sources

SourceLink
github.comgithub.com/protobufjs/protobuf.js/security/advisories/GHSA-66ff-xgx4-vchm
access.redhat.comaccess.redhat.com/errata/RHSA-2026:26090
access.redhat.comaccess.redhat.com/errata/RHSA-2026:26234
access.redhat.comaccess.redhat.com/errata/RHSA-2026:29795
access.redhat.comaccess.redhat.com/errata/RHSA-2026:34160
access.redhat.comaccess.redhat.com/errata/RHSA-2026:34374
access.redhat.comaccess.redhat.com/errata/RHSA-2026:37186
access.redhat.comaccess.redhat.com/errata/RHSA-2026:37385
access.redhat.comaccess.redhat.com/errata/RHSA-2026:37628
access.redhat.comaccess.redhat.com/security/cve/CVE-2026-44293
bugzilla.redhat.combugzilla.redhat.com/show_bug.cgi?id=2477104
security.access.redhat.comsecurity.access.redhat.com/data/csaf/v2/vex/2026/cve-2026-44293.json

Frequently asked

questions

It can be, if an attacker can cause the application to load or regenerate protobufjs code from descriptors they control, such as user-uploaded .proto files, remote configuration, or plugin-provided schemas. If schema input is fully internal and not attacker-influenced, practical exploitability is lower.

An attacker must be able to supply or modify Protobuf descriptors or schema definitions that protobufjs uses for code generation. This might mean access to configuration systems, build or plugin inputs, or any interface where schemas are accepted dynamically.

Treat schema descriptors as untrusted input: validate and sanitize them before use, restrict descriptor sources to trusted repositories, and ensure that code generation never interpolates raw descriptor fields into executable JavaScript without strict type and escaping guarantees.

Adopt a design principle that separates data and code strictly in all generation pipelines. Use safe templating and encoding, avoid runtime evaluation of generated strings, enforce code review on schema and generator changes, and integrate security checks (such as SAST and configuration validation) into CI/CD for both application code and schema definitions.

Find out what's already
exploitable in your codebase.