paperbot · PL 论文追踪

全部论文 待读 收藏

P2 Practical automated detection of malicious npm packages

恶意 npm 包的实用自动化检测
ICSE Proceedings of the 44th International Conference on Software Engineering2022匹配度 3/10 · 该论文将机器学习、源码可复现性校验与克隆检测用于检测恶意 npm 包,属于软件供应链安全与 ML+PL 交叉应用;但与用户核心关注的静态分析/形式化验证、LLM/Agent 改进程序分析、浮点程序分析或贝叶斯程序分析无直接关系,仅有较弱的程序语言与机器学习结合关联。引用 75 inbox
Adriana Sejfia, Max Schäfer
crossref: 2026-09-12

AI 速览

一句话:提出 Amalfi,结合机器学习分类、源码可复现性校验与克隆检测,自动检测 npm 恶意包,一周发现 95 个未知恶意样本。

npm 生态规模巨大,恶意包可篡改或窃取用户敏感数据,而人工审查全部更新不可行,因此需要自动检测方法。Amalfi 采用三种互补技术:先用已知恶意与良性包训练分类器;若包被判定为恶意,则检查其源码仓库元数据以及能否从源码复现,以排除误报;再用文本克隆检测发现分类器可能漏掉的恶意包副本,以降低漏报。该方法轻量,每包仅需数秒即可提取特征并运行分类器。作者在一周内发布的 96,287 个包版本上进行评估,识别出 95 个此前未知的恶意软件样本,误报数量处于可接受范围。

问题
npm 包更新量极大,恶意包可篡改或窃取敏感数据,人工审查不可行,需要实用的自动化检测手段。
方法
Amalfi 结合基于已知恶意/良性包训练的分类器、源码可复现性校验以及文本克隆检测,分别用于检测、排除误报和发现漏报。
评估
在一周内发布的 96,287 个 npm 包版本上运行,每包仅需数秒,识别出 95 个此前未知的恶意样本,且误报数量可管理。
原文摘要(Abstract)

The npm registry is one of the pillars of the JavaScript and Type-Script ecosystems, hosting over 1.7 million packages ranging from simple utility libraries to complex frameworks and entire applications. Each day, developers publish tens of thousands of updates as well as hundreds of new packages. 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.

链接与引用

DOI 原文 · PDF(开放获取) ·

BibTeX
@inproceedings{paperbot6927,
  title = {Practical automated detection of malicious npm packages},
  author = {Adriana Sejfia and Max Schäfer},
  booktitle = {ICSE},
  year = {2022},
  doi = {10.1145/3510003.3510104}
}