Practical Automated Detection of Malicious npm Packages
Adriana Sejfia, Max Schäfer
摘要
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.
问 Lune
几分钟读透这篇 Paper,不用再花一下午。
Lune 能读完全文,也能读引用它的顶会 Paper,讲清它的结论、证据和局限,每一点都注明出自哪篇 Paper。不用硬啃,也不靠猜。
已有 24 篇顶会 Paper 引用了它。别等审稿人问起,先弄清它们发现了什么。
脉络
- Containing Malicious Package Updates in npm with a Lightweight Permission System 引用了 Small World with High Risks: A Study of Security Threats in the npm Ecosystem
- Bad Snakes: Understanding and Improving Python Package Index Malware Scanning 引用了 LastPyMile: identifying the discrepancy between sources and packages
- Bad Snakes: Understanding and Improving Python Package Index Malware Scanning 引用了 Towards Measuring Supply Chain Attacks on Package Managers for Interpreted Languages
- DONAPI: Malicious NPM Packages Detector using Behavior Sequence Knowledge Mapping 引用了 Containing Malicious Package Updates in npm with a Lightweight Permission System
- DONAPI: Malicious NPM Packages Detector using Behavior Sequence Knowledge Mapping 引用了 Towards Measuring Supply Chain Attacks on Package Managers for Interpreted Languages
- DONAPI: Malicious NPM Packages Detector using Behavior Sequence Knowledge Mapping 引用了 Small World with High Risks: A Study of Security Threats in the npm Ecosystem
- LastPyMile: identifying the discrepancy between sources and packages 引用了 Containing Malicious Package Updates in npm with a Lightweight Permission System
- LastPyMile: identifying the discrepancy between sources and packages 引用了 Towards Measuring Supply Chain Attacks on Package Managers for Interpreted Languages
- LastPyMile: identifying the discrepancy between sources and packages 引用了 Small World with High Risks: A Study of Security Threats in the npm Ecosystem
- Towards Measuring Supply Chain Attacks on Package Managers for Interpreted Languages 引用了 Small World with High Risks: A Study of Security Threats in the npm Ecosystem
- Malicious Package Detection using Metadata Information 引用了 Small World with High Risks: A Study of Security Threats in the npm Ecosystem
- Modular call graph construction for security scanning of Node.js applications 引用了 Small World with High Risks: A Study of Security Threats in the npm Ecosystem
引用它的顶会 Paper24
- BOMs Away! Inside the Minds of Stakeholders: A Comprehensive Study of Bills of Materials for Software SystemsTrevor Stalnaker, Nathan Wintersgill, Oscar Chaparro, Massimiliano Di Penta 等ICSE 2024 · 50 次引用
- DONAPI: Malicious NPM Packages Detector using Behavior Sequence Knowledge MappingCheng Huang, Nannan Wang, Ziyan Wang, Siqi Sun 等USENIX Security 2024 · 38 次引用
- Malicious Package Detection using Metadata InformationSajal Halder, Michael Bewong, Arash Mahboubi, Yinhao Jiang 等WWW 2024 · 23 次引用
- Bad Snakes: Understanding and Improving Python Package Index Malware ScanningDuc-Ly Vu, Zachary Newman, John Speed MeyersICSE 2023 · 18 次引用
- Not All Dependencies are Equal: An Empirical Study on Production Dependencies in NPMJasmine Latendresse, Suhaib Mujahid, Diego Elias Costa, Emad ShihabASE 2022 · 17 次引用
它引用的 Paper5
- Small World with High Risks: A Study of Security Threats in the npm EcosystemMarkus Zimmermann, Cristian-Alexandru Staicu, Cam Tenny, Michael PradelUSENIX Security 2019 · 281 次引用
- LastPyMile: identifying the discrepancy between sources and packagesDuc-Ly Vu, Fabio Massacci, Ivan Pashchenko, Henrik Plate 等FSE 2021 · 53 次引用
- Modular call graph construction for security scanning of Node.js applicationsBenjamin Barslev Nielsen, Martin Toldam Torp, Anders MøllerISSTA 2021 · 47 次引用
- Containing Malicious Package Updates in npm with a Lightweight Permission SystemGabriel Ferreira, Limin Jia, Joshua Sunshine, Christian KästnerICSE 2021 · 3 次引用
- Towards Measuring Supply Chain Attacks on Package Managers for Interpreted LanguagesRuian Duan, Omar Alrawi, Ranjita Pai Kasturi, Ryan Elder 等NDSS 2021
相关 Paper
- ProfMal: Detecting Malicious NPM Packages by the Synergy between Static and Dynamic AnalysisYiheng Huang, Wen Zheng, Susheng Wu, Bihuan Chen 等ASE 2025 · 2 次引用
- Maltracker: A Fine-Grained NPM Malware Tracker Copiloted by LLM-Enhanced DatasetZeliang Yu, Ming Wen, Xiaochen Guo, Hai JinISSTA 2024 · 16 次引用
- SpiderScan: Practical Detection of Malicious NPM Packages Based on Graph-Based Behavior Modeling and MatchingYiheng Huang, Ruisi Wang, Wen Zheng, Zhuotong Zhou 等ASE 2024 · 4 次引用
- What the Fork? Finding Hidden Code Clones in npmElizabeth Wyss, Lorenzo De Carli, Drew DavidsonICSE 2022 · 10 次引用
- Cutting the Gordian Knot: Detecting Malicious PyPI Packages via a Knowledge-Mining FrameworkWenbo Guo, Chengwei Liu, Ming Kang, Yiran Zhang 等USENIX Security 2026 · 1 次引用
