Skip to content
Open access

PDCG-RuleDetector: parameterized data-flow call graphs meet large language models for malicious NPM package detection

Aug 2026 · Journal of King Saud University: Computer and Information Sciences · Vol 38 · 0 citations · 63 references

TL;DR

The PDCG-RuleDetector framework is validated on widely used datasets and shows good generalization capability, and during 10 days of real-world deployment, the framework identified 152 malicious packages among 107,802 newly published NPM packages.

Abstract

With the widespread use of open-source components in modern software development, reusing third-party code improves development efficiency while also intensifying security risks in the software supply chain. As the largest open-source package registry in the world, NPM (Node Package Manager) has become a primary target for supply chain attacks. Existing methods for detecting malicious NPM packages face two main challenges. First, traditional program graphs used to represent source code (e.g., Abstract Syntax Tree (AST) and Call Graph (CG)) have limited capability in characterizing malicious behaviors inside code, thereby affecting analysis efficiency and detection accuracy. Second, matching rules for identifying malicious packages mostly rely on manual definition. This process is time-consuming and labor-intensive, and the accuracy of these rules needs improvement. To address these challenges, this paper proposes the PDCG-RuleDetector framework to detect malicious NPM packages. First, this paper uses the proposed Parameterized Data-flow Call Graph (PDCG) to represent script files in NPM packages, and leverages a Large Language Model (LLM) to automatically extract sensitive behavior matching rules from malicious NPM packages, constructing a sensitive behavior matching rule library. Then, this paper marks sensitive nodes in the PDCG according to the rules in the rule library, generates feature vectors from the PDCG, and trains a classifier to detect malicious NPM packages. The effectiveness of the PDCG-RuleDetector framework is validated on widely used datasets. On the MalnpmDB dataset, the proposed model achieves an F1 score of 96.2%, which is better than existing detection methods. On the Robust and Datadog datasets, the F1 scores are 91.2% and 94.9%, respectively. These results show good generalization capability. More importantly, during 10 days of real-world deployment, the framework identified 152 malicious packages among 107,802 newly published NPM packages. All of them were verified and removed by the official NPM security team.

Read PDF

Similar papers

Preprint Sep 2026

DistillGuard: Malicious NPM Package Detection and API Attack Chain Analysis via Static Graph and LLM Distillation

The Node.js ecosystem heavily relies on NPM packages, and software supply chain attacks targeting malicious NPM packages are rampant. Malicious code primarily triggers during package installation, import, and runtime. Traditional static analysis fails to understand code semantics; machine learning-based methods rely on...

Si-Yuan Pang, Ye-Peng Yao, Zheng-Wei Jiang et al. · 0 citations
Preprint Sep 2026

CASHEWS: Source Preprocessor for LLM-based Malicious Package Detection

Malicious npm package detection tools now leverage LLMs'semantic understanding of source code to detect malicious intent at scale. This capability has proven invaluable in identifying packages involved in recent supply-chain attacks such as Shai-Hulud. However, threat actors exploit the limited context windows of LLMs...

Jean-Charles Noirot Ferrand, David Adei, Anders Møller et al. · 0 citations
Open access Sep 2026

On-Premise CodeBERT-Driven Model for Vulnerability Detection in Source Code

An on premise Artificial Intelligence (AI)-based model for vulnerability detection in source code, designed to ensure there is efficiency in identifying potential weaknesses, and deployed locally within a Dockerized environment.

D. Sako · 0 citations
Review Open access 2026

Security Analysis of LLM-Generated Web API Backends

A security assessment on 75 FastAPI backends generated by three contemporary LLMs revealed a disconnect between functional correctness and secure logic, which is interpreted as a review-risk pattern, which is called the human-in-the-loop paradox.

Abdul Ali Khan, S. Rauti, T. Mäkilä · 0 citations
Open access Oct 2026

CLASScanner: Efficient C++ Class Recovery from Binaries Driven by Object Flow Graphs

C++ class recovery is fundamental to reverse engineering, serving as a basis for critical downstream tasks such as vulnerability analysis, malware comprehension, and decompiler output optimization. Existing approaches face several challenges, including dependency on virtual function tables and a lack of support for non...

Jia-Min Wang, Gong-Ming Wang, Song-Tao Yang et al. · 0 citations
Preprint Aug 2026

Finding Vulnerabilities via LLM-Augmented Semantics-Aware Type-Checking

SETYPE is presented, a semantics-aware type system that can be derived directly from source code based solely on the meanings of symbols and expressions in natural language that achieves 87% detection precision and 88% detection accuracy on real-world applications.

Ruizhe Wang, Meng Xu, N. Asokan · 0 citations

We use cookies to run the site and, with your consent, for analytics and to show ads. See our Cookie Policy.