
This study analyzes Python pickle deserialization vulnerabilities, focusing on CVE-2024-3568 in Hugging Face Transformers' TFAutoModel. We reproduce the exploit to examine its root cause, attack vectors, and risks.
Introduces the pickle deserialization mechanism and its __reduce__ attack principle, reproduces the deserialization vulnerability CVE-2024-3568 in the Hugging Face Transformers library, analyzes security risks in the Transformers library, and proposes effective security hardening measures. For details, please refer to the experiment PDF document.
(PoC author code is available at CVE-2024-3568 or in the author_inf folder)
Vulnerability Location
TFAutoModel.load_repo_checkpoint() method (Transformers ≤ v4.37.2)
Attack Principle
The extra_data.pickle file in a malicious checkpoint triggers RCE when deserialized via pickle.load()
Impact Scope
# For detailed configuration instructions, see the experiment PDF
pip install transformers==4.37.2 tensorflow
git clone https://github.com/llm-sec/transformer-hacker
For details, see the PDF document.
test.py and test2.py involve principle analysis (with assistance from AI Wenxiaobai; thanks to the productivity gains from technological breakthroughs).
Malicious Checkpoint Generation (For specific commands, see the PDF document)
Vulnerability Triggering (For code examples, see the PDF document)
Attack Verification (For verification methods, see the PDF document)
load_repo_checkpoint() methodDetailed Technical Analysis: For the complete vulnerability principle, exploitation process, and defense strategies, please refer to the experiment PDF document PoC Implementation: PoC author code is available at CVE-2024-3568 or in the author_inf folder