{"id":"CVE-2025-10157","aliases":["CVE-2025-10157","GHSA-f7qq-56ww-84cr","PYSEC-2025-153"],"related":[],"kind":"vulnerability","state":"published","title":"PickleScan Bypasses Unsafe Globals Check Using Submodule Imports","summary":"A Protection Mechanism Failure vulnerability in mmaitre314 picklescan versions up to and including 0.0.30 allows a remote attacker to bypass the unsafe globals check. This is possible because the scanner performs an exact match for module names, allowing malicious payloads to be loaded via submodules of dangerous packages (e.g., 'asyncio.unix_events' instead of 'asyncio'). \n\nWhen the incorrectly considered safe file is loaded after scan, it can lead to the execution of malicious code.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"A Protection Mechanism Failure vulnerability in mmaitre314 picklescan versions up to and including 0.0.30 allows a remote attacker to bypass the unsafe globals check. This is possible because the scanner performs an exact match for module names, allowing malicious payloads to be loaded via submodules of dangerous packages (e.g., 'asyncio.unix_events' instead of 'asyncio'). \n\nWhen the incorrectly considered safe file is loaded after scan, it can lead to the execution of malicious code.","source":"cvelist"},{"lang":"en","text":"### Summary\nThe vulnerability allows malicious actors to bypass PickleScan's unsafe globals check, leading to potential arbitrary code execution. The issue stems from PickleScan's strict check for full module names against its list of unsafe globals. By using subclasses of dangerous imports instead of the exact module names, attackers can circumvent the check and inject malicious payloads.\n\n### PoC\n1. Download a model that uses the `asyncio` package: \n\n```wget https://huggingface.co/iluem/linux_pkl/resolve/main/asyncio_asyncio_unix_events___UnixSubprocessTransport__start.pkl```\n\n2. Check with PickleScan: `picklescan -p asyncio_asyncio_unix_events___UnixSubprocessTransport__start.pkl -g`\n\n**Expected Result:**\n\nPickleScan should identify all `asyncio` import as dangerous and flag the pickle file as malicious as `asyncio` is in `_unsafe_globals` dictionary.\n\n**Actual Result:**\n![Screenshot 2025-06-29 at 14 13 38](https://github.com/user-attachments/assets/39467f50-5cdb-4c25-bb37-35c03dc4a626)\n\nPickleScan marked the import as Suspicious, failing to identify it as a dangerous import.\n\n### Impact\n**Severity**: High\n**Affected Users**: Any organization, like HuggingFace, or individual using PickleScan to analyze PyTorch models or other files distributed as ZIP archives for malicious pickle content.\n**Impact Details**: Attackers can craft malicious PyTorch models containing embedded pickle payloads, package them into ZIP archives, and bypass the PickleScan check by using subclasses of dangerous imports. This could lead to arbitrary code execution on the user's system when these malicious files are processed or loaded.\n\n**Recommendations:**\n\n**Replace:**\nhttps://github.com/mmaitre314/picklescan/blob/2a8383cfeb4158567f9770d86597300c9e508d0f/src/picklescan/scanner.py#L309C9-L309C54\n\n\n  `      unsafe_filter = _unsafe_globals.get(g.module)`\n\nby:\n```\n      matched_key = None\n        if imported_global.module:\n            for key_in_globals in unsafe_globals.keys():\n                # Check if imported_global.module starts with the key_in_globals AND\n                # (it's the first match OR this key is more specific than the previous match)\n                # AND imported_global.module is exactly the key or imported_global.module is key + '.' + something\n                if imported_global.module.startswith(key_in_globals):\n                    if (imported_global.module == key_in_globals or # Exact match\n                            (len(imported_global.module) > len(key_in_globals) and imported_global.module[len(key_in_globals)] == '.')): # Submodule match\n                        if matched_key is None or len(key_in_globals) > len(matched_key):\n                            matched_key = key_in_globals\n\n        if matched_key:\n            unsafe_filter = unsafe_globals[matched_key]\n```","format":"markdown","source":"ghsa"},{"lang":"es","text":"Una vulnerabilidad de fallo en el mecanismo de protección en las versiones de mmaitre314 picklescan hasta la 0.0.30 inclusive permite a un atacante remoto eludir la comprobación de globales inseguras. Esto es posible porque el escáner realiza una coincidencia exacta para los nombres de los módulos, permitiendo que se carguen cargas útiles maliciosas a través de submódulos de paquetes peligrosos (por ejemplo, 'asyncio.unix_events' en lugar de 'asyncio'). Cuando el archivo incorrectamente considerado seguro se carga después del escaneo, puede conducir a la ejecución de código malicioso.","source":"nvd"}],"published":"2025-09-10T17:15:33.000Z","modified":"2026-09-26T00:10:00.127Z","severity":{"scorer":"JFROG","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N","score":9.3,"rating":"CRITICAL"},"severities":[{"scorer":"JFROG","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N","score":9.3,"rating":"CRITICAL"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:L","score":8.3,"rating":"CRITICAL"},{"scorer":"GitHub","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N","rating":"CRITICAL"},{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H","score":7.8,"rating":"HIGH"},{"scorer":"PyPA Advisory Database","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H","score":7.8,"rating":"HIGH"}],"cwes":["CWE-693"],"affected":[{"ranges":[{"type":"semver","introduced":"0","lastAffected":"0.0.30","status":"affected"}],"vendor":"mmaitre314","product":"picklescan","source":"cvelist"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"0.0.31"}],"ecosystem":"PyPI","package":"picklescan","purl":"pkg:pypi/picklescan","source":"ghsa"},{"ranges":[{"status":"affected","fixed":"0.0.31"}],"vendor":"mmaitre314","product":"picklescan","cpe":"cpe:2.3:a:mmaitre314:picklescan:*:*:*:*:*:*:*:*","source":"nvd"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"0.0.31"}],"ecosystem":"PyPI","package":"picklescan","purl":"pkg:pypi/picklescan","source":"pysec"}],"references":[{"url":"https://github.com/mmaitre314/picklescan/security/advisories/GHSA-f7qq-56ww-84cr","tags":["evidence","exploit","vendor-advisory","web"],"sources":["cvelist","ghsa","nvd","pysec"]},{"url":"https://huggingface.co/iluem/linux_pkl/resolve/main/asyncio_asyncio_unix_events___UnixSubprocessTransport__start.pkl","tags":["broken-link","exploit","web"],"sources":["cvelist","ghsa","nvd","pysec"]},{"url":"https://github.com/mmaitre314/picklescan/blob/2a8383cfeb4158567f9770d86597300c9e508d0f/src/picklescan/scanner.py#L309","tags":["product","web"],"sources":["cvelist","ghsa","nvd","pysec"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2025-10157","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/mmaitre314/picklescan/pull/50","tags":["web"],"sources":["ghsa"]},{"url":"https://github.com/mmaitre314/picklescan/commit/28a7b4ef753466572bda3313737116eeb9b4e5c5","tags":["web"],"sources":["ghsa"]},{"url":"https://github.com/mmaitre314/picklescan","tags":["package"],"sources":["ghsa"]},{"url":"https://github.com/pypa/advisory-database/tree/main/vulns/picklescan/PYSEC-2025-153.yaml","tags":["web"],"sources":["ghsa"]}],"credits":["JFrog","@xdcrev"],"assigner":"JFROG","ssvc":{"scorer":"CISA-ADP","exploitation":"poc","automatable":"no","technicalImpact":"partial","date":"2025-09-17T13:07:29.343Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2025-10157","url":"https://www.cve.org/CVERecord?id=CVE-2025-10157","licence":"CVE Terms of Use","modified":"2025-09-17T13:07:38.291Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-f7qq-56ww-84cr","url":"https://github.com/advisories/GHSA-f7qq-56ww-84cr","licence":"CC-BY-4.0","modified":"2026-06-06T15:00:08.248Z"},{"source":"nvd","name":"NVD","id":"CVE-2025-10157","url":"https://nvd.nist.gov/vuln/detail/CVE-2025-10157","licence":"Public domain","modified":"2026-09-26T00:10:00.127Z"},{"source":"pysec","name":"PyPA Advisory Database","id":"PYSEC-2025-153","url":"https://osv.dev/vulnerability/PYSEC-2025-153","licence":"CC-BY-4.0","modified":"2026-05-20T09:19:10.890Z"}],"updatedAt":"2026-11-25T22:59:04.778Z","epss":{"score":0.00782,"percentile":0.57225,"date":"2026-12-02T12:00:21.000Z"}}