CVEReports
CVEReports

Automated vulnerability intelligence platform. Comprehensive reports for high-severity CVEs generated by AI.

Product

  • Home
  • Sitemap
  • RSS Feed

Company

  • About
  • Contact
  • Privacy Policy
  • Terms of Service

© 2026 CVEReports. All rights reserved.

Made with love by Amit Schendel & Alon Barad



CVE-2026-41242

CVE-2026-41242: Remote Code Execution via Code Injection in protobufjs

Amit Schendel
Amit Schendel
Senior Security Researcher

Apr 21, 2026·5 min read·121 visits

Executive Summary (TL;DR)

protobufjs versions prior to 7.5.5 and 8.0.1 suffer from a code injection vulnerability (CWE-94) during dynamic code generation. Attackers can achieve RCE by supplying crafted Protobuf definitions containing unsanitized JavaScript syntax in type names.

A critical remote code execution vulnerability in the protobufjs package allows unauthenticated attackers to execute arbitrary JavaScript within the Node.js runtime environment via maliciously crafted schema definitions.

Vulnerability Overview

The protobufjs library is a widely adopted Node.js package that provides protocol buffer serialization and deserialization capabilities. Many modern architectures rely on protocol buffers for efficient inter-service communication and data storage. The library handles parsing .proto files and JSON descriptor objects to construct message schemas dynamically at runtime.

CVE-2026-41242 is a critical Improper Control of Generation of Code vulnerability (CWE-94) located within the schema processing logic of the package. The flaw manifests when the library dynamically generates encoding and decoding routines to optimize processing performance. This optimization technique relies on Just-In-Time (JIT) compilation of JavaScript strings.

An attacker who can control the schema definition processed by the application can inject arbitrary JavaScript into these generated routines. Execution of this injected code occurs within the context of the running Node.js process. This results in complete system compromise if the node process runs with sufficient privileges.

Root Cause Analysis

To achieve high throughput, protobufjs constructs specialized encoding and decoding functions on the fly for each processed schema. The library concatenates static JavaScript code templates with dynamic variables derived from the parsed schema. These concatenated strings are subsequently instantiated into executable routines using the JavaScript new Function() constructor.

The vulnerability stems from an absolute lack of input sanitization during this string concatenation phase. The library directly interpolates metadata properties extracted from the user-supplied schema into the executable code string. Specifically, the type and name properties of a nested schema type are placed into the code without escaping or validation.

When the JavaScript runtime attempts to compile the output of the new Function() constructor, it parses the entire string as code. An attacker can construct a schema where the name property contains characters that break out of the intended string or variable context. By inserting characters such as closing parentheses, semicolons, and curly braces, the attacker defines new lexical boundaries and inserts arbitrary executable statements.

Code Analysis and Patch Review

The vulnerability was addressed by introducing a rigorous sanitization step within the type instantiation logic. Maintainers released patch commits, specifically 535df444ac060243722ac5d672db205e5c531d75 for the main branch and ff7b2afef8754837cc6dc64c864cd111ab477956 for the 7.x release line.

The core fix resides in src/type.js. The vulnerable implementation accepted the name parameter directly from the parsed descriptor and passed it unmodified into the namespace constructor. The patched version applies a strict regular expression filter to strip any non-alphanumeric characters.

