Data security

Critical flaw in the binary-parser library allows JavaScript injection through malicious parser definitions

The CVE-2026-134814 vulnerability affects versions of the npm package prior to 2.3.1 and allows arbitrary code execution in the Node.js process. A fix is already available

· 2 min read

A critical vulnerability has been disclosed in binary-parser, a popular npm ecosystem library used to parse binary data in Node.js applications. The flaw allows an attacker who controls the parser definitions to execute arbitrary code on the server.

The information comes from The Hacker News.

The flaw

Tracked as CVE-2026-134814, with a CVSS severity score of 9.2 (or 8.1, depending on the version of the metric), the vulnerability is a code injection issue and affects binary-parser versions prior to 2.3.1.

According to the advisory published by the maintainer on November 11, the problem lay in certain user-controlled string options, which were inserted directly into the JavaScript code generated by the library without proper validation. The affected options are:

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

By supplying crafted values in these options, an attacker can execute arbitrary JavaScript inside the Node.js process when the parser is compiled.

Who is at risk

The risk exists when the parser definition can be influenced by an outside party. According to Keichi Takahashi, the library's maintainer, parsing untrusted binary data with a trusted parser definition is not affected.

In the patched version, these options are validated as identifier paths, such as foo or $parent.len. Expressions such as "len - 1" are rejected, and anyone who needs them should use a function instead.

An earlier incomplete fix

The new flaw can be seen as the result of an incomplete fix for CVE-2026-1245, another code injection vulnerability in the same library, patched in January 2026 and caused by insufficient validation of field names and encoding parameters.

What to do

The recommendation is to update binary-parser to the latest version. It is also worth checking whether it enters the project as an indirect dependency through other packages.

What this means for those who build software

Libraries that generate code at runtime are powerful, but they turn any poorly validated input into code execution. The case reinforces good practices for any team: never build definitions, queries, or code from external data without rigorous validation, keep dependencies up to date, and use auditing tools such as npm audit in the continuous integration pipeline.

Source: The Hacker News and the project's security advisory