HyperSpy Code Execution Vulnerabilities
2026-11-28
Arbitrary Python code execution in HyperSpy affects both the 1.x series (1.2.0 through 1.7.6) and 2.x (2.0.0 through 2.5.0): file-supplied mathematical expressions are passed to sympy.sympify(), which evaluates strings with real Python builtins, so a crafted .hspy or .zspy file can run attacker code in the analyst's session when a victim calls hs.load() or restores a stored model. Exploitation is local and requires the victim to actively open or restore the crafted artifact (CVSS 3.1: 7.8, AV:L/UI:R; no attacker authentication, PR:N), and lazy=True offers no protection because axis construction and metadata parsing still occur during loading. There is no KEV listing and no confirmed active exploitation, but a public PoC reference exists in the vendor advisory and issue #3699, and the fix is HyperSpy 2.6.0 with coordinated RosettaSciIO fixed versions.
Restoring a crafted HyperSpy stored model (.hspy or .zspy) can execute arbitrary Python code with the victim's privileges, because component `_class_dump` data and `fn`-flagged `_whitelist` entries are passed to `cloudpickle.loads()` (dill on the 1.x line) during model reconstruction. Affected are HyperSpy 2.0.0 through 2.5.0 and the source-confirmed 1.x range 1.4.0 through 1.7.6; the trigger is reached through `models.restore()`/`models.pop()` or `create_model()` from an untrusted dictionary, not by an ordinary `hs.load()` alone, and the vector (AV:L, UI:P/UI:R, PR:N) confirms a local, user-interaction-dependent path where the malicious model file must be delivered to and opened by the victim. A public proof-of-concept that exercises the real `reconstruct_object()` boundary with a benign marker file is documented in the vendor advisory; no confirmed active exploitation, CISA KEV listing, or EPSS score was provided in the source data, and the vendor fix in 2.6.0 denies pickled legacy content by default with `UnsafeLegacyContent`.