arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2602.19818cs.CRcs.AI
收藏

SafePickle:基于机器学习的鲁棒且通用的恶意Pickle-based机器学习模型检测

SafePickle: Robust and Generic ML Detection of Malicious Pickle-based ML Models

Department of Computer and Software Engineering(计算机与软件工程系);Ariel Cyber Innovation Center(阿丽尔网络创新中心);Ariel University(阿丽尔大学)

Hillel Ohayon, Daniel Gilkarov, Ran Dubin

AI总结:

SafePickle通过基于机器学习的方法,实现对恶意Pickle-based机器学习模型的高效检测,其在多个数据集上均表现出优越的检测性能。

摘要:

随着Hugging Face等模型仓库越来越多地使用Python的pickle格式分发机器学习艺术制品,用户在加载模型时面临远程代码执行(RCE)风险。最近的防御方法,如PickleBall,依赖于针对每个库的策略合成,需要复杂的系统设置和已验证的良性模型,这限制了可扩展性和通用性。在本工作中,我们提出了一种轻量级、基于机器学习的扫描器,能够检测恶意Pickle-based文件,而无需策略生成或代码仪器化。我们的方法从Pickle字节码中静态提取结构和语义特征,并应用监督和非监督模型对文件进行分类,判断其为良性或恶意。我们构建并发布了727个来自Hugging Face的Pickle-based文件的标注数据集,并在四个数据集上评估我们的模型:我们自己的数据集、PickleBall(分布外)、Hide-and-Seek(9个高级逃避恶意模型)以及合成的joblib文件。在我们的数据集上,我们的方法实现了90.01%的F1分数,相比之下,最先进的扫描器(Modelscan、Fickling、ClamAV、VirusTotal)的F1分数为7.23%-62.75%。此外,在PickleBall数据(分布外)上,我们的方法实现了81.22%的F1分数,相比之下,PickleBall方法的F1分数为76.09%,同时保持完全库无关。最后,我们证明我们的方法是唯一一个能够正确解析并分类9/9个专门设计来逃避扫描器的Hide-and-Seek恶意模型的。这表明,数据驱动的检测可以有效且普遍地缓解Pickle-based模型文件攻击。

英文摘要:

Model repositories such as Hugging Face increasingly distribute machine learning artifacts serialized with Python's pickle format, exposing users to remote code execution (RCE) risks during model loading. Recent defenses, such as PickleBall, rely on per-library policy synthesis that requires complex system setups and verified benign models, which limits scalability and generalization. In this work, we propose a lightweight, machine-learning-based scanner that detects malicious Pickle-based files without policy generation or code instrumentation. Our approach statically extracts structural and semantic features from Pickle bytecode and applies supervised and unsupervised models to classify files as benign or malicious. We construct and release a labeled dataset of 727 Pickle-based files from Hugging Face and evaluate our models on four datasets: our own, PickleBall (out-of-distribution), Hide-and-Seek (9 advanced evasive malicious models), and synthetic joblib files. Our method achieves 90.01% F1-score compared with 7.23%-62.75% achieved by the SOTA scanners (Modelscan, Fickling, ClamAV, VirusTotal) on our dataset. Furthermore, on the PickleBall data (OOD), it achieves 81.22% F1-score compared with 76.09% achieved by the PickleBall method, while remaining fully library-agnostic. Finally, we show that our method is the only one to correctly parse and classify 9/9 evasive Hide-and-Seek malicious models specially crafted to evade scanners. This demonstrates that data-driven detection can effectively and generically mitigate Pickle-based model file attacks.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