Arbitrary Code Injection Affecting math-codegen package, versions <0.4.3


Severity

Recommended
0.0
critical
0
10

CVSS assessment by Snyk's Security Team. Learn more

Threat Intelligence

EPSS
0.04% (14th percentile)

Do your applications use this vulnerable package?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications

Snyk Learn

Learn about Arbitrary Code Injection vulnerabilities in an interactive lesson.

Start learning
  • Snyk IDSNYK-JS-MATHCODEGEN-16420747
  • published5 May 2026
  • disclosed17 Apr 2026
  • credithits3134

Introduced: 17 Apr 2026

NewCVE-2026-41507  (opens in a new tab)
CWE-94  (opens in a new tab)

How to fix?

Upgrade math-codegen to version 0.4.3 or higher.

Overview

math-codegen is a Generates code from mathematical expressions

Affected versions of this package are vulnerable to Arbitrary Code Injection via the parse function. An attacker can execute arbitrary code by supplying crafted input that is injected directly into a dynamically created function without proper sanitization.

Workaround

This vulnerability can be mitigated by avoiding the use of un-sanitized user input in the parser or by manually escaping string literals in the input.

CVSS Base Scores

version 4.0
version 3.1