FineShot.AI
•3 min read

binary-parser (CVE-2026-134814): The npm Code-Injection Bug npm audit Missed, and the Fix

What if a simple text setting could run code inside your Node.js app? In the popular npm library binary-parser (about 31,000 downloads a week), it could. CVE-2026-134814 is a code-injection bug rated CVSS 9.2.

Short answer: run npm ls binary-parser. Anything below 2.3.1 is affected, so upgrade to 2.3.1 or later. And don’t rely on npm audit alone: on the day of my demo it said “found 0 vulnerabilities” on the affected version.

Watch the video

What binary-parser does, the bug, and a real demo project: check, a harmless test, and the fix.

What is binary-parser?

binary-parser reads raw bytes: network packets, file headers, sensor data. You describe the format once, and it parses bytes for you. To be fast, it turns your parser definition into JavaScript and compiles it with new Function, so it doesn’t have to read your description again while parsing.

The bug

String options such as length, lengthInBytes, key, tag, offset and the namely() alias were pasted into that generated code with no check. So if someone else can shape your parser definition, their text becomes code in your app.

This happened before: CVE-2026-1245 (“ParserPoison”), fixed in 2.3.0. The new bug covers options that fix missed.

Am I at risk?

Both must be true:

  1. You use binary-parser older than 2.3.1, directly or through another package.
  2. Someone you don’t fully trust can influence the parser definition (JSON formats, uploads, plugins, a database).

Parsing untrusted bytes with a definition you wrote yourself is not affected. That’s the normal use, per the maintainer’s statement in the advisory.

Check, see it, fix it

What I ran in a throwaway demo project (Node.js 24):

npm ls binary-parser                  # find it in every project
npm audit                             # said "found 0 vulnerabilities" on 2.3.0 (23 Nov 2026)
npm install binary-parser@2.3.1       # the fix
npm ls binary-parser

The harmless test: a string option like length: "len - 1" is pasted straight into the generated code on 2.3.0. On 2.3.1 it’s rejected with Invalid reference. No attack payload is shown or shared.

Your checklist

  1. Find it in every project: npm ls binary-parser.
  2. Upgrade: npm install binary-parser@2.3.1 (or later).
  3. Pulled in by another package? Add an npm overrides entry for binary-parser ^2.3.1, then run your tests.
  4. Find where your parser definitions come from. Keep them in your repo, never from users.
  5. Replace string expressions with functions: length: function () { return this.len - 1; }
  6. Don’t trust npm audit alone, and test upgrades on staging first.

Version 3.0.0 is out too, but it’s ESM-only and needs Node 22.12+. 2.3.1 is the easy jump.

Everything was run in a throwaway demo project on my own machine. Only a harmless test is shown. Understand each command and act at your own risk.

Summary

  • The bug: string parser options were pasted into generated JavaScript with no check.
  • At risk: binary-parser < 2.3.1 where untrusted input shapes the parser definition.
  • Fix: 2.3.1+, functions instead of string expressions, and definitions only from your own code.

Credits: CVE-2026-134814 found by Zachariah Mithani (AploSec). CVE-2026-1245 found by Maor Caplan (Alma Security). Thanks to maintainer Keichi Takahashi for the quick fix.

Sources: GitHub advisory GHSA-xmxc-6c22-m377 · CVE record · VulnCheck · The Hacker News · v2.3.1 release · CERT/CC VU#102648


More on YouTube

Prefer watching? The full binary-parser walkthrough is on our YouTube channel: watch the video. For more hands-on breakdowns of security bugs, Linux servers and dev tools, subscribe at youtube.com/@fineshotai.