← Back to CVE Explorer

CVE-2026-41507

Full vulnerability record from the local CVENow database.

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.

Severity
CRITICAL
CVSS score
9.8 (v3.1)
Vulnerability status
Analyzed
Source identifier
Published
2026-05-08 14:16:34.133000
Last modified
2026-10-26 19:10:00.163000
View original CVE JSON
{
  "id": "CVE-2026-41507",
  "sourceIdentifier": "[email protected]",
  "published": "2026-05-08T14:16:34.133",
  "lastModified": "2026-10-26T19:10:00.163",
  "vulnStatus": "Analyzed",
  "cveTags": [],
  "descriptions": [
    {
      "lang": "en",
      "value": "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."
    },
    {
      "lang": "es",
      "value": "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."
    }
  ],
  "affected": [
    {
      "source": "[email protected]",
      "affectedData": [
        {
          "vendor": "mauriciopoppe",
          "product": "math-codegen",
          "versions": [
            {
              "version": "< 0.4.3",
              "status": "affected"
            }
          ]
        }
      ]
    }
  ],
  "metrics": {
    "cvssMetricV31": [
      {
        "source": "[email protected]",
        "type": "Secondary",
        "cvssData": {
          "version": "3.1",
          "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H",
          "baseScore": 9.8,
          "baseSeverity": "CRITICAL",
          "attackVector": "NETWORK",
          "attackComplexity": "LOW",
          "privilegesRequired": "NONE",
          "userInteraction": "NONE",
          "scope": "UNCHANGED",
          "confidentialityImpact": "HIGH",
          "integrityImpact": "HIGH",
          "availabilityImpact": "HIGH"
        },
        "exploitabilityScore": 3.9,
        "impactScore": 5.9
      }
    ],
    "ssvcV203": [
      {
        "source": "134c704f-9b21-4f2e-91b3-4a467353bcc0",
        "ssvcData": {
          "timestamp": "2026-05-08T14:20:14.868190Z",
          "id": "CVE-2026-41507",
          "options": [
            {
              "exploitation": "none"
            },
            {
              "automatable": "yes"
            },
            {
              "technicalImpact": "total"
            }
          ],
          "role": "CISA Coordinator",
          "version": "2.0.3"
        }
      }
    ]
  },
  "weaknesses": [
    {
      "source": "[email protected]",
      "type": "Secondary",
      "description": [
        {
          "lang": "en",
          "value": "CWE-94"
        }
      ]
    }
  ],
  "configurations": [
    {
      "nodes": [
        {
          "operator": "OR",
          "negate": false,
          "cpeMatch": [
            {
              "vulnerable": true,
              "criteria": "cpe:2.3:a:mauriciopoppe:math-codegen:*:*:*:*:*:*:*:*",
              "versionEndExcluding": "0.4.3",
              "matchCriteriaId": "8965334E-695A-4505-BADF-4FDDD9C14CC4"
            }
          ]
        }
      ]
    }
  ],
  "references": [
    {
      "url": "https://github.com/mauriciopoppe/math-codegen/commit/4bb52d3030683362b3559ee8dd91350555a05f6b",
      "source": "[email protected]",
      "tags": [
        "Patch"
      ]
    },
    {
      "url": "https://github.com/mauriciopoppe/math-codegen/pull/11",
      "source": "[email protected]",
      "tags": [
        "Issue Tracking"
      ]
    },
    {
      "url": "https://github.com/mauriciopoppe/math-codegen/security/advisories/GHSA-p6x5-p4xf-cc4r",
      "source": "[email protected]",
      "tags": [
        "Vendor Advisory"
      ]
    }
  ]
}