arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2607.03350cs.CRcs.AIcs.SE
收藏

用于恶意Python包检测的基于大语言模型增强的分层异构图表示学习

LLM-Enhanced Hierarchical Heterogeneous Graph Representation Learning for Malicious Python Package Detection

Institute of Software, Chinese Academy of Sciences(中国科学院软件研究所);University of Chinese Academy of Sciences(中国科学院大学)

Hang Gao, Xiaoyu Chen, Baoquan Cui, Zhen Tang, Peng Qiao, Fengge Wu, Jian Zhang

AI总结:

提出用于恶意Python包检测的LLM增强分层异构图表示学习框架,构建分层异构代码图,利用LLMs推理功能语义角色,开发分层异构图神经网络并结合功能级归因机制,实验表明该框架性能优越。

摘要:

恶意Python包对软件供应链生态系统构成重大威胁,现有方法难以捕捉程序实体的层次组织和异构交互。本文提出LLM增强的分层异构图表示学习框架用于恶意Python包检测,构建分层异构代码图,利用LLMs推断功能级语义角色,开发分层异构图神经网络并结合功能级归因机制,实验表明该框架性能优越。

英文摘要:

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.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