arXivDaily arXiv每日学术速递 周一至周五更新
感恩节,周五至周末无更新,大家顺遂。周一再来吧
arXiv 2202.13953cs.CRcs.SE
收藏

实用的恶意npm包自动检测

Practical Automated Detection of Malicious npm Packages

Adriana Sejfia, Max Schäfer

摘要:

npm注册表是JavaScript和TypeScript生态系统的支柱之一,托管了超过170万个包,从简单的实用程序库到复杂的框架和整个应用程序。由于npm的压倒性流行,它已成为恶意行为者的主要目标,他们发布新的包或破坏现有的包,以引入恶意软件,篡改或暴露安装这些包或任何(过渡性)依赖于它们的包的用户的敏感数据。防御此类攻击对于维护软件供应链的完整性至关重要,但软件包更新的绝对数量使得全面的手动审查变得不可行。我们提出了Amalfi,一种基于机器学习的方法,用于自动检测由三种互补技术组成的潜在恶意软件包。我们从已知的恶意和良性软件包的例子训练分类器开始。如果一个软件包被分类器标记为恶意软件,我们就会检查它是否包含有关其源代码库的元数据,如果包含,则检查该软件包是否可以从其源代码中复制。可从源代码复制的包通常不是恶意的,因此这一步允许我们剔除误报。最后,我们还采用了一个简单的文本克隆检测技术来识别可能被分类器错过的恶意软件包的副本,减少了误报的数量。Amalfi改进了现有技术,因为它是轻量级的,每个包只需要几秒钟就可以提取特征并运行分类器,并且在实践中取得了良好的效果:在一周内发布的96287个包版本上运行它,我们能够识别95个以前未知的恶意软件样本,误报数量可控。

英文摘要:

The npm registry is one of the pillars of the JavaScript and TypeScript ecosystems, hosting over 1.7 million packages ranging from simple utility libraries to complex frameworks and entire applications. Due to the overwhelming popularity of npm, it has become a prime target for malicious actors, who publish new packages or compromise existing packages to introduce malware that tampers with or exfiltrates sensitive data from users who install either these packages or any package that (transitively) depends on them. Defending against such attacks is essential to maintaining the integrity of the software supply chain, but the sheer volume of package updates makes comprehensive manual review infeasible. We present Amalfi, a machine-learning based approach for automatically detecting potentially malicious packages comprised of three complementary techniques. We start with classifiers trained on known examples of malicious and benign packages. If a package is flagged as malicious by a classifier, we then check whether it includes metadata about its source repository, and if so whether the package can be reproduced from its source code. Packages that are reproducible from source are not usually malicious, so this step allows us to weed out false positives. Finally, we also employ a simple textual clone-detection technique to identify copies of malicious packages that may have been missed by the classifiers, reducing the number of false negatives. Amalfi improves on the state of the art in that it is lightweight, requiring only a few seconds per package to extract features and run the classifiers, and gives good results in practice: running it on 96287 package versions published over the course of one week, we were able to identify 95 previously unknown malware samples, with a manageable number of false positives.

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

↑