2026-11-28 1:43CVE-2026-138117VulnCheck
PUBLISHED5.2CWE-95

HyperSpy before 2.6.0 Code Execution via sympy.sympify() in HSPY/ZSPY Files

HyperSpy from 1.2.0 before 2.6.0 contains a code execution vulnerability that allows attackers to run Python code by embedding malicious expression strings evaluated with sympy.sympify(). Attackers can craft .hspy or .zspy files with malicious axis, Expression component, or twin function expressions that execute when victims call hs.load() or restore models.

Problem type

Affected products

HyperSpy

HyperSpy

< 2.6.0 - AFFECTED

References

JSON source

https://cveawg.mitre.org/api/cve/CVE-2026-138117
Click to expand
{
  "dataType": "CVE_RECORD",
  "dataVersion": "5.2",
  "cveMetadata": {
    "cveId": "CVE-2026-138117",
    "assignerOrgId": "83251b91-4cc7-4094-a5c7-464a1b83ea10",
    "assignerShortName": "VulnCheck",
    "dateUpdated": "2026-11-28T01:43:09.488Z",
    "dateReserved": "2026-11-27T23:50:24.916Z",
    "datePublished": "2026-11-28T01:43:09.488Z",
    "state": "PUBLISHED"
  },
  "containers": {
    "cna": {
      "providerMetadata": {
        "orgId": "83251b91-4cc7-4094-a5c7-464a1b83ea10",
        "shortName": "VulnCheck",
        "dateUpdated": "2026-11-28T01:43:09.488Z"
      },
      "datePublic": "2026-11-27T00:00:00.000Z",
      "title": "HyperSpy before 2.6.0 Code Execution via sympy.sympify() in HSPY/ZSPY Files",
      "descriptions": [
        {
          "lang": "en",
          "value": "HyperSpy from 1.2.0 before 2.6.0 contains a code execution vulnerability that allows attackers to run Python code by embedding malicious expression strings evaluated with sympy.sympify(). Attackers can craft .hspy or .zspy files with malicious axis, Expression component, or twin function expressions that execute when victims call hs.load() or restore models."
        }
      ],
      "affected": [
        {
          "vendor": "HyperSpy",
          "product": "HyperSpy",
          "repo": "https://github.com/hyperspy/hyperspy",
          "defaultStatus": "unaffected",
          "versions": [
            {
              "version": "1.2.0",
              "status": "affected",
              "versionType": "semver",
              "lessThan": "2.6.0"
            }
          ]
        }
      ],
      "problemTypes": [
        {
          "descriptions": [
            {
              "lang": "en",
              "description": "Improper Neutralization of Directives in Dynamically Evaluated Code ('Eval Injection')",
              "cweId": "CWE-95",
              "type": "CWE"
            }
          ]
        }
      ],
      "references": [
        {
          "url": "https://github.com/hyperspy/hyperspy/security/advisories/GHSA-632c-gw75-99r3",
          "name": "GitHub Security Advisory (GHSA-632c-gw75-99r3)",
          "tags": [
            "vendor-advisory"
          ]
        },
        {
          "url": "https://github.com/hyperspy/hyperspy/commit/fe484c936b9a1d425813e145298f9eeb1d83abf6",
          "name": "Merge of PR #3703 (bounded expression parser)",
          "tags": [
            "patch"
          ]
        },
        {
          "url": "https://github.com/hyperspy/hyperspy/commit/973c9f9ce5937a022afe718f4f63c410eb96539e",
          "name": "fix(security): parse file-derived expressions with the bounded parser",
          "tags": [
            "patch"
          ]
        },
        {
          "url": "https://github.com/hyperspy/hyperspy/releases/tag/v2.6.0",
          "name": "HyperSpy v2.6.0 Release Notes",
          "tags": [
            "release-notes"
          ]
        },
        {
          "url": "https://github.com/hyperspy/hyperspy/issues/3699",
          "name": "GitHub issue #3699",
          "tags": [
            "issue-tracking"
          ]
        },
        {
          "url": "https://github.com/hyperspy/hyperspy/blob/v2.5.0/hyperspy/axes.py#L1031-L1071",
          "name": "FunctionalDataAxis.__init__ in axes.py (v2.5.0)",
          "tags": [
            "technical-description"
          ]
        },
        {
          "url": "https://github.com/hyperspy/hyperspy/blob/v2.5.0/hyperspy/_components/expression.py#L58-L66",
          "name": "_parse_substitutions in expression.py (v2.5.0)",
          "tags": [
            "technical-description"
          ]
        },
        {
          "url": "https://github.com/hyperspy/hyperspy/blob/v2.5.0/hyperspy/component.py#L205-L217",
          "name": "twin_function_expr setter in component.py (v2.5.0)",
          "tags": [
            "technical-description"
          ]
        },
        {
          "url": "https://www.vulncheck.com/advisories/hyperspy-before-2.6.0-code-execution-via-sympy-sympify-in-hspy-zspy-files",
          "name": "VulnCheck Advisory: HyperSpy before 2.6.0 Code Execution via sympy.sympify() in HSPY/ZSPY Files",
          "tags": [
            "third-party-advisory"
          ]
        }
      ],
      "metrics": [
        {
          "format": "CVSS"
        },
        {
          "format": "CVSS",
          "cvssV3_1": {
            "version": "3.1",
            "vectorString": "CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H",
            "attackVector": "LOCAL",
            "attackComplexity": "LOW",
            "privilegesRequired": "NONE",
            "userInteraction": "REQUIRED",
            "scope": "UNCHANGED",
            "confidentialityImpact": "HIGH",
            "integrityImpact": "HIGH",
            "availabilityImpact": "HIGH",
            "baseScore": 7.8,
            "baseSeverity": "HIGH"
          }
        }
      ],
      "credits": [
        {
          "lang": "en",
          "value": "Dilanka Kaushal Hewage",
          "type": "finder"
        },
        {
          "lang": "en",
          "value": "Nils Jordan",
          "type": "finder"
        }
      ]
    }
  }
}