CVE-2026-41507: CWE-94: Improper Control of Generation of Code ('Code Injection') in mauriciopoppe math-codegen
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.
AI Analysis
Technical Summary
The mauriciopoppe math-codegen library generates code from mathematical expressions. Before version 0.4.3, it improperly handled string literals passed to the cg.parse() function by injecting them verbatim into a new Function() body without sanitization. This improper control of code generation (CWE-94) enables attackers to execute arbitrary system commands when user input is passed to the parser, leading to full remote code execution. The vulnerability has a CVSS 3.1 base score of 9.8, indicating critical severity. The issue is fixed in version 0.4.3.
Potential Impact
Exploitation of this vulnerability allows an unauthenticated attacker to achieve full remote code execution on any application that exposes a math evaluation endpoint where user input is passed to cg.parse(). This can lead to complete system compromise, data loss, or further attacks. There are no known exploits in the wild at this time.
Mitigation Recommendations
Upgrade to mauriciopoppe math-codegen version 0.4.3 or later, where this vulnerability has been patched. Applications using affected versions should immediately update to the fixed version to prevent exploitation. Patch status is not explicitly stated in a vendor advisory, but the description confirms the issue is fixed in version 0.4.3.
CVE-2026-41507: CWE-94: Improper Control of Generation of Code ('Code Injection') in mauriciopoppe 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.
AI-Powered Analysis
Machine-generated threat intelligence
Technical Analysis
The mauriciopoppe math-codegen library generates code from mathematical expressions. Before version 0.4.3, it improperly handled string literals passed to the cg.parse() function by injecting them verbatim into a new Function() body without sanitization. This improper control of code generation (CWE-94) enables attackers to execute arbitrary system commands when user input is passed to the parser, leading to full remote code execution. The vulnerability has a CVSS 3.1 base score of 9.8, indicating critical severity. The issue is fixed in version 0.4.3.
Potential Impact
Exploitation of this vulnerability allows an unauthenticated attacker to achieve full remote code execution on any application that exposes a math evaluation endpoint where user input is passed to cg.parse(). This can lead to complete system compromise, data loss, or further attacks. There are no known exploits in the wild at this time.
Mitigation Recommendations
Upgrade to mauriciopoppe math-codegen version 0.4.3 or later, where this vulnerability has been patched. Applications using affected versions should immediately update to the fixed version to prevent exploitation. Patch status is not explicitly stated in a vendor advisory, but the description confirms the issue is fixed in version 0.4.3.
Technical Details
- Data Version
- 5.2
- Assigner Short Name
- GitHub_M
- Date Reserved
- 2026-04-20T18:18:50.681Z
- Cvss Version
- 3.1
- State
- PUBLISHED
- Remediation Level
- null
Threat ID: 69fdede4cbff5d8610dd27ad
Added to database: 5/8/2026, 2:06:28 PM
Last enriched: 5/8/2026, 2:22:28 PM
Last updated: 5/9/2026, 3:47:17 AM
Views: 5
Community Reviews
0 reviewsCrowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.
Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.
Actions
Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.
Need more coverage?
Upgrade to Pro Console for AI refresh and higher limits.
For incident response and remediation, OffSeq services can help resolve threats faster.
Latest Threats
Check if your credentials are on the dark web
Instant breach scanning across billions of leaked records. Free tier available.