arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2502.06898cs.SEcs.AI
收藏

大语言模型用于文件内漏洞定位可能会“在末尾迷失”

Large Language Models for In-File Vulnerability Localization Can Be "Lost in the End"

Collegium Helveticum ETH Zurich(苏黎世联邦理工学院赫尔维蒂库姆学院);University of Zurich(苏黎世大学)

Francesco Sovrano, Adam Bauer, Alberto Bacchelli

AI总结:

本文评估GPT等基于聊天的LLMs检测文件内漏洞的有效性,发现其性能受漏洞位置和输入大小影响,较大文件末尾漏洞检测性能显著下降(“在末尾迷失”效应),并提出最佳输入大小策略,使平均召回率提升超37%。

摘要:

近年来人工智能的进步使得处理更大规模的输入成为可能,这让日常软件开发人员越来越依赖GPT-3.5和GPT-4等基于聊天的大语言模型(LLMs)来检测整个文件而非仅函数内的漏洞。这种新的开发实践要求研究人员紧急调查常用LLMs是否能有效分析大文件大小的输入,以便及时为软件开发人员和工程师提供关于这一新兴技术趋势利弊的见解。因此,本文的目标是评估包括GPT模型在内的几种最先进的基于聊天的LLMs在检测文件内漏洞方面的有效性。我们开展了一项成本高昂的调查,研究LLMs的性能如何随漏洞类型、输入大小以及漏洞在文件中的位置而变化。为了给研究提供足够的统计效力,我们只能聚焦于三种最常见(且危险)的漏洞:XSS、SQL注入和路径遍历。我们的研究结果表明,LLMs检测这些漏洞的有效性受漏洞位置和输入整体大小的强烈影响。具体而言,无论漏洞类型如何,当检测位于较大文件末尾的漏洞时,LLMs的性能往往显著(p < .05)下降,我们将这种模式称为“在末尾迷失”效应。最后,为了进一步支持软件开发人员和从业者,我们还探索了这些LLMs的最佳输入大小,并提出了一种识别该大小的简单策略,该策略可应用于其他模型和漏洞类型。最终,我们展示了调整输入大小如何能显著提升基于LLM的漏洞检测效果,所有模型的平均召回率提升超过37%。

英文摘要:

Recent advancements in artificial intelligence have enabled processing of larger inputs, leading everyday software developers to increasingly rely on chat-based large language models (LLMs) like GPT-3.5 and GPT-4 to detect vulnerabilities across entire files, not just within functions. This new development practice requires researchers to urgently investigate whether commonly used LLMs can effectively analyze large file-sized inputs, in order to provide timely insights for software developers and engineers about the pros and cons of this emerging technological trend. Hence, the goal of this paper is to evaluate the effectiveness of several state-of-the-art chat-based LLMs, including the GPT models, in detecting in-file vulnerabilities. We conducted a costly investigation into how the performance of LLMs varies based on vulnerability type, input size, and vulnerability location within the file. To give enough statistical power to our study, we could only focus on the three most common (as well as dangerous) vulnerabilities: XSS, SQL injection, and path traversal. Our findings indicate that the effectiveness of LLMs in detecting these vulnerabilities is strongly influenced by both the location of the vulnerability and the overall size of the input. Specifically, regardless of the vulnerability type, LLMs tend to significantly (p < .05) underperform when detecting vulnerabilities located toward the end of larger files, a pattern we call the 'lost-in-the-end' effect. Finally, to further support software developers and practitioners, we also explored the optimal input size for these LLMs and presented a simple strategy for identifying it, which can be applied to other models and vulnerability types. Eventually, we show how adjusting the input size can lead to significant improvements in LLM-based vulnerability detection, with an average recall increase of over 37% across all models.

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

↑