arXiv:2510.14036cs.SEcs.AI2025-10被引 6

用大模型找代码中反复出现的漏洞,一次发现上千个潜在问题。

One Bug, Hundreds Behind: LLMs for Large-Scale Bug Discovery

  • 基于已修复漏洞模式,用LLM扫描全程序找相似错误。
  • 在Linux内核中发现2.2万+潜在问题,验证率达61.5%。
  • 构建首个公开的重复漏洞模式数据集,适合安全研究者使用。

大型程序中的漏洞修复耗时费力,且常存在未被发现的相似漏洞。本文提出BugStone系统,利用LLM与LLVM分析代码,通过一个已修复实例识别重复性错误模式(如特定API误用)。该方法在Linux内核中发现了超过22,000个潜在问题,400个样本人工验证后确认246个为真实漏洞。同时构建包含1,900+安全漏洞的数据集,标注出80个重复模式及850个对应修复方案。即使采用低成本模型,仍达到92.2%精确率和79.1%成对准确率,有效提升大规模漏洞发现效率与安全性。

原文摘要 · Abstract (English)

Fixing bugs in large programs is a challenging task that demands substantial time and effort. Once a bug is found, it is reported to the project maintainers, who work with the reporter to fix it and eventually close the issue. However, across the program, there are often similar code segments, which may also contain the bug, but were missed during discovery. Finding and fixing each recurring bug instance individually is labor intensive. Even more concerning, bug reports can inadvertently widen the attack surface as they provide attackers with an exploitable pattern that may be unresolved in other parts of the program. In this paper, we explore these Recurring Pattern Bugs (RPBs) that appear repeatedly across various code segments of a program or even in different programs, stemming from a same root cause, but are unresolved. Our investigation reveals that RPBs are widespread and can significantly compromise the security of software programs. This paper introduces BugStone, a program analysis system empowered by LLVM and a Large Language Model (LLM). The key observation is that many RPBs have one patched instance, which can be leveraged to identify a consistent error pattern, such as a specific API misuse. By examining the entire program for this pattern, it is possible to identify similar sections of code that may be vulnerable. Starting with 135 unique RPBs, BugStone identified more than 22K new potential issues in the Linux kernel. Manual analysis of 400 of these findings confirmed that 246 were valid. We also created a dataset from over 1.9K security bugs reported by 23 recent top-tier conference works. We manually annotate the dataset, identify 80 recurring patterns and 850 corresponding fixes. Even with a cost-efficient model choice, BugStone achieved 92.2% precision and 79.1% pairwise accuracy on the dataset.

漏洞发现大模型代码安全

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。