CVE-2026-118938
Arbitrary code execution via pickle’s dotted attribute import (e.g., optparse.Values.read_file).
- CVSS 8.8
- CWE-502
- Input Validation and Sanitization
- Remote
In Trail of Bits fickling through 0.1.12, a pickle STACK_GLOBAL operand carrying a dotted __qualname__ (for example "Values.read_file") is resolved by pickle's find_class through _getattribute to an arbitrary attribute path rather than to a module-level function. Fickling records only the leading component of the name in its import tracking and renders the operation as a plain import (for instance, 'python -m fickling' displays it as 'from optparse import Values.read_file'), so the trailing attribute reference is never analyzed as a call. The OvertlyBadEvals analysis pass does not flag it, and check_safety() returns LIKELY_SAFE with zero findings. This allows an attacker to reach a class method that performs code execution: optparse.Values.read_file executes exec(open(filename).read(), vars), achieving arbitrary code execution when the crafted pickle is loaded through fickling.load(), which chains check_safety() into pickle.loads() as an explicit security gate. optparse is present in all current CPython 3.x releases (deprecated as of Python 3.13, not removed). This weakness is in the resolution and analysis of dotted attribute-path names, and is distinct from and independently fixable from the module-origin trust weakness tracked as CVE-2026-16760: resolving or flagging dotted attribute-path imports closes this vector while leaving the module-level trust behavior unchanged. This bypass was verified to remain present on the vendor master branch at commit d011709 as of 2026-10-30, after the vendor's October blocklist additions and a new heuristic that flags private stdlib attributes; because the public class method Values.read_file is neither blocklisted nor flagged as a private attribute, it is not addressed by those remediations.
- CWE
- CWE-502
- CVSS base score
- 8.8
- Published
- 2026-10-30
- OWASP
- A08 Software and Data Integrity Failures
- Orthogonal defect classification
- Checking
- Code defect classification
- Missing Check
- Category
- Input Validation and Sanitization
- Subcategory
- Insecure Parsing or Deserialization
- Accessibility scope
- Remote
- Impact
- Arbitrary Code Execution
- Affected component
- fickling
- Fixed by upgrading
- Yes
Solution
Upgrade Trail of Bits fickling to version 0.1.13 (or later), which adds proper handling of dotted attribute‑path imports and patches the described arbitrary‑code‑execution bypass.
Vulnerable code sample
import pickle
import fickling
def load_untrusted(data: bytes):
# VULNERABLE: allows dotted attribute import leading to exec via optparse.Values.read_file
return fickling.load(data)Patched code sample
import pickle
import fickling
def load_untrusted(data: bytes):
# FIX: disallow dotted attribute imports in pickle deserialization
return fickling.load(data, allow_dotted=False)Published fix
Public sources link this CVE to the changes below. The code samples above were generated to illustrate the defect; these links lead to the code the project actually changed.
- Analyze PyTorch ZIP records with PyTorch reader (trailofbits/fickling)
fickling/cli.py,fickling/cli.py · _scan_huggingface,fickling/loader.py · scan_zip_archive,fickling/pytorch.py,fickling/pytorch.py · PyTorchModelWrapper.pickled
Cite this entry
@misc{vaitp:cve2026118938,
title = {{Arbitrary code execution via pickle’s dotted attribute import (e.g., optparse.Values.read_file).}},
author = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
year = {2026},
note = {VAITP Python Vulnerability Dataset, entry CVE-2026-118938},
howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2026-118938/}}
}
Introducing the "VAITP dataset": a specialized repository of Python vulnerabilities and patches, meticulously compiled for the use of the security research community. As Python's prominence grows, understanding and addressing potential security vulnerabilities become crucial. Crafted by and for the cybersecurity community, this dataset offers a valuable resource for researchers, analysts, and developers to analyze and mitigate the security risks associated with Python. Through the comprehensive exploration of vulnerabilities and corresponding patches, the VAITP dataset fosters a safer and more resilient Python ecosystem, encouraging collaborative advancements in programming security.
The supreme art of war is to subdue the enemy without fighting.
Sun Tzu – “The Art of War”
:: Shaping the future through research and ingenuity ::
