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

Critical 9.8 Published Updated

Attackers can execute arbitrary code by publishing malicious models to HuggingFace Hub, which victims load using the vulnerable Mamba framework.

Exploited in the wild
Not known
Login needed
Not needed
Attackable
Over the internet
Victim action needed
Not needed
Fix
None listed

What is CVE-2026-31239?

CVE-2026-31239 is a critical unsafe deserialization vulnerability in n/a, published on 12 May 2026. An attacker can exploit it over the internet without logging in, with no action from the victim.

Official 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.

Weakness: CWE-502

Which versions are affected by CVE-2026-31239?

3 open source packages ship an affected version, including mamba-ssm.

PackageAffectedFixed in
mamba-ssm PyPIAll versions to 2.2.6None
mamba-ssm PyPIAll versions to 2.2.6None
mamba-ssm PyPIAll versions to 2.2.6None

How do I fix CVE-2026-31239?

No fix has been published for CVE-2026-31239 yet. Limit exposure of the affected software until one is available.

Upgrade, and only deserialise data from trusted sources or with an allow-list of types. More about Unsafe deserialization.

Is CVE-2026-31239 being exploited?

There is no known exploitation of CVE-2026-31239 in the wild and no public exploit code.

Sources

Also known as GHSA-pq2f-x424-6fjm, PYSEC-2026-406.

Is CVE-2026-31239 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free