一句话:提出 Ea4mp,融合代码行为深度特征与元数据特征,提升恶意 PyPI 包检测精度与召回,并发现新恶意包。
针对 PyPI 恶意包上传激增,现有专家规则昂贵且难跟上恶意行为演化,纯代码深度特征在某些情况下不够准确。本文提出 Ea4mp:从所有脚本文件中抽取代码行为序列,微调 BERT 学习恶意代码深层语义特征,并构建集成分类器融合深度代码行为特征与元数据特征。在新数据集上与三个先进基线对比,精度提升 6.9%-24.6%,召回提升 10.5%-18.4%;三周内从 46,573 个新上传包中识别出 119 个未知恶意包,其中 82 个被 PyPI 官方移除。
PyPI, the official package registry for Python, has seen a surge in the number of malicious package uploads in recent years. Prior studies have demonstrated the effectiveness of learning-based solutions in malicious package detection. However, manually-crafted expert rules are expensive and struggle to keep pace with the rapidly evolving malicious behaviors, while deep features automatically extracted from code are still inaccurate in certain cases. To mitigate these issues, in this paper, we propose Ea4mp, a novel approach which integrates deep code behaviors with metadata features to detect malicious PyPI packages. Specifically, Ea4mp extracts code behavior sequences from all script files and fine-tunes a BERT model to learn deep semantic features of malicious code. In addition, we realize the value of metadata information and construct an ensemble classifier to combine the strengths of deep code behavior features and metadata features for more effective detection. We evaluated Ea4mp against three state-of-the-art baselines on a newly constructed dataset. The experimental results show that Ea4mp improves precision by 6.9%-24.6% and recall by 10.5%-18.4%. With Ea4mp, we successfully identified 119 previously unknown malicious packages from a pool of 46,573 newly-uploaded packages over a three-week period, and 82 out of them have been removed by the PyPI official.CCS CONCEPTS• Security and privacy → Malware and its mitigation.
@inproceedings{0001GCB0024,
title = {1+1>2: Integrating Deep Code Behaviors with Metadata Features for Malicious PyPI Package Detection},
author = {Xiaobing Sun and Xingan Gao and Sicong Cao and Lili Bo and Xiaoxue Wu and Kaifeng Huang},
booktitle = {ASE},
year = {2024},
doi = {10.1145/3691620.3695493}
}