
November 23, 2026
A code injection vulnerability in the popular binary-parser library could let an attacker run arbitrary JavaScript inside your Node.js process. Tracked as CVE-2026-134814, it affects all versions before 2.3.1 and carries a CVSS score of 8.1 (9.2 under CVSS 4.0). The maintainer published the advisory on November 11, 2026.
What’s going wrong
binary-parser compiles parsers by generating JavaScript at runtime. In vulnerable versions, several string options were inserted into that generated code without validation, via Context.generateOption(). An attacker who can supply those values can inject their own code, and it runs when the parser is compiled.
The affected options are:
length(on string, buffer, array, wrapped and seek fields)lengthInBytesandkey(on arrays)tag(on choice fields)offset(on pointer fields)- the alias passed to
namely()
Who is at risk
The key distinction is between parser definitions and the data they parse. According to the maintainer, parsing untrusted binary data with a parser definition you wrote yourself is not affected.
The risk is applications where untrusted input shapes the definition itself, for example when definitions come from users, plugins, or configuration files. If your parsers are static and hardcoded, your exposure is much lower, though you should still upgrade.
This is the second code injection issue in the library this year. CVE-2026-1245, fixed in version 2.3.0 in January, involved parser field names and encoding parameters. The new flaw is in a different set of options, but the root cause is the same: strings ending up inside generated code.
How to fix it
Upgrade to binary-parser 2.3.1 or later:npm install binary-parser@latest
Heads-up: this release has a breaking change. The affected options now accept only identifier paths, such as len or $parent.len. Inline expressions are rejected at compile time. If you currently write something like this:
Before (rejected in 2.3.1):length: "len - 1"
After (use a function):length: function () { return this.len - 1; }
Test your parsers after upgrading, since any expression strings will now throw errors.
Beyond the upgrade
Once a parser definition is compiled, it is code. Review where your definitions come from, and keep user-controlled input out of them. When you need dynamic behavior, use functions rather than raw expression strings.
Sources: binary-parser v2.3.1 release notes (advisory GHSA-xmxc-6c22-m377) · CERT/CC VU#102648 on CVE-2026-1245

Leave a Reply