{"id":"CVE-2026-41507","aliases":["EUVD-2026-28597","GHSA-p6x5-p4xf-cc4r"],"status":"published","title":"Remote Code Execution (RCE) via String Literal Injection into math-codegen","description":"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.","severity":{"version":"3.1","score":9.8,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H","level":"critical","assessor":"cna","from":"cve"},"epss":{"day":"2026-11-10","score":0.00393,"percentile":0.33795,"model":"v2026.06.15"},"facts":{"in_kev":false,"known_exploited":false,"public_exploit":false,"fix_available":true},"cwes":["CWE-94"],"published":"2026-04-17T22:31:45Z","modified":"2026-10-28T02:30:22Z","fixes":[{"ecosystem":"npm","package":"math-codegen","fixed_in":["0.4.3"],"sources":["ghsa","osv"]}],"affected":[{"source":"ghsa","ecosystem":"npm","package":"math-codegen","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"0.4.3"}]}]},{"source":"osv","ecosystem":"npm","package":"math-codegen","ranges":[{"type":"SEMVER","events":[{"introduced":"0"},{"fixed":"0.4.3"}]}]}],"products":[{"vendor":"mauriciopoppe","product":"math-codegen"}],"references":[{"url":"https://github.com/mauriciopoppe/math-codegen/security/advisories/GHSA-p6x5-p4xf-cc4r","tags":["x_refsource_CONFIRM","Vendor Advisory","advisory","web"]},{"url":"https://github.com/mauriciopoppe/math-codegen/pull/11","tags":["x_refsource_MISC","Issue Tracking","fix","web"]},{"url":"https://github.com/mauriciopoppe/math-codegen/commit/4bb52d3030683362b3559ee8dd91350555a05f6b","tags":["x_refsource_MISC","Patch","fix","web"]},{"url":"https://github.com/hits3134","tags":["web"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-41507","tags":["advisory"]},{"url":"https://github.com/advisories/GHSA-p6x5-p4xf-cc4r"},{"url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/41xxx/CVE-2026-41507.json","tags":["advisory"]},{"url":"https://github.com/mauriciopoppe/math-codegen","tags":["package"]}],"sources":{"cve":[{"id":"CVE-2026-41507","title":"Remote Code Execution (RCE) via String Literal Injection into math-codegen","description":"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.","status":"published","published":"2026-05-08T13:49:34.091Z","modified":"2026-05-08T14:20:21.285Z","cvss":[{"version":"3.1","score":9.8,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H","level":"critical","assessor":"cna"}],"cwes":["CWE-94"],"updated_at":"2026-11-02T13:40:57.334596Z"}],"euvd":[{"id":"EUVD-2026-28597","description":"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.","status":"published","published":"2026-05-08T13:49:34Z","modified":"2026-05-08T14:20:21Z","cvss":[{"version":"3.1","score":9.8,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H","level":"critical"}],"updated_at":"2026-11-02T19:05:14.505765Z"}],"ghsa":[{"id":"GHSA-p6x5-p4xf-cc4r","title":"Remote Code Execution (RCE) via String Literal Injection into math-codegen","description":"### Impact\n\nString 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.\n    \n### Patches\n\nThe 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.\n    \n### Workarounds\n\nAvoid passing un-sanitized user input to the parser or manually escape string literals in the input.","status":"published","published":"2026-04-17T22:31:45Z","modified":"2026-05-12T13:32:45Z","cvss":[{"version":"3.1","score":9.8,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H","level":"critical"}],"cwes":["CWE-94"],"updated_at":"2026-11-02T14:40:07.01746Z"}],"nvd":[{"id":"CVE-2026-41507","description":"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.","status":"published","published":"2026-05-08T14:16:34.133Z","modified":"2026-10-26T19:10:00.163Z","cvss":[{"version":"3.1","score":9.8,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H","level":"critical","assessor":"secondary"}],"cwes":["CWE-94"],"updated_at":"2026-11-02T14:12:17.842772Z"}],"osv":[{"id":"CVE-2026-41507","title":"Remote Code Execution (RCE) via String Literal Injection into math-codegen","description":"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.","status":"published","published":"2026-05-08T13:49:34.091Z","modified":"2026-10-28T02:30:22.994226221Z","cvss":[{"version":"3.1","score":9.8,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H","level":"critical"}],"cwes":["CWE-94"],"updated_at":"2026-11-02T15:45:03.764807Z"},{"id":"GHSA-p6x5-p4xf-cc4r","title":"Remote Code Execution (RCE) via String Literal Injection into math-codegen","description":"### Impact\n\nString 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.\n    \n### Patches\n\nThe 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.\n    \n### Workarounds\n\nAvoid passing un-sanitized user input to the parser or manually escape string literals in the input.","status":"published","published":"2026-04-17T22:31:45Z","modified":"2026-05-12T17:16:37.269274Z","cvss":[{"version":"3.1","score":9.8,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H","level":"critical"}],"cwes":["CWE-94"],"updated_at":"2026-11-02T15:46:52.891208Z"}]}}
