Node.js developers relying on the binary-parser library need to patch immediately. A high-severity code injection vulnerability, tracked as CVE-2026-134814, affects all versions prior to 2.3.1. The maintainer published the advisory on November 11, 2026, assigning a CVSS score of 8.1 (9.2 under CVSS 4.0). This flaw allows attackers to execute arbitrary JavaScript within the Node.js process if they can influence parser definition options.
The Mechanism of Failure
The root cause lies in how binary-parser compiles definitions. The library generates JavaScript code at runtime, and in vulnerable versions, several string options were inserted into this generated code without proper validation via Context.generateOption(). Specifically, the length, lengthInBytes, key, tag, offset, and namely() alias options were susceptible. If an attacker controls these values, their injected code runs during parser compilation, not just during data parsing.
Who Is Actually At Risk?
It is crucial to distinguish between the parser definition and the binary data being parsed. According to the maintainer, applications parsing untrusted binary data with hardcoded, developer-written parser definitions are not directly affected by this specific injection vector. The primary risk exists in systems where untrusted input shapes the definition itself, such as when parser configurations are loaded from user inputs, plugins, or dynamic configuration files. Even if your exposure is lower, the libraryβs architecture makes static definitions safer but not immune to other potential issues.
Breaking Changes in the Fix
Upgrading to version 2.3.1 introduces a breaking change that requires immediate code review. The fix restricts affected options to accept only identifier paths, such as len or $parent.len. Inline expressions like length: "len - 1" are now rejected at compile time. Developers must refactor these instances to use functions, for example, changing the length property to a function that returns the computed value: length: function () { return this.len - 1; }. Failing to update these patterns will result in compile-time errors.
Key Takeaways
- CVE-2026-134814 is the second code injection issue in binary-parser this year, following CVE-2026-1245 fixed in January.
- The vulnerability stems from string interpolation in generated code, not binary data parsing.
- Upgrade to binary-parser@latest (v2.3.1+) immediately.
- Refactor any inline expression strings in length, key, tag, or offset options to use JavaScript functions.
- Review sources of parser definitions; avoid using untrusted user input to define parser structures.
The Bottom Line
Runtime code generation is a powerful optimization but a security nightmare if validation is an afterthought. Treat your parser definitions as executable code, not just configuration, and audit your input vectors accordingly.