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

跨语言检测 npm 和 PyPI 中恶意包的可行性研究

On the Feasibility of Cross-Language Detection of Malicious Packages in npm and PyPI

Piergiorgio Ladisa, Serena Elisa Ponta, Nicola Ronzoni, Matias Martinez, Olivier Barais

AI总结:

本研究提出一种基于语言无关特征的跨语言恶意包检测方法,通过训练模型捕捉 npm 和 PyPI 中恶意包的共性,成功检测出58个未知恶意包。

摘要:

当前的软件供应链高度依赖于托管在公共仓库中的开源包。鉴于 npm 和 PyPI 等生态系统的普及,恶意用户开始通过发布包含恶意代码的开源包来传播恶意软件。近期的工作应用机器学习技术来检测 npm 生态系统中的恶意包。然而,样本的稀缺性对在其他生态系统中应用机器学习技术构成了挑战。尽管 JavaScript 和 Python 之间存在差异,针对这些语言的开源软件供应链攻击显示出明显的相似性(例如,使用安装脚本、混淆字符串、URL)。在本文中,我们提出了一种新颖的方法,该方法涉及一组与语言无关的特征,并训练能够通过捕获 npm 和 PyPI 中恶意包的共性来检测它们的模型。这种方法使我们能够在涵盖多种语言的多样化数据集上训练模型,从而克服样本可用性有限的挑战。我们在受控实验(其中数据标签已知)中以及在实际环境中通过扫描 npm 和 PyPI 新上传的包(持续10天)来评估模型。我们发现,我们的方法成功检测到了 npm 和 PyPI 中的恶意包。在对31,292个包的分析中,我们报告了58个先前未知的恶意包(npm 中38个,PyPI 中20个),这些包随后被从相应的仓库中移除。

英文摘要:

Current software supply chains heavily rely on open-source packages hosted in public repositories. Given the popularity of ecosystems like npm and PyPI, malicious users started to spread malware by publishing open-source packages containing malicious code. Recent works apply machine learning techniques to detect malicious packages in the npm ecosystem. However, the scarcity of samples poses a challenge to the application of machine learning techniques in other ecosystems. Despite the differences between JavaScript and Python, the open-source software supply chain attacks targeting such languages show noticeable similarities (e.g., use of installation scripts, obfuscated strings, URLs). In this paper, we present a novel approach that involves a set of language-independent features and the training of models capable of detecting malicious packages in npm and PyPI by capturing their commonalities. This methodology allows us to train models on a diverse dataset encompassing multiple languages, thereby overcoming the challenge of limited sample availability. We evaluate the models both in a controlled experiment (where labels of data are known) and in the wild by scanning newly uploaded packages for both npm and PyPI for 10 days. We find that our approach successfully detects malicious packages for both npm and PyPI. Over an analysis of 31,292 packages, we reported 58 previously unknown malicious packages (38 for npm and 20 for PyPI), which were consequently removed from the respective repositories.

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

↑