The prevalence of malicious packages in open-source repositories, such as PyPI, poses a critical threat to the software supply chain. While Large Language Models (LLMs) have emerged as a promising tool for automated security tasks, their effectiveness in detecting malicious packages and indicators remains underexplored. This paper presents a systematic evaluation of 13 LLMs for detecting malicious software packages. Using a curated dataset of 4,070 packages (3,700 benign and 370 malicious), we evaluate model performance across two tasks: binary classification (package detection) and multi-label classification (identification of specific malicious indicators). We further investigate the impact of prompting strategies, temperature settings, and model specifications on detection accuracy. We find a significant "granularity gap" in LLMs' capabilities. While GPT-4.1 achieves near-perfect performance in binary detection (F1 $\approx$ 0.99), performance degrades by approximately 41\% when the task shifts to identifying specific malicious indicators. We observe that general models are best for filtering out the majority of threats, while specialized coder models are better at detecting attacks that follow a strict, predictable code structure. Our correlation analysis indicates that parameter size and context width have negligible explanatory power regarding detection accuracy. We conclude that while LLMs are powerful detectors at the package level, they lack the semantic depth required for precise identification at the granular indicator level.


翻译:开源存储库(如PyPI)中恶意软件包的盛行对软件供应链构成严重威胁。尽管大语言模型已成为自动化安全任务中极具前景的工具,但其在检测恶意软件包及攻击特征方面的有效性仍未得到充分探索。本文对13种大语言模型在恶意软件包检测方面进行了系统性评估。基于精心构建的包含4,070个软件包(3,700个良性包与370个恶意包)的数据集,我们评估了模型在两项任务上的表现:二元分类(软件包检测)与多标签分类(特定恶意特征标识)。我们进一步研究了提示策略、温度设置及模型规格对检测准确率的影响。研究发现大语言模型能力存在显著的"粒度鸿沟":GPT-4.1在二元检测中达到近乎完美的性能(F1 $\approx$ 0.99),但当任务转向识别具体恶意特征时,性能下降约41%。我们观察到通用模型最适合过滤大多数威胁,而专用编程模型更擅长检测遵循严格、可预测代码结构的攻击。相关性分析表明,参数规模与上下文宽度对检测准确率的解释力可忽略不计。结论指出,虽然大语言模型在软件包层面是强大的检测工具,但缺乏在细粒度特征层面进行精确识别所需的语义深度。

0
下载
关闭预览

相关内容

软件(中国大陆及香港用语,台湾作软体,英文:Software)是一系列按照特定顺序组织的计算机数据和指令的集合。一般来讲软件被划分为编程语言、系统软件、应用软件和介于这两者之间的中间件。软件就是程序加文档的集合体。
《基于动态图神经网络的恶意软件检测》
专知会员服务
14+阅读 · 1月28日
大型语言模型系统中提示缺陷的分类学
专知会员服务
8+阅读 · 2025年9月19日
大语言模型评估技术研究进展
专知会员服务
48+阅读 · 2024年7月9日
大模型报告:模型能力决定下限,场景适配度决定上限
专知会员服务
57+阅读 · 2024年6月3日
大型语言模型网络安全综述
专知会员服务
67+阅读 · 2024年5月12日
大型语言模型在预测和异常检测中的应用综述
专知会员服务
70+阅读 · 2024年2月19日
大语言模型安全现状与挑战
专知会员服务
87+阅读 · 2024年1月14日
专知会员服务
19+阅读 · 2021年6月10日
深度学习模型不确定性方法对比
PaperWeekly
20+阅读 · 2020年2月10日
iOS如何区分App和SDK内部crash
CocoaChina
11+阅读 · 2019年4月17日
国家自然科学基金
6+阅读 · 2017年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
2+阅读 · 2015年12月31日
国家自然科学基金
19+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
1+阅读 · 2014年12月31日
国家自然科学基金
4+阅读 · 2014年12月31日
VIP会员
相关VIP内容
《基于动态图神经网络的恶意软件检测》
专知会员服务
14+阅读 · 1月28日
大型语言模型系统中提示缺陷的分类学
专知会员服务
8+阅读 · 2025年9月19日
大语言模型评估技术研究进展
专知会员服务
48+阅读 · 2024年7月9日
大模型报告:模型能力决定下限,场景适配度决定上限
专知会员服务
57+阅读 · 2024年6月3日
大型语言模型网络安全综述
专知会员服务
67+阅读 · 2024年5月12日
大型语言模型在预测和异常检测中的应用综述
专知会员服务
70+阅读 · 2024年2月19日
大语言模型安全现状与挑战
专知会员服务
87+阅读 · 2024年1月14日
专知会员服务
19+阅读 · 2021年6月10日
相关基金
国家自然科学基金
6+阅读 · 2017年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
2+阅读 · 2015年12月31日
国家自然科学基金
19+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
1+阅读 · 2014年12月31日
国家自然科学基金
4+阅读 · 2014年12月31日
Top
微信扫码咨询专知VIP会员