Packages
binary-parser 2.3.1 and 3.0.0: Patching CVE-2026-134814, ESM Migration, and Breaking String-Option Changes
A critical JavaScript code injection flaw (CVE-2026-134814, CVSS 9.2) in binary-parser < 2.3.1 was published to NVD and GitHub Advisories on November 23, 2026—one day after v3.0.0 landed on npm. Learn how identifier-path validation breaks string expressions like "len - 1", what changed in the ESM-first 3.0.0 release, and how to upgrade safely.
8 min read
binary-parser 2.3.1 and 3.0.0: Patching CVE-2026-134814, ESM Migration, and Breaking String-Option Changes
Executive Summary
On November 23, 2026, the NIST National Vulnerability Database (NVD) and the GitHub Advisory Database published CVE-2026-134814 (GHSA-hhq6-2gpv-hrf4), a critical code injection vulnerability affecting the popular JavaScript/TypeScript package binary-parser on npm prior to version 2.3.1. The disclosure arrived just one day after maintainer Keichi Takahashi published binary-parser@3.0.0 on npm on November 22, 2026 (npm).
For Node.js, Bun, Deno, and browser teams using binary-parser to decode network packets, IoT telemetry, or proprietary binary formats, this release cycle carries two immediate operational consequences:
- Security Patch (
v2.3.1+, CVSS 4.0:9.2Critical / CVSS 3.1:8.1High):CVE-2026-134814(also tracked by the maintainer in GHSA-xmxc-6c22-m377) stems from an incomplete January 2026 fix forCVE-2026-1245(The Hacker News). Applications that pass untrusted or schema-driven parser definitions tobinary-parser <= 2.3.0risk arbitrary JavaScript execution inside the Node.js process during parser compilation. - Breaking Behavioral & Module Changes (
v2.3.1&v3.0.0): The2.3.1fix enforces strict identifier-path validation on string-typed options—meaning legacy string expressions such as"len - 1"now throw and must be rewritten as JavaScript functions. Meanwhile,3.0.0ships as an ES module (ESM) package that requires Node.js 22.12 or later for CommonJSrequire()interoperability (npm).
Adoption Telemetry & Version Changelog
binary-parser is a zero-dependency declarative parser builder inspired by Ruby's BinData and Node's binary. Rather than interpreting a schema at runtime byte-by-byte, binary-parser dynamically generates and compiles JavaScript parser code on the fly (compile() / parse()), achieving throughput comparable to hand-written Buffer / Uint8Array readers (npm).
As verified on the npm registry on November 24, 2026, the package's footprint and release metadata include:
| Package Attribute | Verified Value (Nov 24, 2026) | Source |
|---|---|---|
| Latest Release | 3.0.0 (published Nov 22, 2026) |
npm |
| Security Patch Baseline | 2.3.1 (advisory published Nov 11, 2026) |
The Hacker News |
| Weekly npm Downloads | 31,002 |
npm |
| Direct npm Dependents | 186 packages |
npm |
| Published Versions | 38 |
npm |
| Runtime Dependencies | 0 (zero external dependencies) |
npm |
| License | MIT |
npm |
| Module Format & Runtimes | ESM (require() on Node.js >= 22.12); tested on Node.js, Bun, Deno (npm:binary-parser), and browsers |
npm |
(Note: While secondary commentary from Aviatrix Threat Research refers loosely to "millions of weekly npm downloads," the live npm package sidebar on November 24, 2026 records 31,002 weekly downloads and 186 direct dependents.)
Key Milestones Leading to 3.0.0
- January 2026 (
CVE-2026-1245, CVSS 6.5): Initial code-injection fix validated field names and string encoding parameters before interpolating them into generated parser source (The Hacker News; GHSA-xmxc-6c22-m377). - November 11, 2026 (
v2.3.1/GHSA-xmxc-6c22-m377): Maintainer Keichi Takahashi disclosed and patched a bypass inContext.generateOption(), restricting six additional string-typed options to valid identifier paths (GHSA-xmxc-6c22-m377). - November 22–23, 2026 (
v3.0.0&CVE-2026-134814):binary-parser@3.0.0shipped to npm as an ES module with built-in TypeScript declarations (npm), followed on November 23 by NVD, VulnCheck, Tenable, Rapid7, and GitHub Advisory Database publication ofCVE-2026-134814(GHSA-hhq6-2gpv-hrf4) (GitHub Advisory; Tenable).
Security Patches, Breaking Changes & Internals
Root Cause of CVE-2026-134814 (CWE-94)
Because binary-parser compiles parser chains into executable JavaScript source inside lib/binary_parser.ts via Context.generateOption(), any unvalidated string interpolated into that generated function body becomes executable code when compile() or parse() runs (GHSA-hhq6-2gpv-hrf4).
While the January 2026 patch for CVE-2026-1245 added validation for field names and encodings, six string-typed option paths remained unvalidated in binary-parser <= 2.3.0:
lengthinstring(),buffer(),array(),wrapped(), andseek()lengthInBytesinarray()keyinarray()taginchoice()offsetinpointer()- The alias argument passed to
namely()(GHSA-xmxc-6c22-m377)
An attacker who controls a parser definition—for example, in applications that dynamically construct Parser instances from user-supplied JSON schemas, YAML protocol descriptors, or untrusted plugin configurations—can supply crafted option strings to execute arbitrary JavaScript in the host Node.js process (GHSA-hhq6-2gpv-hrf4).
Threat Scope & Scoring Nuances
Two important boundaries distinguish real-world exposure from worst-case CVSS scores:
- Trusted Parsers Are Not Affected: As Keichi Takahashi explicitly noted in GHSA-xmxc-6c22-m377, "Parsing untrusted binary data with a trusted parser definition is not affected." If your
new Parser()chains are hardcoded in application source code, malformed binary payloads cannot triggerCVE-2026-134814. - CVSS 4.0 vs. CVSS 3.1 & EPSS: NVD and GitHub (
GHSA-hhq6-2gpv-hrf4) scoreCVE-2026-134814at 9.2 Critical under CVSS 4.0 (CVSS:4.0/AV:N/AC:H/AT:P/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N), whereas the maintainer'sGHSA-xmxc-6c22-m377advisory and Tenable record 8.1 High under CVSS 3.1 (CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H), with an EPSS probability of0.00608as of November 23, 2026 (Tenable; GitHub Advisory). Note also thatGHSA-hhq6-2gpv-hrf4is currently marked Unreviewed on GitHub without a linked npm package entry, meaning Dependabot alerts may rely onGHSA-xmxc-6c22-m377rather than the newer NVD-synced record (GitHub Advisory).
Breaking Change: Identifier-Path Validation & Migration Code
To close the injection vector in 2.3.1 (and carried forward into 3.0.0), binary-parser now validates those string-typed options strictly as identifier paths (such as foo or $parent.len). Arbitrary inline string expressions—such as "len - 1"—are rejected (GHSA-xmxc-6c22-m377).
In addition, binary-parser@3.0.0 distributes as an ES module (import { Parser } from "binary-parser"), though CommonJS callers on Node.js 22.12+ can still use require("binary-parser") (npm).
// ESM import in binary-parser 3.0.0 (CommonJS require() requires Node.js >= 22.12)
import { Parser } from "binary-parser";
// BEFORE (< 2.3.1): String arithmetic expressions are now REJECTED in 2.3.1+ and 3.0.0
// const legacyParser = new Parser()
// .uint8("dataLength")
// .array("payload", { type: "int32le", length: "dataLength - 1" });
// AFTER (2.3.1+ and 3.0.0): Use a direct identifier path OR a callback function
const safeParser = new Parser()
.uint8("dataLength")
// Direct identifier path (valid)
.array("rawItems", { type: "int32le", length: "dataLength" })
// Calculated length via function (required for arithmetic)
.array("trimmedItems", {
type: "int32le",
length: function () {
return this.dataLength - 1;
},
});
Ecosystem Comparison & Upgrade Checklist
In binary-parser's own repository benchmark suite (benchmark/), the project compares its compiled-parser throughput against three JavaScript binary-parsing peers: binparse, structron, and destruct.js (npm). While structron and destruct.js npm package pages could not be retrieved in full during this verification pass, the architectural contrast between binary-parser and typical runtime-interpreted binary parsers is clear from primary documentation:
| Criteria | binary-parser (v2.3.1 / v3.0.0) |
Runtime-Interpreted Peers (binparse / structron / destruct.js) |
|---|---|---|
| Execution Model | JIT-style code generation (compile() / parse()) into JS functions (npm) |
Typically walk field descriptors dynamically at parse time (avoiding eval/Function codegen) |
| Dependencies | 0 runtime dependencies, built-in TypeScript types (npm) |
Varies by package |
| Dynamic Schema Risk | High if untrusted schemas reach < 2.3.1; mitigated in 2.3.1+ via identifier-path validation (GHSA-xmxc-6c22-m377) |
Lower code-injection surface when no JS source code is generated |
| Node.js / Module Floor | v3.0.0 is ESM-first (require() needs Node >= 22.12); v2.3.1 retains 2.x compatibility (npm) |
Varies; older packages may remain CommonJS-only |
| Cross-Runtime Support | Node.js, Bun, Deno (npm:binary-parser), and browsers (npm) |
Primarily Node.js Buffer-oriented unless updated for Uint8Array |
Safe Upgrade & Pinning Checklist
- Audit Transitive Exposure: Run
npm ls binary-parseracross monorepos and CI images. Even if your application does not importbinary-parserdirectly,186npm packages depend on it (npm). - Choose Your Target Version (
2.3.1vs.3.0.0):- On Node.js 18 / 20 or CommonJS builds: Upgrade to
binary-parser@^2.3.1immediately to patchCVE-2026-134814without taking on the ESM migration in3.0.0. - On ESM projects or Node.js
>= 22.12: Upgrade tobinary-parser@^3.0.0(npm install binary-parser@3.0.0).
- On Node.js 18 / 20 or CommonJS builds: Upgrade to
- Grep for String Expressions in Options: Search your codebase for
.string(,.buffer(,.array(,.wrapped(,.seek(,.choice(,.pointer(, and.namely(calls. Replace any string option containing operators or whitespace (e.g.,"len - 1","header.len * 2") with a callback function (function () { return this.len - 1; }). - Verify Context Variable Usage: If your refactored functions reference
$parent,$root, or$index, ensure.useContextVars()is called on the top-levelParser, as context variables remain disabled by default for performance (npm). - Lock & Test: Run your binary protocol test fixtures after upgrading to confirm
TextDecoderencoding labels ("binary"vs."latin1") and identifier-path checks pass without runtime exceptions (npm).
Frequently Asked Questions
1. Is my application vulnerable to CVE-2026-134814 if it parses untrusted network packets?
No—not from packet bytes alone. As confirmed in GHSA-xmxc-6c22-m377, parsing untrusted binary buffers with a hardcoded, trusted Parser definition is not affected. Exploitation requires an attacker to control the parser definition itself (such as string values in length, key, tag, offset, or namely()).
2. Why did binary-parser 2.3.1 break my existing "len - 1" option?
Prior to 2.3.1, binary-parser interpolated string options verbatim into compiled JavaScript, which made arithmetic strings like "len - 1" work—but also enabled arbitrary JavaScript injection (CVE-2026-134814). Version 2.3.1 restricts those options to strict identifier paths (foo, $parent.len) and requires a callback function for calculations (GHSA-xmxc-6c22-m377).
3. Can CommonJS projects upgrade directly to binary-parser 3.0.0?
Only if you run Node.js 22.12 or later, which supports require() of synchronous ES modules. Teams on older Node.js LTS lines or CommonJS-only bundlers should pin 2.3.1 until they migrate to ESM or Node >= 22.12 (npm).
4. How does CVE-2026-134814 relate to CVE-2026-1245?
CVE-2026-134814 is an incomplete-fix bypass of CVE-2026-1245 (CVSS 6.5), which was patched in January 2026. The earlier fix validated field names and encodings, but left length, lengthInBytes, key, tag, offset, and namely() aliases unvalidated (The Hacker News; GHSA-xmxc-6c22-m377).
5. Does binary-parser 3.0.0 have any external dependencies?
No. binary-parser@3.0.0 maintains 0 dependencies on npm and ships with built-in TypeScript declarations (npm).
Sources
- npm Registry (Primary):
binary-parserv3.0.0 Package Page — https://www.npmjs.com/package/binary-parser (Published November 22, 2026; accessed November 24, 2026) - Maintainer Security Advisory (Primary):
GHSA-xmxc-6c22-m377— Code injection via string options inbinary-parser— https://github.com/keichi/binary-parser/security/advisories/GHSA-xmxc-6c22-m377 (November 11, 2026) - GitHub Advisory Database (Primary):
GHSA-hhq6-2gpv-hrf4/CVE-2026-134814— https://github.com/advisories/GHSA-hhq6-2gpv-hrf4 (Published November 23, 2026) - The Hacker News (Secondary): "Critical binary-parser Flaw Enables JavaScript Injection via Malicious Parser Definitions" — https://thehackernews.com/2026/11/critical-binary-parser-flaw-enables.html (November 23, 2026)
- Tenable CVE Record (Secondary):
CVE-2026-134814CVSS & EPSS Telemetry — https://www.tenable.com/cve/CVE-2026-134814 (November 23, 2026) - Aviatrix Threat Research (Secondary): "CVE-2026-134814: Critical binary-parser JavaScript Injection Flaw" — https://aviatrix.ai/threat-research-center/critical-binary-parser-flaw-javascript-injection-cve-2026-134814/ (November 23, 2026)