Skip to content

binary-parser code injection CVE-2026-134814; patched in 2.3.1

CVE-2026-134814 (CVSS 9.2) lets attacker-controlled parser definitions inject JavaScript into binary-parser's generated code. Fixed in 2.3.1. It's an incomplete-fix regression of CVE-2026-1245.

Published 3 min read

The widely-used npm package binary-parser carries a code-injection flaw, CVE-2026-134814, that lets attacker-controlled parser definitions inject arbitrary JavaScript into the code the library generates at runtime. Maintainer Keichi Takahashi fixed it in 2.3.1. The catch that decides your exposure: this is only reachable when an attacker controls the parser definition (the schema), not merely the binary data being parsed.

What the bug does

binary-parser builds a parser by compiling your schema into a JavaScript function. Per the advisory, several string-typed options were interpolated into that generated code without adequate validation. An attacker who can set those option values can break out of the intended expression and run their own code.

The affected options, per the GitHub advisory GHSA-xmxc-6c22-m377:

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

The record is classed CWE-94 (code injection), CVSS 4.0 base 9.2 (Critical), vector AV:N/AC:H/AT:P/PR:N/UI:N/VC:H/VI:H/VA:H.

What's affected

  • All versions through 2.3.0 (the advisory lists the introduced range as every prior commit).
  • Fixed in 2.3.1, in commits 110206bb and 4b26e04c, which validate the options as identifier paths and reject expressions such as len - 1 (use a function instead). The CVE record went live on November 22 per OSV.

Crucially, the maintainer notes: "Parsing untrusted binary data with a trusted parser definition is not affected." If your schemas are static and defined in your own source, you are not exploitable through this. The risk is for code that builds parser definitions out of user-supplied strings — config-driven parsers, multi-tenant schema builders, anything that lets a caller name a field or set a length expression.

Exploitation status

No in-the-wild exploitation has been reported. There is no public PoC beyond the advisory's description. The window here is pre-emptive.

Action checklist

  1. Upgrade binary-parser to 2.3.1 or later. npm ls binary-parser to find it, including transitive pulls.
  2. Grep your code for the risky options fed from untrusted input: length, lengthInBytes, key, tag, offset, and namely() aliases. If any trace back to request data, treat it as critical until patched.
  3. If you can't upgrade immediately, stop passing user-controlled strings into those options; replace length expressions with functions.
  4. Re-audit any dependency that bundles binary-parser for protocol or file-format parsing.

What other outlets missed

This is not a fresh class of bug in the library — it's an incomplete fix of CVE-2026-1245 (CVSS 6.5), the code-injection issue patched back in January 2026. The earlier fix closed some injection points but left the string-typed options above. Rating this a one-off undersells it: a parser-generator that compiles schemas to code is structurally exposed to this whenever any part of the schema is attacker-reachable, and the second CVE suggests the audit wasn't exhaustive the first time. Treat the fix in 2.3.1 as the current line, not the last word, if you feed it anything from outside your trust boundary.

Related stories