{"id":"CVE-2026-31239","kind":"vulnerability","aliases":["CVE-2026-31239","GHSA-pq2f-x424-6fjm"],"related":[],"title":"mamba language model framework vulnerable to insecure deserialization when loading pre-trained models from HuggingFace Hub","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.","summary":"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.","severity":"critical","cvss":9.8,"epss":0.00409,"exploited":false,"exploited_at":null,"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"],"how_to_check":"- Run `pip show mamba-ssm` and compare the version with 2.2.6 or earlier.\n- Search your code and notebooks for `from_pretrained(` calls on MambaLMHeadModel that load untrusted repositories.\n- Check whether those models store weights as pytorch_model.bin rather than safetensors.","fix":null,"status":"open","published_at":"2026-05-12T18:16:52+00:00","first_seen_at":"2026-11-16T15:27:32+00:00","triaged_at":"2026-11-16T15:29:41+00:00","updated_at":"2026-11-16T15:37:59+00:00","category":"ai-tooling","confidence":0.7,"triage":{"at":"2026-11-16T15:29:41Z","model":"claude-haiku-5-5","output":{"fix":"unknown","reach":"internet","title":"mamba-ssm: loading a model from HuggingFace Hub runs attacker code","impact":"high","summary":"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.","audience":"developers","category":"ai-tooling","nicknames":[],"who_cares":["python","pypi","mamba-ssm","huggingface","ml-pipelines"],"confidence":0.7,"fix_status":"unknown","needs_auth":"no","worst_case":"Arbitrary code runs as the mamba process user on the victim's system.","analyst_note":"Find the fixed version of mamba-ssm and confirm whether weights_only=True or a safetensors path is the upstream fix, via https://github.com/advisories/GHSA-pq2f-x424-6fjm.","how_to_check":"- Run `pip show mamba-ssm` and compare the version with 2.2.6 or earlier.\n- Search your code and notebooks for `from_pretrained(` calls on MambaLMHeadModel that load untrusted repositories.\n- Check whether those models store weights as pytorch_model.bin rather than safetensors.","plain_action":"","product_name":"","needs_analyst":true,"not_affected_if":["models-loaded-from-trusted-sources","no-hub-loading","safetensors-only"],"who_is_affected":"Any application that calls MambaLMHeadModel.from_pretrained() on a model repository from HuggingFace Hub, including training and inference jobs and notebooks, is exposed. Code that only loads models you built yourself or hosts from a trusted source is at much lower risk. The sources do not say which versions are fixed.","user_interaction":"yes","product_ecosystem":"","needs_special_setup":"no","severity_if_unknown":"unknown"},"cost_usd":0.001157,"input_tokens":4726,"output_tokens":1368,"severity_before":"critical"},"analyst_status":"queued","analyst_note":"Find the fixed version of mamba-ssm and confirm whether weights_only=True or a safetensors path is the upstream fix, via https://github.com/advisories/GHSA-pq2f-x424-6fjm.","search":"'-2026':19A,27A '-31239':20A,28A '-502':36B,108C '2.2.6':101C '6fjm':25A 'ai':33B 'ai-tool':32B 'allow':141C 'arbitrari':145C,175C 'attack':74B,153C 'call':53B 'code':85B,176C 'context':186C 'cve':18A,26A 'cwe':35B,107C 'data':68B 'deseri':8A,106C,143C 'enabl':131C 'execut':70B,86B,178C 'exploit':155C 'file':65B,129C 'framework':4A,99C 'get':84B 'ghsa':22A 'ghsa-pq2f-x424-6fjm':21A 'hub':17A,83B,117C,165C 'huggingfac':16A,37B,82B,116C,164C 'insecur':7A,105C 'languag':2A,50B,97C 'librari':52B 'load':10A,94B,110C,125C,169C 'malici':78B,160C 'mamba':1A,30A,39B,48B,96C,189C 'mamba-ssm':29A,38B,47B 'mambalmheadmodel.from':60B,119C 'method':121C 'ml':42B 'ml-pipelin':41B 'model':3A,14A,51B,64B,79B,98C,114C,161C,171C 'modul':151C 'object':147C 'paramet':139C 'pickl':67B,150C 'pipelin':43B 'pq2f':23A 'pre':12A,112C 'pre-train':11A,111C 'pretrain':61B,120C 'process':89B,190C 'publish':76B,158C 'pypi':44B 'python':45B,72B,146C 'pytorch_model.bin':127C 'repositori':80B,162C,174C 'restrict':135C 'secur':134C 'security-restrict':133C 'ssm':31A,40B,49B 'system':183C 'thru':100C 'tool':34B 'torch.load':54B,123C 'train':13A,113C 'true':58B,138C 'use':122C 'via':148C 'victim':92B,168C,181C 'vulner':5A,103C 'weight':56B,128C,136C 'without':55B,130C 'x424':24A","nicknames":[],"mitigations":[],"who_affected":"Any application that calls MambaLMHeadModel.from_pretrained() on a model repository from HuggingFace Hub, including training and inference jobs and notebooks, is exposed. Code that only loads models you built yourself or hosts from a trusted source is at much lower risk. The sources do not say which versions are fixed.","tier":"B","verified":{},"analyst_revisit_at":null,"fix_status":"unknown","audience":"developers","plain_action":null,"pkeys":["mambassm"],"ptokens":["mamba","ssm"],"labels":["aitooling","critical","cwe502","huggingface","mambassm","mlpipelines","pypi","python"],"campaign_type":null,"search_a":"'-2026':19A,27A '-31239':20A,28A '6fjm':25A 'cve':18A,26A 'deseri':8A 'framework':4A 'ghsa':22A 'ghsa-pq2f-x424-6fjm':21A 'hub':17A 'huggingfac':16A 'insecur':7A 'languag':2A 'load':10A 'mamba':1A,30A 'mamba-ssm':29A 'model':3A,14A 'pq2f':23A 'pre':12A 'pre-train':11A 'ssm':31A 'train':13A 'vulner':5A 'x424':24A","search_b":"'-502':36B 'ai':33B 'ai-tool':32B 'attack':74B 'call':53B 'code':85B 'cwe':35B 'data':68B 'execut':70B,86B 'file':65B 'get':84B 'hub':83B 'huggingfac':37B,82B 'languag':50B 'librari':52B 'load':94B 'malici':78B 'mamba':39B,48B 'mamba-ssm':38B,47B 'mambalmheadmodel.from':60B 'ml':42B 'ml-pipelin':41B 'model':51B,64B,79B 'pickl':67B 'pipelin':43B 'pretrain':61B 'process':89B 'publish':76B 'pypi':44B 'python':45B,72B 'repositori':80B 'ssm':40B,49B 'tool':34B 'torch.load':54B 'true':58B 'victim':92B 'weight':56B 'without':55B","search_c":"'-502':108C '2.2.6':101C 'allow':141C 'arbitrari':145C,175C 'attack':153C 'code':176C 'context':186C 'cwe':107C 'deseri':106C,143C 'enabl':131C 'execut':178C 'exploit':155C 'file':129C 'framework':99C 'hub':117C,165C 'huggingfac':116C,164C 'insecur':105C 'languag':97C 'load':110C,125C,169C 'malici':160C 'mamba':96C,189C 'mambalmheadmodel.from':119C 'method':121C 'model':98C,114C,161C,171C 'modul':151C 'object':147C 'paramet':139C 'pickl':150C 'pre':112C 'pre-train':111C 'pretrain':120C 'process':190C 'publish':158C 'python':146C 'pytorch_model.bin':127C 'repositori':162C,174C 'restrict':135C 'secur':134C 'security-restrict':133C 'system':183C 'thru':100C 'torch.load':123C 'train':113C 'true':138C 'use':122C 'via':148C 'victim':168C,181C 'vulner':103C 'weight':128C,136C 'without':130C","cause_entry":null,"cause_path":null,"disclosures_checked_at":null,"first_public_at":"2026-05-12T18:16:52+00:00","kev":null,"cvss_vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H","cvss_by":"GitHub","poc_count":0,"sources":[{"source":"ghsa","external_id":"GHSA-pq2f-x424-6fjm","url":"https://github.com/advisories/GHSA-pq2f-x424-6fjm","severity":"critical","published_at":"2026-05-12T18:30:41+00:00","modified_at":"2026-11-16T15:22:56+00:00","first_seen_at":"2026-11-16T15:27:32+00:00","fetched_at":"2026-11-16T15:36:40+00:00","note":null},{"source":"nvd","external_id":"CVE-2026-31239","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-31239","severity":null,"published_at":"2026-05-12T18:16:52+00:00","modified_at":"2026-10-19T22:10:00+00:00","first_seen_at":"2026-11-16T15:37:59+00:00","fetched_at":"2026-11-16T15:37:59+00:00","note":null}],"documents":[],"disclosures":[],"exploit_sources":[{"type":"epss","score":0.00409,"url":"https://api.first.org/data/v1/epss?cve=CVE-2026-31239"}],"notice":"Free to read, with fair use of about 60 pages a minute. For higher limits or API access: sales@infrastack.ai"}