arXiv:2508.15987cs.CRcs.LG2025-08被引 11

PickleBall让不安全的模型加载变安全,能自动识别并拦截恶意代码。

PickleBall: Secure Deserialization of Pickle-based Machine Learning Models (Extended Report)

  • 通过分析机器学习库源码生成安全加载策略
  • 79.8%正常模型可正确加载,100%恶意样本被拒
  • 适合关注模型安全的开发者和部署者使用

机器学习模型仓库如Hugging Face Model Hub促进了模型共享,但攻击者可通过污染模型注入恶意代码。现有防御手段存在缺陷:44.9%热门模型仍使用不安全的pickle格式,15%无法被严格加载策略处理,模型扫描器则存在误报与漏报。PickleBall针对这一问题,静态分析机器学习库源码,生成仅允许良性模型安全加载的定制策略,并在运行时动态执行,作为pickle模块的即插即用替代品。在数据集上,PickleBall成功加载79.8%的良性pickle模型,同时完全拒绝所有恶意样本。相较之下,现有模型扫描器未能识别已知恶意模型,而最先进加载器比PickleBall少加载22%的良性模型。PickleBall消除了恶意pickle模型中的任意函数调用风险,提高了攻击者利用代码重用的门槛。

原文摘要 · Abstract (English)

Machine learning model repositories such as the Hugging Face Model Hub facilitate model exchanges. However, bad actors can deliver malware through compromised models. Existing defenses such as safer model formats, restrictive (but inflexible) loading policies, and model scanners have shortcomings: 44.9% of popular models on Hugging Face still use the insecure pickle format, 15% of these cannot be loaded by restrictive loading policies, and model scanners have both false positives and false negatives. Pickle remains the de facto standard for model exchange, and the ML community lacks a tool that offers transparent safe loading. We present PickleBall to help machine learning engineers load pickle-based models safely. PickleBall statically analyzes the source code of a given machine learning library and computes a custom policy that specifies a safe load-time behavior for benign models. PickleBall then dynamically enforces the policy during load time as a drop-in replacement for the pickle module. PickleBall generates policies that correctly load 79.8% of benign pickle-based models in our dataset, while rejecting all (100%) malicious examples in our dataset. In comparison, evaluated model scanners fail to identify known malicious models, and the state-of-art loader loads 22% fewer benign models than PickleBall. PickleBall removes the threat of arbitrary function invocation from malicious pickle-based models, raising the bar for attackers to depend on code reuse techniques.

模型安全反恶意Pickle

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。