MalPacDetector: An LLM-Based Malicious NPM Package Detector
The Node Package Manager (NPM) registry contains millions of JavaScript packages widely shared between worldwide developers. However, NPM has also been abused by attackers to spread malicious packages, highlighting the importance of detecting malicious NPM packages. Existing malicious NPM package detectors suffer from, among other things, high false positives and/or high false negatives. In this paper, we propose a novel Malicious NPM Package Detector (MalPacDetector), which leverages Large Language Model (LLM) to automatically and dynamically generate features (rather than asking experts to manually define them). To evaluate the effectiveness of Mal-PacDetector and existing detectors, we construct a new NPM package dataset, which overcomes the weaknesses of existing datasets (e.g., a small number of examples and a high repetition rate of malicious fragments). The experimental results show that MalPacDetector outperforms existing detectors by achieving a false positive rate of 1. 3% and a false negative rate of 7. 5%. In particular, MalPacDetector detects 39 previously unknown malicious packages, which are confirmed by the NPM security team.
Authors
- Shouhuai Xu (ORCID: https://orcid.org/0000-0001-8034-0942)
- Hai Jin (ORCID: https://orcid.org/0000-0002-3934-7605)
- Jun‐e Qu (ORCID: https://orcid.org/0000-0002-9128-3725)
- Z. Wang (ORCID: https://orcid.org/0000-0001-5802-6949)
- Deqing Zou (ORCID: https://orcid.org/0000-0001-8534-5048)
- Zhen Li (ORCID: https://orcid.org/0000-0002-0001-2998)
- Jian Wang (ORCID: https://orcid.org/0000-0003-3600-9624)
- Z. Xu
Institutions
- Jilian Technology Group (China) (CN)
- Huazhong University of Science and Technology (CN)
- University of Colorado Colorado Springs (US)
Publication Details
- Journal
- IEEE Transactions on Information Forensics and Security
- Published
- 2025-01-01
- DOI
- https://doi.org/10.1109/tifs.2025.3580336
- Citations
- 3
- Primary Topic
- Network Security and Intrusion Detection
- Type
- article
- Field-Weighted Citation Impact
- 4.46
Funders
- National Natural Science Foundation of China