How Effective Are NPM Malicious Package Detectors? A Large-Scale Empirical Study

arXiv:2603.27549 · cs.SE · Submitted 2026-03-29 · Read on arXiv

Listen

Radio episode about this paper

Transcript

Introduction to the show: ident: Computer Science. The day in computer science: software, systems and theory on arXiv.

Tom: I'm Tom.

Jane: And I'm Jane, here with Lu, Meng and our in-house large language model, Lalam.

Tom: We're looking at the paper: "How Effective Are NPM Malicious Package Detectors? A Large-Scale Empirical Study".

Paper summary: Tom: Looking at what we've covered about this study, the main thing is that we have moved beyond just looking at raw detection percentages. The work by Guo et al. on "How Effective Are NPM Malicious Package Detectors? A Large-Scale Empirical Study" shows us that there are deep structural principles governing tool performance >

Jane: Right, so the core message isn't that one specific tool is the best all around, but rather understanding capability intent ambiguity and behavioral coupling as reasons why certain detection signals get amplified or suppressed >

Lu: It also showed us that attack surface mismatch leaves twenty one percent of malware structurally invisible to code-analysis tools, which is a big limitation we need to address in our model design >

Meng: From my side, the implication for production is that we should focus less on finding the single best static analyzer and more on building systems that strategically combine tools where they have complementary strengths and use intersection strategies to filter out noise >

Lalam: The paper confirms that this combination-minus-false-positive introduction principle governs how well tools work together, suggesting that strategic pairing is more important than just paradigm diversity >

Tom: So, to wrap up, the big picture here is that for anyone building a security tool for NPM, you need to look at these structural principles—how those behaviors are coupled and what the mismatches between code analysis and malware targets are—not just the final score on a single test set >

Jane: That's right. The paper gives us the framework to design tools that are more robust because we’re looking for the mechanism of success, not just the outcome of a single measurement >

Conclusion: Tom: So, we’ve been looking at this large study on NPM malicious package detectors, and now we need to talk about what they actually found in the conclusion of "How Effective Are NPM Malicious Package Detectors? A Large-Scale Empirical Study."

Jane: It boils down to this—the paper isn't just telling us which tool is the best; it’s trying to explain *why* some tools work while others fail. They tested eleven different tools and sixteen variations against a big set of malicious and safe packages.

Lu: The authors found that the main issue isn't just having a good tool, but understanding how that tool's capability matches what the malware is trying to do. They pinpoint capability intent ambiguity as the root cause for why tools sometimes get their precision and recall off track from each other.

Meng: That means if you’re building a system, you can’t just pick one static analyzer and expect it to nail everything because some behaviors are structurally invisible to that specific type of code analysis.

Lalam: Exactly. The study shows that when malware does two things at once, like collect and then exfiltrate data, the detection signal gets way stronger—jumping from about three percent up to nearly eighty percent for those specific chains. That’s a huge amplification effect we need to keep in mind.

Jane: So, what does this mean for someone just trying to protect their own code or their build process? It suggests that pairing tools together might actually be more effective than relying on one monolithic solution alone.

Tom: I see it as needing a strategic approach. The paper looks at tool combinations and finds that smart pairings can hit ninety-seven percent accuracy, which is higher than any single tool could manage by itself. It’s about finding the right complementary strengths, not just chasing the highest individual score on a test set.

Lu: And they suggest that intersection strategies—where you require two different tools to both agree on something—can be really powerful because it filters out the noise from both tools independently.

Meng: From my side, what I’m hearing is that deploying a tool in isolation is risky; combining them with a way to check for agreement sounds like a necessary step for production reliability.

Jane: It definitely shifts the focus from just measuring detection rates to understanding the underlying structural logic of how those tools interact with each other and the malware. Next up, we’ll look at what specific mechanisms cause that signal amplification you mentioned.

Nanyang Technological University, Singapore, Singapore · ¦Sichuan University, Chengdu, China · ¦Imperial Global Singapore, Singapore, Singapore · Nankai University, Tianjin, China · ¦Sichuan University, Chengdu, China · Singapore Management University, Singapore

