CVE-2026-12866

expr-eval: expr-eval: Code Execution via crafted expressions in toJSFunction() API

Published Jun 23, 2026 CVSS 4.0 · 9.2 Critical EPSS < 1% KEV · Not listed
Description
All versions of the package expr-eval are vulnerable to Code Execution via the toJSFunction() API. An attacker can execute arbitrary JavaScript by supplying crafted expressions that are compiled into native code using new Function(). Because user-controlled expressions are transformed directly into executable JavaScript, attackers can escape the intended expression sandbox and run arbitrary code within the application's context.

Analysis

AI-generated

Technical impact

The vulnerability lies in the expr‑eval library’s toJSFunction API, which converts user‑supplied expression strings into native JavaScript code via new Function. Because the conversion occurs without sanitisation, an attacker can supply a crafted expression that turns into executable JavaScript, escaping the intended sandbox. The result is arbitrary code execution within the process that loads the library, as defined by the CWE‑94 and CWE‑917 classifications.

Affected Systems

All released versions of expr‑eval, a JavaScript expression evaluator library commonly used in web and Node.js applications, are affected. Any project that imports the npm package expr‑eval and exposes the toJSFunction interface to untrusted input, regardless of vendor, is vulnerable. The issue is present across all major releases up to and including the latest published version at the time of disclosure.

Risk and Exploitability

The CVSS score of 9.2 categorises the flaw as critical, signalling that exploitation would grant full control over the target environment. The EPSS score of 0.00454 indicates a very low exploitation probability. The absence of a KEV listing does not reduce the urgency, because the flaw permits direct execution. Attackers would most likely target applications that evaluate expressions from external sources, such as user‑configurable scripts or validation rules; the code path is reachable as soon as toJSFunction is called with crafted input.

Remediation

No solution or workaround provided in the CVE record.

OpenCVE Recommended Actions

  • Upgrade the expr‑eval library to the most recent release that removes or hardens the toJSFunction API; the patch is available in the GitHub repository and the npm registry.
  • If the application cannot be updated, refactor the code to eliminate calls to toJSFunction, or replace it with a safely configured alternative that does not execute arbitrary JavaScript.
  • Apply strict input validation or a whitelist of permissible operators before passing expressions to the library, ensuring that only non‑executable fragments are allowed.

Generated by OpenCVE AI on June 25, 2026 at 02:02 UTC.

Tracking

Sign in to view the affected projects.

Advisories

Source ID Title
Github GHSA Github GHSA GHSA-q9v2-7m5w-4693 expr-eval vulnerable to Code Execution
History
Type Values Removed Values Added
Title Code Execution Vulnerability in Expr-eval toJSFunction API expr-eval: expr-eval: Code Execution via crafted expressions in toJSFunction() API
Weaknesses CWE-917
References
Metrics threat_severity

None

threat_severity

Low

Type Values Removed Values Added
First Time appeared Silentmatt
Silentmatt expr-eval
Vendors & Products Silentmatt
Silentmatt expr-eval
Type Values Removed Values Added
Metrics ssvc

{'options': {'Automatable': 'yes', 'Exploitation': 'poc', 'Technical Impact': 'total'}, 'version': '2.0.3'}

Type Values Removed Values Added
Title Code Execution Vulnerability in Expr-eval toJSFunction API
Type Values Removed Values Added
Description All versions of the package expr-eval are vulnerable to Code Execution via the toJSFunction() API. An attacker can execute arbitrary JavaScript by supplying crafted expressions that are compiled into native code using new Function(). Because user-controlled expressions are transformed directly into executable JavaScript, attackers can escape the intended expression sandbox and run arbitrary code within the application's context.
Weaknesses CWE-94
References
Metrics cvssV3_1

{'score': 9.8, 'vector': 'CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H'}

cvssV4_0

{'score': 9.2, 'vector': 'CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N'}

Weaknesses
  • CWE-917

    Improper Neutralization of Special Elements used in an Expression Language Statement ('Expression Language Injection')

  • CWE-94

    Improper Control of Generation of Code ('Code Injection')

Sources

Status
PUBLISHED
Assigner
snyk
Published
Updated
Aug 14, 2026, 3:25 PM
Reserved
Jun 22, 2026, 8:22 AM
Status
Deferred
Published
Jun 23, 2026, 5:17 AM
Modified
Jul 7, 2026, 7:16 PM
Severity
Low
Public date
Jun 23, 2026, 5:00 AM