criticalCVSS 9.8Vulnerability

GHSA-p6x5-p4xf-cc4r

### Impact String literal content passed to `cg.parse()` is injected verbatim into a `new Function()` body without sanitization. This allows an attacker to execute arbitrary system commands when user-controlled input reaches the parser. Any application exposing a math evaluation endpoint where user input flows into `cg.parse()` is vulnerable to full RCE. ### Patches The vulnerability is addressed by using `JSON.stringify()` on string literal values in `lib/node/ConstantNode.js` to ensure they are treated as data rather than code. Users should upgrade to version 0.4.3 or later. ### Workarounds Avoid passing un-sanitized user input to the parser or manually escape string literals in the input.

Properties

ghsa_id
GHSA-p6x5-p4xf-cc4r
severity
critical
summary
Remote Code Execution (RCE) via String Literal Injection into math-codegen
cvss_score
9.8
cve_id
GHSA-p6x5-p4xf-cc4r
cvss_vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
is_ghsa_only
true
ghsa_published
2026-04-17T22:31:45Z
source_url
https://github.com/advisories/GHSA-p6x5-p4xf-cc4r
ghsa_updated
2026-04-17T22:31:49Z

Related Entities (4)

REPORTED_BY (1)

[Source]GitHub Advisory Database

VULNERABLE_TO (1)

[Software]npm/math-codegen

AFFECTS (1)

[Software]npm/math-codegen

HAS_WEAKNESS (1)

[Weakness]Improper Control of Generation of Code ('Code Injection')

Explore deeper with Ninja Signal's threat intelligence graph

GHSA-p6x5-p4xf-cc4r (CVSS 9.8) — Ninja Signal Threat Intelligence | Ninja Signal