Mastodon Mastodon Mastodon Mastodon

Critical vulnerability in npm package binary-parser allows arbitrary JavaScript execution

Photo of author

CyberSecureFox Editorial Team

Published:

A code injection vulnerability CVE-2026-134814 has been disclosed in the popular npm package binary-parser, allowing an attacker who controls parser definitions to execute arbitrary JavaScript in the Node.js process. The vulnerability affects package versions up to and including 2.3.1 (≤2.3.0) and is fixed in version 2.3.1. Applications that build parser definitions based on data from untrusted sources — for example, from user-supplied JSON schemas — should update immediately. At the same time, according to the maintainer’s advisory, parsing untrusted binary data using a trusted parser definition is not vulnerable.

Technical details of the vulnerability

The vulnerability is classified as CWE-94 (code injection). The root cause is that several string parameters provided by the user when defining a parser were inserted directly into generated JavaScript code without proper validation. According to the entry in the GitHub Advisory Database, the vulnerable parameters were passed through the Context.generateOption() function without checks.

The affected parser definition parameters are:

  • length
  • lengthInBytes
  • key
  • tag
  • offset
  • the alias passed to namely()

An attacker able to inject specially crafted values into any of these parameters could achieve execution of arbitrary JavaScript code at parser compilation time — that is, even before binary data parsing begins.

Differences in severity assessment

The severity rating of CVE-2026-134814 varies depending on the source and CVSS version. Project maintainer Keiichi Takahashi, in his advisory, rates the vulnerability as High with a score of 8.1 under CVSS v3. Meanwhile, the GitHub Advisory Database entry associated with NVD assigns it a Critical status with a score of 9.2 under CVSS v4. The difference is due both to the assessment methodology (v3 versus v4) and, likely, to differences in attack scenario modeling. When planning response priorities, both ratings and their context should be taken into account.

In addition, another discrepancy was found in the metadata: at the time of review, the maintainer’s advisory page (GHSA-xmxc-6c22-m377) stated “No known CVE,” while a separate entry in the GitHub Advisory Database already identified the vulnerability as CVE-2026-134814 and recorded its publication in NVD on November 22, 2026. This discrepancy is administrative in nature and does not affect the technical substance of the issue, but it may complicate automated vulnerability monitoring.

Relation to the previous vulnerability

CVE-2026-134814 is effectively a bypass of an incomplete fix for an earlier vulnerability, CVE-2026-1245 (CVSS 6.5, Moderate according to the GitHub Advisory Database). That vulnerability, fixed in version 2.3.0, concerned insufficient validation of field names and encoding parameters. The 2.3.0 patch closed those specific vectors but left other string parameters — length, key, tag, and the rest — unchecked, which led to CVE-2026-134814. This is a typical situation where a targeted fix for one injection vector does not cover the entire attack surface in a code-generating architecture.

Impact assessment

The practical impact radius of the vulnerability is limited to a specific scenario: the attacker must be able to influence the parser definition, not just the data being parsed. This means the highest risk is to:

  • Applications that accept parser definitions from user input, configuration files, or APIs
  • Systems that use JSON schemas or other external descriptions to dynamically build binary-parser parsers
  • Platforms with a multi-tenant environment where different users can define data parsing formats

Applications in which parser definitions are hard-coded and do not depend on external data are not affected by this vulnerability, even if they process untrusted binary streams. No information on active exploitation of CVE-2026-134814 has been found as of publication; the vulnerability is not listed in the CISA KEV catalog.

Recommendations

The primary action is to update binary-parser to version 2.3.1 or later. In this version, the affected parameters are validated as identifier paths (for example, foo, $parent.len). Expressions like len - 1 are now rejected at compile time; instead, the maintainer recommends using functions.

Additional steps:

  1. Audit your codebase for uses of binary-parser with dynamically constructed parser definitions
  2. Check whether the values of the length, key, tag, offset, lengthInBytes parameters or namely() arguments come from untrusted sources
  3. If immediate updating is not possible, restrict the sources of parser definitions to trusted code and exclude user input from parser parameters

The reappearance of a code injection issue in the same package after an incomplete fix for CVE-2026-1245 highlights the need for a systematic validation approach in code-generating libraries. Organizations using binary-parser in production environments should update to version 2.3.1 and review the architecture of applications that pass external data into parser definitions — regardless of which CVSS rating they choose to prioritize.


CyberSecureFox Editorial Team

The CyberSecureFox Editorial Team covers cybersecurity news, vulnerabilities, malware campaigns, ransomware activity, AI security, cloud security, and vendor security advisories. Articles are prepared using official advisories, CVE/NVD data, CISA alerts, vendor publications, and public research reports. Content is reviewed before publication and updated when new information becomes available.

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.