[论文解读] An Empirical Study of Malicious Code In PyPI Ecosystem
本文对 PyPI 生态系统中的恶意代码进行了大规模实证研究,通过从 PyPI 镜像和其他来源自动收集,构建了一个包含 4,669 个恶意软件包的数据库。研究发现,超过 50% 的恶意软件包表现出多种行为,尤其是信息窃取和命令执行;74.81% 的恶意软件包通过源代码安装成功渗透用户项目,且许多在被发现后仍长期存在于镜像中。
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.
研究动机与目标
- 为解决当前缺乏公开、高质量的恶意 PyPI 软件包数据集的问题。
- 研究恶意代码在 PyPI 生态系统中的生命周期,涵盖从开发到用户系统渗透的全过程。
- 分析恶意软件包的行为模式、规避技术及其在现实世界中的影响。
- 为提升 Python 开源生态中恶意代码检测与缓解措施提供可操作的见解。
提出的方法
- 构建了一个自动化数据收集框架,从 PyPI 镜像和多个外部来源收集恶意软件包。
- 整合多源数据构建了一个包含 4,669 个恶意代码实例的数据集,涵盖完整软件包、代码片段和恶意样本。
- 利用静态和动态分析技术,将恶意软件包按行为分类为五种类别。
- 采用启发式方法和机器学习技术,检测 Python 源代码中的恶意命令和后门。
- 追踪通过源代码安装传播的软件包,并分析其在全球 PyPI 镜像中的持久性。
- 开展真实世界案例研究,评估恶意软件包对终端用户系统的影响及渗透模式。
实验结果
研究问题
- RQ1RQ1:PyPI 生态系统中恶意代码的主要属性和来源是什么?其与其它平台相比有何异同?
- RQ2RQ2:攻击者在向开源软件包注入代码时,如何组合多种攻击策略和恶意行为?这些战术在不同平台间如何演变?
- RQ3RQ3:现有检测工具在识别恶意软件包方面的有效性如何?恶意软件包使用了哪些规避技术来绕过这些检测?
- RQ4RQ4:恶意软件包对终端用户系统的影响如何?其渗透机制是什么?主要针对哪些操作系统?
主要发现
- 超过 50% 的 PyPI 生态系统中的恶意软件包表现出多种恶意行为,其中信息窃取和命令执行最为普遍。
- 74.81% 的恶意软件包通过源代码安装成功渗透终端用户项目,表明这是主要的攻击向量。
- 超过 72% 的已报告恶意软件包在被发现后,仍在全球 PyPI 镜像服务器上长期可访问。
- 恶意软件包主要针对 Linux 系统,表明存在平台特定的利用策略。
- 攻击者采用多种反检测技术,包括代码混淆和动态载荷分发,以规避静态和动态分析工具。
- 本研究识别出新型攻击向量,例如通过源代码与二进制文件不匹配实现的供应链投毒,凸显了软件供应链中的系统性风险。
更好的研究,从现在开始
从阅读论文到最终审阅,大幅缩短您的研究时间。
无需绑定信用卡
本解读由 AI 生成,并经人工编辑审核。