cs.SE

Submitted: 2026-03-29

Updated: 2026-11-20

DOI: 10.1145/3832783.3837427

Code: https://github.com/DataDog/malicious-software-packages-dataset

License: http://creativecommons.org/publicdomain/zero/1.0/

Importance score: 99/100

The gist: The paper presents the first large-scale empirical study of NPM malicious package detection, evaluating 11 tools with 16 variants on a unified benchmark to explain why tools succeed or fail.

Key concepts

Capability-Intent Ambiguity
This concept explains why some tools struggle with precision versus recall. It suggests that the tools often fail because they cannot clearly distinguish between what a piece of code *can* do (its capability) and what malicious *intent* it has, leading to trade-offs in how accurately they flag threats.
Behavioral Coupling
This describes how the detection signal is amplified when multiple malicious behaviors happen together. When different suspicious actions occur simultaneously, the combined signal becomes much stronger than individual signals, significantly boosting detection rates for complex attack chains.
Tool Complementarity
This analyzes how well different tools work together. The study finds that combining tools is most effective when they are complementary—meaning their strengths fill each other's gaps—rather than just using a wide variety of different detection methods.

Terminology

Summary

The paper presents the first large-scale empirical study of NPM malicious package detection, evaluating 11 tools with 16 variants on a unified benchmark to explain why tools succeed or fail. p. 0

Where the paper says it

We present the first large-scale empirical study of NPM malicious package detection, evaluating 11 tools with 16 variants on a unified benchmark of 6,420 malicious and 7,288 benign packages annotated with 11 behavior categories and 8 evasion techniques. Unlike prior work, we inspect each tool’s source code to explain why tools succeed or fail, not merely how often.

This work matters because it moves beyond simply measuring detection rates to inspecting source code to uncover the structural mechanisms behind tool performance. p. 1
Where the paper says it

(2) Large-scale Evaluation. We evaluate 11 tools (16 variants) and, unlike prior benchmarks that treat tools as black boxes, inspect each tool’s source code to identify the structural mechanisms behind its performance.

Pruning redundant reasoning tokens

The study evaluates 11 tools with 16 variants on a unified benchmark of 6,420 malicious and 7,288 benign packages annotated with 11 behavior categories and 8 evasion techniques. The key findings reveal structural principles such as capability-intent ambiguity as the root cause of precision-recall trade-offs. p. 2

Where the paper says it

A Large-Scale Empirical Study ASE ’26, October 12–16, 2026, Munich, Germany (3) Novel findings. We identify five structural principles: (i) capability-intent ambiguity as the root cause of precisionrecall trade-offs; (ii)concept convergence driving ML temporal degradation; (iii) attack surface mismatch leaving 21% of malware structurally undetectable by code-analysis tools; (iv) behavioral coupling amplification boosting detection signals by up to 76 percentage points; and (v) complementarity-minusFP-introduction as the governing principle of tool combination effectiveness.

Furthermore, behavioral coupling amplifies detection signals when behaviors co-occur, raising SAP DT from 3. p. 0
Where the paper says it

98% by grounding its judgment in retrieved evidence and GuardDog the best among conventional tools at 93. 32%; (2) behavioral coupling amplifies detection signals when behaviors co-occur, raising SAP_DT from 3.

2% to 79.3% for the collect-and-exfiltrate chain. p. 0
Where the paper says it

32%; (2) behavioral coupling amplifies detection signals when behaviors co-occur, raising SAP_DT from 3. 3% for the collect-and-exfiltrate chain; (3) 80.

p. 0
Where the paper says it

32%; (2) behavioral coupling amplifies detection signals when behaviors co-occur, raising SAP_DT from 3. 3% for the collect-and-exfiltrate chain; (3) 80.

The combination effectiveness is governed by complementarity minus false-positive introduction rather than paradigm diversity. p. 1
Where the paper says it

