CVE-2025-12735: Expr eval Expr-eval Does Not Restrict Functions Vulnerability

HIGH
Advisory Identifier: GHSA-jc85-fpwf-qm7x
CWE-94
Published
Advisory Summary

CVE-2025-12735 is a HIGH expr-eval does not restrict functions vulnerability (CWE-94: Improper Control of Generation of Code ('Code Injection')) affecting Expr eval libraries in the npm ecosystem. The issue involves expr-eval does not restrict functions passed to the evaluate function. Remediation is available by upgrading affected packages to version 3.0.1.

CVE-2025-12735 at a Glance

CVE Identifier CVE-2025-12735
GHSA Identifier GHSA-jc85-fpwf-qm7x
Severity HIGH
CVSS v3.1 Base Score N/A
CWE Classification CWE-94: Improper Control of Generation of Code ('Code Injection')
Affected Product Expr eval
Package Ecosystem npm
Published Date
Last Updated

How to Fix CVE-2025-12735

To remediate this vulnerability, upgrade all affected Expr eval dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

expr-eval fixed: Latest secure release
npm install expr-eval@Latest secure release
expr-eval-fork fixed: 3.0.1
npm install expr-eval-fork@3.0.1
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

npm ls expr-eval

How to Check if You Are Affected

To determine whether your Node.js application is affected by CVE-2025-12735, inspect your project dependencies using npm:

npm ls expr-eval

Analyze the terminal output to locate any version of Expr eval in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 3.0.1), your application is affected.

Note: The npm ls expr-eval command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-94: Improper Control of Generation of Code ('Code Injection'), where the product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment. In Expr eval, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

The expr-eval library is a JavaScript expression parser and evaluator designed to safely evaluate mathematical expressions with user-defined variables. However, due to insufficient input validation, an attacker can pass a crafted variables object into the evaluate() function and trigger arbitrary code execution.

CVE-2025-12735 Affected Expr eval Versions

2 component(s)
Fixed Versions:
3.0.1
Product / Package Ecosystem Affected Versions Fixed Version
expr-eval
npm
≤ 2.0.2
expr-eval-fork
npm
< 3.0.1
3.0.1

References

Frequently Asked Questions

What is CVE-2025-12735?
CVE-2025-12735 is a security vulnerability in Expr eval involving expr-eval does not restrict functions passed to the evaluate function under CWE-94: Improper Control of Generation of Code ('Code Injection').
Which Expr eval versions are affected?
Affected versions include releases prior to 3.0.1 across affected packages: expr-eval, expr-eval-fork.
What version fixes CVE-2025-12735?
Upgrading to 3.0.1 (or the latest patched release for your respective branch) resolves the vulnerability.
Is expr-eval affected?
Yes, expr-eval is affected in releases prior to Latest secure release. Upgrade your dependency to Latest secure release or later.
Is expr-eval-fork affected?
Yes, expr-eval-fork is affected in releases prior to 3.0.1. Upgrade your dependency to 3.0.1 or later.
What CWE is associated with CVE-2025-12735?
CVE-2025-12735 is classified under CWE-94: Improper Control of Generation of Code ('Code Injection') (The product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment.).
How can I check npm dependencies for CVE-2025-12735?
Run the dependency tree command: 'npm ls expr-eval'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-jc85-fpwf-qm7x",
  "modified" : "2025-12-09T15:33:15Z",
  "published" : "2025-11-05T03:30:23Z",
  "aliases" : [ "CVE-2025-12735" ],
  "summary" : "expr-eval does not restrict functions passed to the evaluate function",
  "details" : "The expr-eval library is a JavaScript expression parser and evaluator designed to safely evaluate mathematical expressions with user-defined variables. However, due to insufficient input validation, an attacker can pass a crafted variables object into the evaluate() function and trigger arbitrary code execution.",
  "severity" : [ {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:L/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "expr-eval"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "last_affected" : "2.0.2"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "npm",
      "name" : "expr-eval-fork"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "3.0.1"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 3.0.0"
    }
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2025-12735"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/silentmatt/expr-eval/pull/288"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/silentmatt/expr-eval/pull/289"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/jorenbroekema/expr-eval/commit/1d71bb2ca8f98df8de00e9cc4de8fdd468a7ad43"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/jorenbroekema/expr-eval"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/jorenbroekema/expr-eval/blob/460b820ba01c5aca6c5d84a7d4f1fa5d1913c67b/test/security.js"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/silentmatt/expr-eval"
  }, {
    "type" : "WEB",
    "url" : "https://kb.cert.org/vuls/id/263614"
  }, {
    "type" : "WEB",
    "url" : "https://www.kb.cert.org/vuls/id/263614"
  }, {
    "type" : "WEB",
    "url" : "https://www.npmjs.com/package/expr-eval"
  }, {
    "type" : "WEB",
    "url" : "https://www.npmjs.com/package/expr-eval-fork"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-94" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2025-11-05T18:46:50Z",
    "nvd_published_at" : "2025-11-05T01:15:33Z"
  }
}