Principle:Trailofbits Fickling File Corruption Detection
| Knowledge Sources | |
|---|---|
| Domains | Security, File_Format, Integrity |
| Last Updated | 2026-02-14 14:00 GMT |
Overview
A structural integrity check that detects corrupted or intentionally malformed PyTorch files by verifying expected internal file relationships.
Description
File Corruption Detection examines the structural properties of a PyTorch file to identify inconsistencies that indicate corruption or tampering. For example, a TorchScript file with model.json but missing both attributes.pkl and constants.pkl has an inconsistent structure that should not occur in legitimately created files.
This is distinct from safety analysis (which checks for malicious code) — corruption detection checks for structural integrity at the file format level.
Usage
Use this as part of a file validation pipeline, alongside format identification. Corrupted files should be rejected before any further analysis or loading attempts.
Theoretical Basis
# Pseudocode: Property-based integrity rules
if is_torch_zip:
if has_model_json and not has_attributes_pkl and not has_constants_pkl:
return (True, "Missing expected companion files")
return (False, "")
The check is extensible — new corruption rules can be added as new format variants are discovered.