02% F1, above any single tool, though the margin narrows as the best single tool improves. Combination effectiveness depends on complementarity minus false-positive introduction rather than paradigm diversity, since a high-recall, low-precision partner can degrade a strong tool (RQ4).

How the training signal is built

The dataset construction involved systematic collection of NPM malware packages from academic datasets and public security advisories, resulting in a curated dataset of 6,420 malicious versions across 4,286 unique packages. This process included deduplication and manual verification by three security experts to ensure ground truth quality, achieving a three-way consensus rate of 97. p. 3

Where the paper says it

Source datasets may contain false positives due to mislabeling or outdated annotations. To ensure ground truth quality, three security experts holding PhDs in software supply chain security independently review each package.

4%. The malicious behavior taxonomy was constructed through manual code localization, context extraction using GPT-4. p. 3
Where the paper says it

Table 2 summarizes the final dataset statistics and sources. 3 Malicious Behavior Taxonomy To enable fine-grained analysis of detection capabilities, we construct a taxonomy of malicious behaviors through three steps: malicious code localization, context extraction, and behavior clustering.

1, and subsequent clustering of behavioral summaries. p. 3
Where the paper says it

Behavior Summary and Clustering. From each extracted code context, we prompt the LLM to generate a structured behavioral summary that captures (i) the triggering condition/entry point, (ii) the main malicious actions (e.

Where the gains come from

The detection performance varies dramatically across paradigms, with IntelGuard reaching the best F1 at 95.98% by grounding its judgment in retrieved evidence. p. 0

Where the paper says it

Our key findings: (1) the precision and recall a tool achieves are structurally determined by how it resolves the ambiguity between code capability and malicious intent, with IntelGuard reaching the best F1 at 95. 98% by grounding its judgment in retrieved evidence and GuardDog the best among conventional tools at 93.

Behavioral coupling amplifies detection signals when behaviors co-occur, raising SAP DT from 3. p. 0
Where the paper says it

98% by grounding its judgment in retrieved evidence and GuardDog the best among conventional tools at 93. 32%; (2) behavioral coupling amplifies detection signals when behaviors co-occur, raising SAP_DT from 3.

2% to 79.3% for the collect-and-exfiltrate chain. Attack surface misalignment makes certain behaviors structurally undetectable, such as web injection targeting browser-side DOM while tools analyze Node. p. 6
Where the paper says it

Behavioral coupling amplifies intent signals when behaviors co-occur: the collection+exfiltration chain raises SAP_DT detection from 3. Attack surface misalignment makes certain behaviors structurally undetectable: web injection targets browser-side DOM while tools analyze Node.

js code. Temporal degradation in ML tools is driven by concept convergence, where malware became simpler and every decision boundary fitted to a corpus ages with it. p. 0
Where the paper says it

3% for the collect-and-exfiltrate chain; (3) 80. 3% of malware uses no evasion because the ecosystem lacks mandatory pre-publication scanning; (4) ML degradation is driven by concept convergence rather than concept drift, since malware became simpler and every decision boundary fitted to a corpus ages with it; (5) combination effectiveness equals complementarity ∗Corresponding author.

Tool Complementarity Analysis

The analysis of tool combinations shows that strategic combinations reach up to 97.21% accuracy and 97. p. 0

Where the paper says it

Strategic combinations reach up to 97. 21% accuracy and 97.

02% F1, above any single tool. p. 1
Where the paper says it

21% accuracy and 97. 02% F1, above any single tool, though the margin narrows as the best single tool improves.

The principle governing combination effectiveness is complementarity minus false-positive introduction rather than paradigm diversity. p. 1
Where the paper says it

02% F1, above any single tool, though the margin narrows as the best single tool improves. Combination effectiveness depends on complementarity minus false-positive introduction rather than paradigm diversity, since a high-recall, low-precision partner can degrade a strong tool (RQ4).

For instance, IntelGuard + MalPac SVM achieves the best union F1 at 97. p. 9
Where the paper says it

Table 7 and Figure 8 present the top combinations across all 15 tool variants. For union, IntelGuard + MalPac_SVM achieves the best F1 at 97.

02%, and the gain over the stronger tool alone shrinks as that tool grows stronger. p. 9
Where the paper says it

23 Note: Δ is the F1 gain over the stronger of the two tools used alone. Union flags a package when either tool detects it; Intersection requires both.

Intersection strategy, such as Packj static + IntelGuard, succeeds where union fails because requiring both tools to agree filters out each tool’s independent false positives. p. 9
Where the paper says it

This reflects a structural shift from 2021-era full reconnaissance attacks, which collected hostname, environment OSSGadget GENIE Packj-T SAP-RF Cerebro MalPac-NB ProfMal IntelGuard GuardDog Packj-S SAP-DT SAP-XGB MalPac-MLP MalPac-SVM Socket. AI (a) Union: TP (b) Union: TN (c) Intersection: TP (d) Intersection: TN 3000 4000 5000 6000 2000 4000 6000 2000 3000 4000 5000 6000 2000 4000 6000 Figure 8: Complementary Analysis of Detection Tools: TP/TN Performance Matrix Table 7: Top Tool Combinations and Their Gain over the Stronger Single Tool Union Strategy Intersection Strategy Combination Prec.

Green — the paper says it, and the page is printed. Red — no passage carries it, so treat that sentence as unverified. The same check runs on your own text: check a summary against its source, $5.

Improvements for AI systems

  1. Taint analysis should be used as a primary evidence source to resolve capability-intent ambiguity, as it allows tools to flag any invocation of sensitive APIs regardless of context while providing a structural mechanism for intent judgment.

  2. Behavioral coupling should be explicitly modeled in detection logic to amplify signals, specifically by recognizing that the collection+exfiltration chain raises SAP DT detection from 3.2% to 79.3% when behaviors co-occur.

  3. ML models should be trained or fine-tuned with a focus on concept stability rather than relying solely on feature space fitting, as the paper demonstrates that concept convergence driving ML temporal degradation is driven by malware becoming simpler, not just evolving.

  4. LLM reasoning systems should be grounded in retrieved threat intelligence rather than self-challenge loops to maintain high recall, as Anchoring the judgment to retrieved evidence, rather than asking the model to challenge itself preserves 93.82% recall at 98.24% precision.

  5. Detection strategies should prioritize installation script analysis for structural integrity; since 72.21% of malicious packages exploit install scripts because npm lifecycle hooks guarantee execution without sandboxing, focusing on this area provides a robust detection surface against architectural blind spots.

Abstract

The NPM ecosystem faces escalating threats from malicious packages that exploit its open publication model. While numerous detection tools have been proposed, they are evaluated on disparate datasets with inconsistent settings, making cross-tool comparison unreliable and leaving practitioners without clear guidance. We present the first large-scale empirical study of NPM malicious package detection, evaluating 11 tools with 16 variants on a unified benchmark of 6,420 malicious and 7,288 benign packages annotated with 11 behavior categories and 8 evasion techniques. Unlike prior work, we inspect each tool's source code to explain why tools succeed or fail, not merely how often. Our key findings: (1) the precision and recall a tool achieves are structurally determined by how it resolves the ambiguity between code capability and malicious intent, with IntelGuard reaching the best F1 at 95.98% by grounding its judgment in retrieved evidence and GuardDog the best among conventional tools at 93.32%; (2) behavioral coupling amplifies detection signals when behaviors co-occur, raising SAP DT from 3.2% to 79.3% for the collect-and-exfiltrate chain; (3) 80.3% of malware uses no evasion because the ecosystem lacks mandatory pre-publication scanning; (4) ML degradation is driven by concept convergence rather than concept drift, since malware became simpler and every decision boundary fitted to a corpus ages with it; (5) combination effectiveness equals complementarity minus false-positive introduction, not paradigm diversity. Strategic combinations reach up to 97.21% accuracy and 97.02% F1. We release our benchmark and evaluation framework.

Related papers