LLM-Enhanced Hierarchical Heterogeneous Graph Representation Learning for Malicious Python Package Detection
Not on the map. Why?
Abstract (arXiv)
Malicious Python packages have become a major threat to software supply chain ecosystems due to the widespread adoption of open-source repositories such as PyPI. Existing learning-based detection methods struggle to capture the hierarchical organization and heterogeneous interactions among different program entities. Although Large Language Models (LLMs) have demonstrated strong capabilities in code understanding and semantic reasoning, they are rarely integrated with structural program representations for fine-grained malicious behavior analysis. In this paper, we propose an LLM-enhanced hierarchical heterogeneous graph representation learning framework for malicious Python package detection. The framework constructs a hierarchical heterogeneous code graph that explicitly models heterogeneous code entities and different types of structural dependencies. LLMs are further leveraged to infer function-level semantic roles, introducing an additional layer of semantic heterogeneity. Based on this graph, we develop a hierarchical heterogeneous graph neural network that performs type-aware message passing over different node and edge categories, effectively modeling malicious behavior propagation for accurate package-level classification. The framework also incorporates a function-level attribution mechanism which, combined with LLM reasoning, automatically identifies suspicious functions and localizes fine-grained malicious behaviors without human expert intervention. Extensive experiments on real-world datasets show that our framework consistently outperforms traditional machine learning methods, graph-based detectors, and state-of-the-art LLMs across packages with varying sizes and dependency complexities, while providing accurate, robust, and interpretable malicious behavior localization.
Key facts. No citing papers in the map yet (data through 14 Oct 2026). Builds on 25 of its 50 references that are in the map. First posted on arXiv 3 Jul 2026.
Builds on
25 of 50 references.
References · 25
- 2024The Llama 3 Herd of Modelscited by 14,715
- 2025Qwen3 Technical Reportcited by 8,820
- 2025DeepSeek-R1: Incentivizing Reasoning Capability in LLMs via Reinforcement Learningcited by 6,330
- 2024Qwen2.5 Technical Reportcited by 4,942
- 2023Code Llama: Open Foundation Models for Codecited by 2,139
- 2020CodeBERT: A Pre-Trained Model for Programming and Natural Languagescited by 1,310
- 2019Heterogeneous Graph Attention Networkcited by 734
- 2020GraphCodeBERT: Pre-training Code Representations with Data Flowcited by 609
- 2020Heterogeneous Graph Transformercited by 582
- 2020MAGNN: Metapath Aggregated Graph Neural Network for Heterogeneous Graph Embeddingcited by 304
- 2019Devign: Effective Vulnerability Identification by Learning Comprehensive Program Semantics via Graph Neural Networkscited by 272
- 2024Vulnerability Detection with Code Language Models: How Far Are We?cited by 139
13 more
- 2020Backstabber's Knife Collection: A Review of Open Source Software Supply Chain Attackscited by 61
- 2022Taxonomy of Attacks on Open-Source Software Supply Chainscited by 58
- 2019Small World with High Risks: A Study of Security Threats in the npm Ecosystemcited by 37
- 2023An Empirical Study of Malicious Code In PyPI Ecosystemcited by 19
- 2023Killing Two Birds with One Stone: Malicious Package Detection in NPM and PyPI using a Single Model of Malicious Behavior Sequencecited by 9
- 2022Practical Automated Detection of Malicious npm Packagescited by 8
- 2019Intriguing Properties of Adversarial ML Attacks in the Problem Space [Extended Version]cited by 7
- 2022A Benchmark Comparison of Python Malware Detection Approachescited by 7
- 2025MalGuard: Towards Real-Time, Accurate, and Actionable Detection of Malicious Packages in PyPI Ecosystemcited by 5
- 2020SpellBound: Defending Against Package Typosquattingcited by 4
- 2021Containing Malicious Package Updates in npm with a Lightweight Permission Systemcited by 2
- 2019Security Issues in Language-based Software Ecosystemscited by 1
- 2026Efficient Code Analysis via Graph Representation Learning-Guided Large Language Modelscited by 1
Built on by
Not cited yet.
Similar, not cited
Close in wording, no citation either way
- 2026Bridging Expert Reasoning and LLM Detection: A Knowledge-Driven Framework for Malicious Packages ↗
- 2026Many Hands Make Light Work: An LLM-based Multi-Agent System for Detecting Malicious PyPI Packages
- 2026CHASE: LLM Agents for Dissecting Malicious PyPI Packages
- 2026ProfMalPlus: Agent-Coordinated Detection of Malicious NPM Packages via Static-Dynamic Analysis Synergy ↗
- 2026Bridging Code Property Graphs and Language Models for Program Analysis ↗
- 2026PYPILINE: Malicious PyPI Package Detection via Suspicious API Knowledge and Agent Workflow
- 2026Taint-Style Vulnerability Detection and Confirmation for Node.js Packages Using LLM Agent Reasoning
- 2026Bayesian-Calibrated Detection of Hallucinated Package Imports in AI-Assisted Code ↗