T09 · Insecure Skill Coding Practices
- Location
scripts/main.py:193- Finding
Unsafe Deserialization of Untrusted Pickle Files
- Content
View full analysis
Vulnerability Details
File Location:
scripts/main.py, lines 193–194
Vulnerability Type: Unsafe Python pickle deserialization
Risk Level: HighVulnerable Code
python elif suffix in ['.pkl', '.pickle']: df = pd.read_pickle(file_path)The Skill also advertises Python pickle files as supported input in
SKILL.md, making this code path part of its documented workflow.Technical Analysis
pandas.read_pickle()uses Python pickle deserialization. Pickle is not a data-only format: serialized objects may define reconstruction behavior that invokes arbitrary Python callables during loading. Consequently, validating only the filename suffix does not make an untrusted pickle safe.The CLI permits a caller to select the input path through
--input. When that path ends in.pklor.pickle,load_data_from_file()passes it directly topd.read_pickle()without establishing that the file came from a trusted source or isolating deserialization in a sandbox.An attacker able to supply or influence the input file can therefore craft a pickle whose reconstruction instructions execute arbitrary local code before a valid DataFrame is returned. No separate command-injection flaw is required.
Attack Path
- An attacker creates a malicious pickle containing an object with attacker-controlled reconstruction behavior.
- The attacker supplies that file as survival data or convinces a user or Agent to process it.
- The Skill is invoked with a command such as:
bash python scripts/main.py \ --input malicious.pkl \ --time-col time \ --event-col event load_data_from_file()recognizes the.pklsuffix.- The function calls
pd.read_pickle(file_path). - Python reconstructs the malicious object, executing the embedded callable with the privileges of the Skill process.
Impact Assessment
Successful exploitation provides arbitrary code execution under the operating-system identity running the Skil ...[truncated 433 chars]
- Remediation
View remediation
Remediation Suggestions
- Remove
.pkland.picklefrom the accepted input formats. - Use non-executable data formats such as CSV or Parquet for survival datasets.
- Return an explicit error for pickle inputs:
python elif suffix in {'.pkl', '.pickle'}: raise ValueError( "Pickle input is disabled because it can execute arbitrary code. " "Convert the dataset to CSV or Parquet." ) - Remove pickle support claims from
SKILL.mdand related documentation. - If legacy pickle compatibility is unavoidable:
- Accept only files generated and stored within a trusted administrative workflow.
- Verify provenance and integrity using a trusted manifest or cryptographic hash.
- Deserialize in a separate, disposable sandbox with no credentials, no network access, read-only input access, and a narrowly scoped output channel.
- Do not treat restricted-unpickler implementations as a complete substitute for avoiding pickle.
- Add a regression test confirming that
.pkland.pickleinputs are rejected before deserialization.
- Remove
