{"id":"CVE-2026-41507","aliases":["CVE-2026-41507","GHSA-p6x5-p4xf-cc4r"],"related":[],"kind":"vulnerability","state":"published","title":"Remote Code Execution (RCE) via String Literal Injection into math-codegen","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.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"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.","source":"cvelist"},{"lang":"en","text":"### 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.","format":"markdown","source":"ghsa"},{"lang":"es","text":"math-codegen genera código a partir de expresiones matemáticas. Antes de la versión 0.4.3, el contenido de cadena literal pasado a cg.parse() se inyecta textualmente en el cuerpo de una nueva Function() sin sanitización. Esto permite a un atacante ejecutar comandos de sistema arbitrarios cuando la entrada controlada por el usuario llega al analizador. Cualquier aplicación que exponga un punto final de evaluación matemática donde la entrada del usuario fluye hacia cg.parse() es vulnerable a RCE completo. Este problema ha sido parcheado en la versión 0.4.3.","source":"nvd"}],"published":"2026-04-17T22:31:45.000Z","modified":"2026-10-26T19:10:00.163Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H","score":9.8,"rating":"CRITICAL"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H","score":9.8,"rating":"CRITICAL"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H","score":9.8,"rating":"CRITICAL"}],"cwes":["CWE-94"],"affected":[{"ranges":[{"version":"< 0.4.3","status":"affected"}],"vendor":"mauriciopoppe","product":"math-codegen","source":"cvelist"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"0.4.3"}],"ecosystem":"npm","package":"math-codegen","purl":"pkg:npm/math-codegen","source":"ghsa"},{"ranges":[{"status":"affected","fixed":"0.4.3"}],"vendor":"mauriciopoppe","product":"math-codegen","cpe":"cpe:2.3:a:mauriciopoppe:math-codegen:*:*:*:*:*:*:*:*","source":"nvd"}],"references":[{"url":"https://github.com/mauriciopoppe/math-codegen/security/advisories/GHSA-p6x5-p4xf-cc4r","tags":["vendor-advisory","web","x-refsource-confirm"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/mauriciopoppe/math-codegen/pull/11","tags":["issue-tracking","web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/mauriciopoppe/math-codegen/commit/4bb52d3030683362b3559ee8dd91350555a05f6b","tags":["patch","web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-41507","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/hits3134","tags":["web"],"sources":["ghsa"]},{"url":"https://github.com/mauriciopoppe/math-codegen","tags":["package"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"none","automatable":"yes","technicalImpact":"total","date":"2026-05-08T14:20:14.868Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-41507","url":"https://www.cve.org/CVERecord?id=CVE-2026-41507","licence":"CVE Terms of Use","modified":"2026-05-08T14:20:21.285Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-p6x5-p4xf-cc4r","url":"https://github.com/advisories/GHSA-p6x5-p4xf-cc4r","licence":"CC-BY-4.0","modified":"2026-05-12T17:16:37.269Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-41507","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-41507","licence":"Public domain","modified":"2026-10-26T19:10:00.163Z"}],"updatedAt":"2026-11-25T22:59:20.971Z","epss":{"score":0.00672,"percentile":0.47138,"date":"2026-11-30T12:00:22.000Z"}}