Remote Code Execution (RCE) via String Literal Injection into math-codegen
Key facts
- Attack vector
- Network
- Privileges required
- None
- User interaction
- None
- Attack complexity
- Low
- Impact type
- Code execution
- Confidentiality · integrity · availability
- High · High · High
- Fix status
- Fixed
Attack profile from CVSS 3.1 · CNA. Fix status from CNA and GitHub. Impact type from CWE-94.
Summary
math-codegen generates code from mathematical expressions. Prior to version 0.4.3, 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. This issue has been patched in version 0.4.3.
Why it matters now
SSVC decision points
CISA ADP · SSVC 2.0.3
- Exploitation
- None
- Automatable
- Yes
- Technical impact
- Total
The decision (Track, Attend, Act) also depends on your mission and well-being impact; see CISA's SSVC guide.
Affected products
| Vendor | Product | Affected versions | Fixed in | Status | Source |
|---|---|---|---|---|---|
| mauriciopoppe | math-codegen | before 0.4.3 | 0.4.3 | Patch available | CNA |
| — | math-codegen (npm) | before 0.4.3 | 0.4.3 | Patch available | GHSA-p6x5-p4xf-cc4r |
- math-codegen Vendormauriciopoppe Affected before 0.4.3 Fixed in 0.4.3 Patch available CNA
- math-codegen (npm) Vendor— Affected before 0.4.3 Fixed in 0.4.3 Patch available GHSA-p6x5-p4xf-cc4r
CPE configurations NVD · 1
| CPE | Versions | Role | Vendor |
|---|---|---|---|
| cpe:2.3:a:mauriciopoppe:math-codegen:*:*:*:*:*:*:*:* | before 0.4.3 | Vulnerable | mauriciopoppe |
- cpe:2.3:a:mauriciopoppe:math-codegen:*:*:*:*:*:*:*:* Versions before 0.4.3 Vulnerable ·mauriciopoppe
Remediation
- Fix · CNA math-codegen (mauriciopoppe) Fixed in 0.4.3
- Fix · GHSA-p6x5-p4xf-cc4r math-codegen (npm) Fixed in 0.4.3 Advisory →
Timeline
- 2026-10-02 Threatist record created from CVE-2026-41507
- 2026-10-03 Alias added: GHSA-p6x5-p4xf-cc4r
- 2026-10-25 EPSS moved to the below the 50th percentile
References
Patch 1
Advisory 2
Sources
- CVE-2026-41507 · CVE Program
- CVE-2026-41507 · NVD
- FIRST EPSS
- GHSA-p6x5-p4xf-cc4r · GitHub Advisory Database · CC BY 4.0
This product uses the NVD API but is not endorsed or certified by the NVD. Sources and licences