一句话:通过构建多源数据集,系统揭示 PyPI 恶意包的行为特征、攻击向量与生命周期,并评估其持续风险。
PyPI 的便利性伴随恶意包传播风险,开发者常将恶意包伪装为正常包。本文构建自动化数据收集框架,整理出来自多源的 4,669 个恶意包文件数据集,并基于行为特征将其初步分为五类。研究发现,超过 50% 的恶意代码具有多种恶意行为,信息窃取与命令执行尤为普遍,还观察到若干新型攻击向量与反检测技术。74.81% 的恶意包通过源码安装进入终端用户项目,增加安全风险;现实调查显示大量已举报恶意包仍长期存在于全球 PyPI 镜像服务器中,超过 72% 在被发现后保留较长时间。最后刻画了 PyPI 生态中恶意代码生命周期画像,并提出缓解建议。
PyPI provides a convenient and accessible package management platform to developers, enabling them to quickly implement specific functions and improve work efficiency. However, the rapid development of the PyPI ecosystem has led to a severe problem of malicious package propagation. Malicious developers disguise malicious packages as normal, posing a significant security risk to end-users. To this end, we conducted an empirical study to understand the characteristics and current state of the malicious code lifecycle in the PyPI ecosystem. We first built an automated data collection framework and collated a multi-source malicious code dataset containing 4,669 malicious package files. We preliminarily classified these malicious code into five categories based on malicious behaviour characteristics. Our research found that over 50 % of malicious code exhibits multiple malicious behaviours, with information stealing and command execution being particularly prevalent. In addition, we observed several novel attack vectors and anti-detection techniques. Our analysis revealed that 74.81 % of all malicious packages successfully entered end-user projects through source code installation, thereby increasing security risks. A real-world investigation showed that many reported malicious packages persist in PyPI mirror servers globally, with over 72 % remaining for an extended period after being discovered. Finally, we sketched a portrait of the malicious code lifecycle in the PyPI ecosystem, effectively reflecting the characteristics of malicious code at different stages. We also present some suggested mitigations to improve the security of the Python open-source ecosystem.
DOI 原文 · arXiv · PDF(开放获取) · DBLP
@inproceedings{GuoXLHFL23,
title = {An Empirical Study of Malicious Code In PyPI Ecosystem},
author = {Wenbo Guo and Zhengzi Xu and Chengwei Liu and Cheng Huang and Yong Fang and Yang Liu},
booktitle = {ASE},
year = {2023},
doi = {10.1109/ase56229.2023.00135}
}