fix: add ctypes, signal, http to unsafe_globals blocklist#339
Open
scruge1 wants to merge 1 commit intoprotectai:mainfrom
Open
fix: add ctypes, signal, http to unsafe_globals blocklist#339scruge1 wants to merge 1 commit intoprotectai:mainfrom
scruge1 wants to merge 1 commit intoprotectai:mainfrom
Conversation
ctypes.CDLL bypasses the current blocklist and enables: - Arbitrary DLL/SO loading with DllMain execution (single-stage RCE) - Direct C runtime access (system(), exec()) - Confirmed end-to-end RCE on pickle, joblib, and numpy formats Also adds signal (process crash), http.client (network exfiltration), and urllib (data exfiltration) which also bypass the current blocklist. All confirmed passing modelscan 0.8.8 with 'No issues found'.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add
ctypes,signal,http,http.client,urllib, andurllib.requestto theunsafe_globalsCRITICAL blocklist insettings.py.Problem
ctypes.CDLLis not in the current blocklist. A malicious pickle/joblib/numpy file usingctypes.CDLLin__reduce__passes modelscan with "No issues found" and achieves:ctypes.CDLL("msvcrt").system(b"cmd")(two-stage RCE)Confirmed end-to-end RCE:
Also confirmed bypassing on:
signal.raise_signal(DoS),http.client.HTTPConnection(network exfil).Fix
Add these modules to the CRITICAL blocklist alongside existing entries like
os,subprocess,sys.Affected Formats
Confirmed on: Pickle (.pkl), Joblib (.pkl), NumPy (.npy). Likely affects all pickle-based formats.
Related Huntr reports submitted for Pickle, Joblib, and NPY formats.