
CVE-2026-134814 - binary-parser - Critical 9.2 - Code injection. String options are interpolated into generated parser source, so a hostile parser definition executes JavaScript. Differential lab: 2.3.0 injects via three sinks, 2.3.1 rejects all.
binary-parser generates JavaScript parser source at runtime from a parser
definition. Several string-typed options were interpolated into that generated source
without validation, so an attacker who controls the definition executes JavaScript in
the Node process when the parser compiles.
The affected options are length of string, buffer, array, wrapped and seek,
lengthInBytes and key of array, tag of choice, offset of pointer, and
the alias passed to namely().
Class: Code injection via option interpolation Reach: Remote, when the parser definition is untrusted
binary-parser <= 2.3.0
| ID | CVE-2026-134814 / GHSA-xmxc-6c22-m377 |
| Class | Code injection |
| Reach | Remote, conditional on the definition being attacker-controlled |
| CWE | CWE-94 |
| CVSS | Critical: 9.2 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 (vendor) |
| Product | binary-parser (npm) |
| Affected | 2.3.0 and earlier |
| Fixed | 2.3.1 |
| License | GNU Affero GPL v3.0 |
| Lab | Node 18+, npm, no Docker and no server |
| Position | Method / sink | Recon, integrity, availability, confidentiality | Proven or inferred |
|---|---|---|---|
| Attacker controls a parser definition | string with a length option | Integrity, code execution in the Node process | Lab-proven. The option value runs as code |
Same, choice with a tag option | ctx.generateOption(this.options.tag) | Integrity | Lab-proven |
Same, pointer with an offset option | ctx.generateOption(this.options.offset) | Integrity | Lab-proven |
Same, array lengthInBytes / key, buffer / wrapped / seek length, namely() alias | the same generateOption path | Integrity | Inferred from the shared code path. Not exercised in this lab |
| Parsing untrusted binary data with a trusted definition | n/a | n/a | Closed. The data is not the injection vector |
| Anything after execution in the Node process | n/a | n/a | Out of scope. The lab's payload is an inert flag assignment |
Stays closed on this leftover
| Axis | Method / sink | Why it is closed |
|---|---|---|
| Untrusted binary input with a trusted definition | n/a | Closed. Only the definition is interpolated |
| Legitimate string options after the fix | length: "len", length: () => 2 | Lab-proven. Both parse on 2.3.0 and 2.3.1 |
| Any specific harmful capability | n/a | Closed by design. The witness payload assigns a global flag and nothing else |
This is an incomplete fix. The earlier patch for CVE-2026-1245 validated field names and encodings, and other string-typed options were still interpolated verbatim.
The interesting part is how an attacker escapes the library's own scoping. A string
option is passed to ctx.generateOption, which hands it to ctx.generateVariable:
generateVariable(name) {
const scopes = [...this.scopes[this.scopes.length - 1]];
if (name) scopes.push(name);
return scopes.join("."); // -> "vars." + <attacker string>
}
The scope prefix is glued onto the raw value, so the generated code sees vars. in
front of whatever the attacker chose. That prefix is the whole game. A payload of
1+1 becomes vars.1+1 and dies with a SyntaxError. A payload of
globalThis.__W132784__=1 becomes vars.globalThis.__W132784__=1 and dies with a
TypeError on an undefined property. Two shapes do work:
// chained assignment, for statement-ish positions
// option: "x=globalThis.__W132784__=1"
// code: vars.x=globalThis.__W132784__=1
// comma expression, for positions embedded after a "+" or inside a call
// option: "x,globalThis.__W132784__=1"
// code: buffer.subarray(offset, offset + vars.x, globalThis.__W132784__=1)
The comma form is the sneaky one. The witness assignment becomes an extra argument to
TypedArray.subarray, which ignores it, so the parse succeeds normally and the
injection is invisible to anything watching parse results.
python3 cve-2026-134814-binary-parser-option-injection-Abraxas-Labs.py
or directly:
cd lab && ./run.sh
No Docker, no server. npm installs [email protected] and [email protected] side
by side under the aliases bp-vuln and bp-fixed, and the oracle runs five probes
against each.
RESULT vuln-2.3.0/string-length/inject parsed=true witness=true error=none
RESULT vuln-2.3.0/choice-tag/inject parsed=true witness=true error=none
RESULT vuln-2.3.0/pointer-offset/inject parsed=true witness=true error=none
RESULT fixed-2.3.1/string-length/inject parsed=false witness=false error=Error
RESULT fixed-2.3.1/choice-tag/inject parsed=false witness=false error=Error
RESULT fixed-2.3.1/pointer-offset/inject parsed=false witness=false error=Error
SUMMARY vuln-injections=3 fixed-injections=0 controls-ok=4/4
The witness is a global flag, __W132784__, set to 1 by the injected code. The
oracle asserts on the flag, never on parse success alone, because a successful parse
is exactly what a silent injection looks like.
Recorded on Node 26.3.1 with npm 11.16.0, macOS arm64.
2.3.1 validates these options as identifier paths (foo, $parent.len) and rejects
everything else with Error: Invalid reference.
Code that used arithmetic expressions as option values, such as "len - 1", worked on
2.3.0 and now throws. The advisory's migration is to use a function instead. That is a
breaking change arriving with a security patch, and the failure shows up at parse
time rather than import time, so it is easy to miss in a test suite that only
imports. The lab's function control confirms the replacement works.
The payload is an assignment to a global flag. There is no process, no
child_process, no filesystem and no network access in it. The lab demonstrates that
attacker-chosen option strings execute as code in the Node process, and provides a
regression test. It does not carry that to any specific harmful capability.
Abraxas Labs - [email protected]