---
id: "CVE-2026-31239"
page: "https://infrastack.ai/live/CVE-2026-31239"
kind: "vulnerability"
aliases: ["CVE-2026-31239", "GHSA-pq2f-x424-6fjm"]
title: "mamba language model framework vulnerable to insecure deserialization when loading pre-trained models from HuggingFace Hub"
severity: "critical"
cvss: 9.8
epss: 0.00409
exploited: false
status: "open"
category: "ai-tooling"
products: [{"name": "mamba-ssm", "fixed": [], "affected": "<= 2.2.6", "ecosystem": "pypi"}]
ecosystems: ["pypi"]
tags: ["ai-tooling", "cwe-502", "huggingface", "mamba-ssm", "ml-pipelines", "pypi", "python"]
not_affected_if: ["models-loaded-from-trusted-sources", "no-hub-loading", "safetensors-only"]
published_at: "2026-05-12T18:16:52+00:00"
first_seen_at: "2026-11-16T15:27:32+00:00"
updated_at: "2026-11-16T15:37:59+00:00"
sources: [{"source": "ghsa", "url": "https://github.com/advisories/GHSA-pq2f-x424-6fjm", "first_seen_at": "2026-11-16T15:27:32+00:00"}, {"source": "nvd", "url": "https://nvd.nist.gov/vuln/detail/CVE-2026-31239", "first_seen_at": "2026-11-16T15:37:59+00:00"}]
exploit_sources: [{"type": "epss", "score": 0.00409, "url": "https://api.first.org/data/v1/epss?cve=CVE-2026-31239"}]
---

# mamba language model framework vulnerable to insecure deserialization when loading pre-trained models from HuggingFace Hub

Link for people: https://infrastack.ai/live/CVE-2026-31239 (this .md is for agents)

The mamba-ssm language model library calls torch.load() without weights_only=True in MambaLMHeadModel.from_pretrained(), so a model file's pickle data is executed as Python. An attacker who publishes a malicious model repository on HuggingFace Hub gets code execution in the process of any victim who loads it.

_Summary, check and fix written by a model from the sources; labelled as such._

## Affected

- pypi:mamba-ssm affected <= 2.2.6 fixed no fixed version listed

## How to check

- Run `pip show mamba-ssm` and compare the version with 2.2.6 or earlier.
- Search your code and notebooks for `from_pretrained(` calls on MambaLMHeadModel that load untrusted repositories.
- Check whether those models store weights as pytorch_model.bin rather than safetensors.

## Timeline

- 2026-11-16T15:27:32+00:00 ghsa https://github.com/advisories/GHSA-pq2f-x424-6fjm
- 2026-11-16T15:37:59+00:00 nvd https://nvd.nist.gov/vuln/detail/CVE-2026-31239

## From the sources

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.

---

_Free to read, with fair use of about 60 pages a minute. For higher limits or API access: sales@infrastack.ai_
