High priorityDisclosed

Advisory · CVE-2026-134814

Code injection in binary-parser via crafted parser definitions

binary-parser before 2.3.1 passes string-typed parser options to code generation without validation, letting a parser definition built from untrusted input execute arbitrary JavaScript. CVSS 4.0 9.2.

Vendor
keichi
Product
binary-parser
Identifier / CWE
CVE-2026-134814
CWE-94
Action timing
Immediate
ELI5

Explain it like I’m five

The tool builds a little machine from a blueprint you hand it. If the blueprint comes from a stranger, the stranger can hide instructions in it that the machine runs as its own, so the stranger's code executes inside your program.

SIMPLIFIED_ATTACK_PATH04 STEPS
  1. 01Untrusted parser definition

    An application builds a binary-parser definition using values that come from an untrusted source.

  2. 02String option reaches code generation

    Crafted length, lengthInBytes, key, tag, offset, or namely() alias values are passed unvalidated by Context.generateOption().

  3. 03Injected JavaScript

    The crafted values are emitted into generated JavaScript when the parser is compiled.

  4. 04Code executes

    The injected JavaScript runs in the Node.js process with the application's privileges.

What happened

binary-parser before 2.3.1 contains a code injection vulnerability in how string-typed parser options are handled. Context.generateOption() passes values such as length, lengthInBytes, key, tag, offset, and namely() aliases into generated JavaScript without validation. An attacker who controls the parser definition can supply crafted values that execute arbitrary JavaScript in the Node.js process when the parser is compiled. The vulnerability scores CVSS 4.0 9.2 (CVSS 3.1 8.1).

The key precondition is attacker control of the parser definition. In the normal case, parser definitions are written by the application developer, not by remote users, so this is not a remotely exploitable flaw in every deployment. It becomes serious where parser definitions are assembled from untrusted input, such as user-supplied format descriptions or configuration.

What to do

  1. Inventory Node.js services and tools that depend on binary-parser, including transitive dependencies.
  2. Upgrade binary-parser to 2.3.1 or later.
  3. Audit where parser definitions are built: treat any definition assembled from user input, uploaded files, or external configuration as untrusted.
  4. Where definitions must come from untrusted sources, validate and allowlist the option values before they reach the parser, and avoid passing raw strings into length, key, tag, or offset fields.
  5. Review application logs and process behavior for unexpected code execution in services that parse untrusted binary formats.
  6. Confirm the deployed binary-parser version after patching.

Management note

This is a high-severity library flaw whose real-world impact depends on how the library is used. Teams that build parser definitions only from their own code face limited exposure; teams that let external input shape a parser definition have a code-execution path. The upgrade is cheap, so patch first and audit the definition sources second.