The Definition Was Malicious. binary-parser Ran the Code.
A popular tool for reading binary data has a critical flaw — and the danger is not in the data it reads. It is in the instructions you hand it.
Security researchers have disclosed a critical code-injection vulnerability in binary-parser, a widely used npm library for parsing binary data in Node.js. Tracked as CVE-2026-134814 and carrying a CVSS score of 9.2, the flaw lets an attacker who controls a parser definition inject and execute arbitrary JavaScript inside the host Node.js process. Every version before 2.3.1 is affected; the fix landed in 2.3.1.
The trigger is deceptively ordinary. When a parser is compiled, binary-parser turns the definition into generated JavaScript code. Six string-typed options — length, lengthInBytes, key, tag, offset, and the alias passed to namely() — were inserted directly into that generated code without adequate validation. They passed through a function called Context.generateOption(), which took the strings at face value.
That is the whole attack. An attacker who can shape one of those options writes JavaScript into it, the library stitches it into the code it generates, and that code runs with the full privileges of the Node.js process the moment the parser is compiled.
How the injection works

Picture the flow as a funnel. On the left, six small inputs that look harmless, each one a string, each one trusted. In the middle, the library’s code generator weaves those strings into the JavaScript it builds to run the parser. On the right, the result: whatever the attacker wrote now executes as code — not when the parser reads hostile data, but when the parser itself is compiled.
That timing matters. Compilation happens once, up front, before a single byte of binary data is parsed. So the attack does not depend on feeding the application a malicious file. It depends on the application loading a malicious parser definition — from a dependency, a plugin, or a configuration file the developer never inspected.
Why this one matters
Binary-parser is the kind of library that hides in plain sight. It does one job well, it has been around for years, and it sits deep inside other people’s tools — exactly the sort of dependency nobody thinks to audit. That is also what makes the flaw’s history sting: CVE-2026-134814 is an incomplete fix for CVE-2026-1245, an earlier code-injection flaw (CVSS 6.5) patched in January 2026 after insufficient validation of field names and encoding parameters. The first repair closed some of the holes. The string options slipped through.
There is one important boundary to the risk. Maintainer Keichi Takahashi states it plainly: “Parsing untrusted binary data with a trusted parser definition is not affected.” If your parser definitions are your own, hostile data alone cannot trigger this flaw. The danger begins only when the definition itself comes from somewhere you do not control.
That distinction is the whole story of modern supply-chain risk. The data plane can be hostile and safe at the same time; the control plane — the definitions, the configs, the code that tells the tool what to do — is where trust actually lives. It is the same lesson as other supply-chain tricks that hide malicious code inside packages that look legitimate: the thing you install is rarely the thing that hurts you; the thing you trust without checking is.
The fix, and what changed
The maintainer released an advisory on November 11, 2026, and shipped the fix in binary-parser 2.3.1. The repair changes the rules for those string options: they are now validated as identifier paths — simple references such as foo or $parent.len. Expressions such as 'len - 1' are rejected; if you need computed values, use a function instead.
Upwind Security flagged the flaw on X, and users are advised to update to the latest version of the library.

Four checks to run now
1. Update to binary-parser 2.3.1 or later. This is the fix, and it is a one-line change in most projects. Check your lockfile, not just your package.json — the library often arrives as a dependency of a dependency. If anything in your tree pins an older version, upgrade it or push the maintainer of that package to do so.
2. Find every parser definition your code loads. Search your codebase and your dependencies for definitions, especially any generated, downloaded, or supplied by a plugin or a third-party module. Each one is a trust decision. If you cannot name who wrote a definition, treat it as untrusted until you can.
3. Treat parser definitions as code, not data. A definition is not a configuration file. It becomes JavaScript that runs in your process, so it deserves the same scrutiny as any other code you execute: review it, pin it, and never load one from an untrusted source at runtime.
4. Watch for the next incomplete fix. This flaw exists because the January patch did not cover every path. After updating, keep an eye on the library’s advisories, and remember that patch deadlines matter because attackers move fast once a flaw is public.
The lesson of CVE-2026-134814 is small enough to fit in one sentence: never let an attacker write the instructions your tools follow. Binary-parser did not fail because it parsed hostile data. It failed because it trusted the definition — and the definition was malicious.



