// src/type.js - Patched Implementation
function Type(name, options) {
+   // Strips non-alphanumeric/underscore characters to prevent syntax breakout
+   name = name.replace(/\W/g, ""); 
    Namespace.call(this, name, options);
// ...

This mitigation forces the name string to conform strictly to valid JavaScript identifier constraints. Any structural characters required for an injection attack are silently removed before the string reaches the new Function() sink. The following diagram illustrates the patched execution flow.

Exploitation Methodology

Exploiting CVE-2026-41242 requires the attacker to supply a malicious Protobuf descriptor to a vulnerable application endpoint. The attack sequence typically begins with the application invoking protobuf.Root.fromJSON() or parsing an equivalent .proto file containing untrusted input. The exploit payload targets the namespace identifier structure.

The provided proof-of-concept payload defines a nested type with an extensively crafted string as its key. The string ExploitType; (function(){ console.log('RCE_EXECUTED'); require('child_process').execSync('touch /tmp/pwned'); })(); // serves as the malicious name property. When the library evaluates this schema, the compilation process maps this key directly into the uncompiled source text.

const maliciousDescriptor = {
  nested: {
    "ExploitType; (function(){ require('child_process').execSync('touch /tmp/pwned'); })(); //": {
      fields: { someField: { type: "string", id: 1 } }
    }
  }
};

The initial ExploitType; terminates the preceding logical statement inside the dynamically generated function. The subsequent immediately invoked function expression contains the arbitrary commands, executed instantly upon compilation. The trailing // neutralizes any trailing code appended by the template, preventing syntax errors that would halt execution.

Impact Assessment

Successful exploitation of CVE-2026-41242 yields unauthenticated Remote Code Execution (RCE). The injected JavaScript commands inherit the execution context and permissions of the hosting Node.js application. This access level permits the execution of arbitrary system commands, direct interaction with the underlying filesystem, and access to process environment variables.

The primary attack vector involves network services that accept dynamic schema definitions. Multi-tenant environments, plugin architectures, and systems processing serialized data from untrusted repositories represent the highest risk profiles. Applications statically loading trusted schemas at startup remain vulnerable only if an attacker compromises the schema repository.

The vulnerability possesses a CVSS v4 score of 9.4, reflecting its minimal attack complexity and severe impact metrics. The public availability of functional exploit repositories elevates the probability of widespread scanning and exploitation attempts targeting internet-facing Node.js services.

Remediation and Mitigation

The fundamental remediation strategy requires updating the protobufjs dependency to a secured version. Organizations must upgrade to version 7.5.5 or 8.0.1 immediately. Dependency trees should be audited using package management tools to identify transitive dependencies relying on vulnerable versions of the library.

Applications must enforce strict boundary validation for all external inputs. Protobuf definitions and JSON descriptors must not be loaded from untrusted network sources or unauthenticated users. If dynamic schema loading is a rigid business requirement, implement strict schema structure validation before passing the data to the protobufjs parser.

Employing defense-in-depth measures limits the blast radius of a successful exploit. Execute Node.js processes with least-privilege service accounts to restrict filesystem and network access. Implement system-level sandboxing, such as seccomp profiles or restricted container capabilities, to prevent child process execution.

Official Patches

GitHub Security AdvisoryOfficial GHSA publication with patch details.

Fix Analysis (2)

Technical Appendix

CVSS Score
9.4/ 10
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
EPSS Probability
0.05%
Top 85% most exploited

Affected Systems

Node.js services processing dynamic Protobuf schemasMulti-tenant RPC servers utilizing protobufjsApplications loading schema definitions from external APIs

Affected Versions Detail

Product
Affected Versions
Fixed Version
protobufjs
protobufjs
< 7.5.57.5.5
protobufjs
protobufjs
>= 8.0.0-experimental, < 8.0.18.0.1
AttributeDetail
CWE IDCWE-94
CVSS Score9.4
Attack VectorNetwork
EPSS Percentile15.37%
Exploit StatusPoC Available
KEV StatusNot Listed

MITRE ATT&CK Mapping

T1059Command and Scripting Interpreter
Execution
T1203Exploitation for Client Execution
Execution
CWE-94
Improper Control of Generation of Code

Improper Control of Generation of Code ('Code Injection')

Known Exploits & Detection

GitHubProof of Concept repository demonstrating RCE via malicious descriptor.
NucleiDetection Template Available

Vulnerability Timeline

Vulnerability reported to maintainers.
2026-03-02
Fix commits pushed to GitHub repository.
2026-03-11
Release of patched version 7.5.5.
2026-04-15
Detailed technical analysis published by Endor Labs.
2026-04-17
CVE-2026-41242 and GHSA officially published.
2026-04-18

References & Sources

  • [1]GHSA-xq3m-2v4x-88gg Advisory
  • [2]Exploit Proof of Concept

Attack Flow Diagram

Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.
Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.

More Reports

•2 days ago•GHSA-8RQH-VXPR-X77P
4.3

GHSA-8RQH-VXPR-X77P: Stored Cross-Site Scripting via MIME Type Spoofing in Plone REST API

A stored Cross-Site Scripting (XSS) vulnerability exists within plone.restapi, the REST API package for Plone content management system. By supplying a spoofed input MIME type (text/x-html-safe), an attacker can mislead the rendering layer (plone.app.textfield) into assuming that the supplied content is already sanitized. This causes the system to skip the safe_html transform, allowing arbitrary JavaScript to execute in the victim's browser when they view the compromised page.

Amit Schendel
Amit Schendel
9 views•7 min read
•2 days ago•CVE-2026-11400
8.0

CVE-2026-11400: Privilege Escalation via Untrusted Search Path in AWS Advanced JDBC Wrapper

An untrusted search path vulnerability in the GlobalDatabasePlugin component of the AWS Advanced JDBC Wrapper for Amazon Aurora PostgreSQL allows authenticated, low-privilege database users to hijack administrative session queries. By defining a custom function in a writable schema such as the public schema, an attacker can hijack queries executed automatically during driver-level topology detection. When a highly privileged database user connects to the database utilizing an affected version of the wrapper, the custom function executes under their security context, enabling remote privilege escalation to rds_superuser.

Alon Barad
Alon Barad
10 views•6 min read
•2 days ago•CVE-2026-27771
8.2

CVE-2026-27771: Authentication Bypass and Information Disclosure in Gitea Container and Composer Registries

CVE-2026-27771 represents a critical security flaw in Gitea and Forgejo (up to and including version 1.26.1) involving missing authorization checks (CWE-862). Unauthenticated remote attackers can query, enumerate, and download private container images from the OCI-compliant container registry. Additionally, unauthorized users can retrieve private or internal source repository URLs via the Composer package registry metadata API. A public proof-of-concept exists, and threat metrics indicate highly active scanning and exploitation risks.

Alon Barad
Alon Barad
20 views•7 min read
•2 days ago•GHSA-CVPC-HCCG-WMW4
8.8

GHSA-CVPC-HCCG-WMW4: Missing Authorization in Formie Administrative Settings Allows Privilege Escalation

A missing authorization vulnerability in the Formie plugin for Craft CMS prior to version 3.1.28 allows low-privileged Control Panel users to read and modify sensitive administrative settings, configuration options, and third-party integrations.

Amit Schendel
Amit Schendel
7 views•6 min read
•2 days ago•CVE-2026-53598
7.5

CVE-2026-53598: Arbitrary File Read via File Reference Expansion in Microsoft Prompty

CVE-2026-53598 is a directory traversal and arbitrary file read vulnerability in Microsoft Prompty ecosystem loaders across multiple languages. Prior to version 2.0.0-beta.2, the loaders resolved `${file:...}` reference strings inside frontmatter configuration blocks without enforcing that the target file paths resided within authorized directories. This deficiency allows an attacker-controlled configuration file to read sensitive operating system and application files through absolute paths, directory traversal, or symbolic link escapes. The issue is addressed across the Python, C#, Node.js/TypeScript, and Rust ecosystems.

Amit Schendel
Amit Schendel
8 views•6 min read
•2 days ago•GHSA-MFR4-MQ8W-VMG6
7.3

GHSA-MFR4-MQ8W-VMG6: Path Traversal in proot-distro copy Command Allows Container Escape

A directory traversal vulnerability exists in the copy subcommand of the proot-distro utility. Due to incomplete path sanitization, local attackers or malicious scripts can read from or write to arbitrary files outside the container rootfs, bypassing isolation barriers and potentially gaining unauthorized access or persistent execution on the host system.

Alon Barad
Alon Barad
9 views•7 min read