HyperSpy from 1.4.0 before 2.6.0 contains an insecure deserialization vulnerability that allows attackers to execute arbitrary Python code by supplying crafted stored-model data in .hspy or .zspy files. Attackers can embed a malicious pickle payload in a component's _class_dump or a 'fn'-flagged _whitelist entry, which cloudpickle.loads() (dill in 1.x) runs when the victim restores the model.
PUBLISHED5.2CWE-502
HyperSpy 1.4.0 before 2.6.0 Insecure Deserialization RCE via Stored Model Restoration
Problem type
Affected products
HyperSpy
HyperSpy
< 2.6.0 - AFFECTED
References
GitHub Security Advisory (GHSA-j975-x368-3hrr)
https://github.com/hyperspy/hyperspy/security/advisories/GHSA-j975-x368-3hrr
Merge of PR #3704 (require trust for pickled model content)
https://github.com/hyperspy/hyperspy/commit/6382ae0ff5b0000a7aad5dc2f4b997b1d8dccb09
Require explicit trust to restore pickled model components
https://github.com/hyperspy/hyperspy/commit/28fdf2d0320c76c5d57a57e323ac510b2005e13d
HyperSpy v2.6.0 Release Notes
https://github.com/hyperspy/hyperspy/releases/tag/v2.6.0
GitHub issue #3699
https://github.com/hyperspy/hyperspy/issues/3699
reconstruct_component in model.py (v2.5.0)
https://github.com/hyperspy/hyperspy/blob/v2.5.0/hyperspy/model.py#L106-L146
Model._load_dictionary in model.py (v2.5.0)
https://github.com/hyperspy/hyperspy/blob/v2.5.0/hyperspy/model.py#L645-L661
reconstruct_object in export_dictionary.py (v2.5.0)
https://github.com/hyperspy/hyperspy/blob/v2.5.0/hyperspy/misc/export_dictionary.py#L187-L207
VulnCheck Advisory: HyperSpy 1.4.0 before 2.6.0 Insecure Deserialization RCE via Stored Model Restoration
https://www.vulncheck.com/advisories/hyperspy-1.4.0-before-2.6.0-insecure-deserialization-rce-via-stored-model-restoration
JSON source
https://cveawg.mitre.org/api/cve/CVE-2026-138118Click to expand
{
"dataType": "CVE_RECORD",
"dataVersion": "5.2",
"cveMetadata": {
"cveId": "CVE-2026-138118",
"assignerOrgId": "83251b91-4cc7-4094-a5c7-464a1b83ea10",
"assignerShortName": "VulnCheck",
"dateUpdated": "2026-11-28T01:43:08.379Z",
"dateReserved": "2026-11-27T23:50:31.898Z",
"datePublished": "2026-11-28T01:43:08.379Z",
"state": "PUBLISHED"
},
"containers": {
"cna": {
"providerMetadata": {
"orgId": "83251b91-4cc7-4094-a5c7-464a1b83ea10",
"shortName": "VulnCheck",
"dateUpdated": "2026-11-28T01:43:08.379Z"
},
"datePublic": "2026-11-27T00:00:00.000Z",
"title": "HyperSpy 1.4.0 before 2.6.0 Insecure Deserialization RCE via Stored Model Restoration",
"descriptions": [
{
"lang": "en",
"value": "HyperSpy from 1.4.0 before 2.6.0 contains an insecure deserialization vulnerability that allows attackers to execute arbitrary Python code by supplying crafted stored-model data in .hspy or .zspy files. Attackers can embed a malicious pickle payload in a component's _class_dump or a 'fn'-flagged _whitelist entry, which cloudpickle.loads() (dill in 1.x) runs when the victim restores the model."
}
],
"affected": [
{
"vendor": "HyperSpy",
"product": "HyperSpy",
"repo": "https://github.com/hyperspy/hyperspy",
"defaultStatus": "unaffected",
"versions": [
{
"version": "1.4.0",
"status": "affected",
"versionType": "semver",
"lessThan": "2.6.0"
}
]
}
],
"problemTypes": [
{
"descriptions": [
{
"lang": "en",
"description": "Deserialization of Untrusted Data",
"cweId": "CWE-502",
"type": "CWE"
}
]
}
],
"references": [
{
"url": "https://github.com/hyperspy/hyperspy/security/advisories/GHSA-j975-x368-3hrr",
"name": "GitHub Security Advisory (GHSA-j975-x368-3hrr)",
"tags": [
"vendor-advisory"
]
},
{
"url": "https://github.com/hyperspy/hyperspy/commit/6382ae0ff5b0000a7aad5dc2f4b997b1d8dccb09",
"name": "Merge of PR #3704 (require trust for pickled model content)",
"tags": [
"patch"
]
},
{
"url": "https://github.com/hyperspy/hyperspy/commit/28fdf2d0320c76c5d57a57e323ac510b2005e13d",
"name": "Require explicit trust to restore pickled model components",
"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/model.py#L106-L146",
"name": "reconstruct_component in model.py (v2.5.0)",
"tags": [
"technical-description"
]
},
{
"url": "https://github.com/hyperspy/hyperspy/blob/v2.5.0/hyperspy/model.py#L645-L661",
"name": "Model._load_dictionary in model.py (v2.5.0)",
"tags": [
"technical-description"
]
},
{
"url": "https://github.com/hyperspy/hyperspy/blob/v2.5.0/hyperspy/misc/export_dictionary.py#L187-L207",
"name": "reconstruct_object in export_dictionary.py (v2.5.0)",
"tags": [
"technical-description"
]
},
{
"url": "https://www.vulncheck.com/advisories/hyperspy-1.4.0-before-2.6.0-insecure-deserialization-rce-via-stored-model-restoration",
"name": "VulnCheck Advisory: HyperSpy 1.4.0 before 2.6.0 Insecure Deserialization RCE via Stored Model Restoration",
"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": "hnwg",
"type": "finder"
}
]
}
}
}