TRANSMISSION // 2612.00291v1

How Well Can AI Localize Vulnerable Code?

Source published

A benchmark study finds that LLM agents often rank vulnerable code near the top, but results vary by task and multi-part flaws remain difficult to localize.

AI-generated conceptual illustration for How Well Can AI Localize Vulnerable Code?
AI-generated conceptual illustration; not documentary evidence.

A vulnerability report can describe what an attacker might do without naming the code responsible. A benchmark study tests whether software tools can connect reports to code—and how historical examples affect their results.

From a report to the responsible code

Security reports often describe a vulnerability’s symptoms, trigger or impact, not the exact functions involved. Developers must connect that account to code in a repository, a difficult task when the project is large or the flaw spans multiple locations. This study asks: given a third-party vulnerability report, can a tool identify where the vulnerability is implemented?

The researchers investigate whether past reports and fixes can help automate that search. Their results suggest that language-model agents can guide developers toward relevant code, but they do not reliably find every function needed for a repair.

Building a benchmark and testing approaches

The researchers created PrismVul, a benchmark of 6,851 vulnerability entries from 831 open-source projects and 11 programming languages. Each entry links a third-party report to vulnerable code locations. Across the benchmark, the authors identify 7,979 fix chains—sequences of commits associated with repairs. An entry can involve multiple locations or fix chains, so it does not necessarily correspond to one affected function or one repair sequence.

Building the benchmark required careful curation. The team removed irrelevant discussion and comments that revealed the fix from reports used as input. They also stripped explicit code-location clues from vulnerability summaries in public databases. To identify relevant functions among code changed by fixes, they used an AI agent to classify candidates and manually checked samples. In that validation, the agent’s function-identification accuracy was 92.31%.

The researchers compared statistical and machine-learning methods, code-retrieval systems, and language-model agents. They also tested two general bug-localization methods. Code retrieval matches report text to code; agents explore and inspect the vulnerable repository. Tests covered projects with enough of their own history and projects with limited histories, where information came from other projects. The main measure, Recall@5, asks what share of the known root-cause functions appear among the five highest-ranked suggestions. It does not measure whether a vulnerability is fixed.

Agents lead, but misses persist

Methods limited to suggesting locations already seen in historical examples struggled when a vulnerability involved different functions. In the within-project test set, 88.67% of entries had none of their root-cause functions in the corresponding project’s training set. Code retrieval and agents, which search code in the target repository, performed better overall than methods restricted to previously observed locations.

The strongest reported agent results reached 86.09% Recall@5 within projects and 81.76% across projects. Agents also outperformed the tested general bug-localization methods in the study’s comparisons. These figures describe performance on this benchmark and evaluation setup—not a guarantee of success on a new report.

Past reports helped both code retrieval and agents. The researchers also tested cleaned-up post-fix summaries from public vulnerability databases as historical examples. For agents, using these summaries instead of third-party reports reduced within-project Recall@5 by 2.09 to 3.05 percentage points. The substitution was less successful for fine-tuned code retrieval, whose Recall@5 fell by more than 27 points. The authors suggest agents can combine shorter descriptions with repository exploration, while retrieval methods depend more directly on information in the text.

Multi-location vulnerabilities remain difficult. For vulnerabilities spanning at least three functions or at least three files, reported agent results showed Hit@5 above 73% but Recall@5 below 55%. Hit@5 asks whether at least one root-cause function appears in the top five; Recall@5 measures how many relevant functions appear there. A system may therefore point to a useful location while missing much of the flaw. Identifying a relevant file also did not ensure that the right function within it was ranked.

The researchers examined whether code call relationships might help identify omissions, but this analysis covered only five selected projects. In those projects, relationships connected some missed functions to functions already identified by agents. This suggests a possible search strategy; it does not show that a method using those relationships successfully recovers the missed functions.

What the results do—and do not—show

PrismVul’s labels have limitations. Fix commits may include incidental edits, affected code may be unchanged and omitted, and extraction or classification can make mistakes. The authors manually checked samples. In 55 test entries with human-reviewed labels, replacing the benchmark labels changed each agent’s Recall@5 by at most 0.11 percentage points. That check is informative for the sample, but it does not remove all uncertainty.

The benchmark includes cases with linked public reports, repositories and fix histories, and coverage varies by language and vulnerability category. Model services may change or behave nondeterministically; the authors say cost prevented repeated trials and estimates of run-to-run variation. The study evaluates rankings, not whether developers can safely apply a fix or whether these tools reduce real-world exposure.

This is an arXiv preprint, so the results should be treated as research findings rather than established operational performance. They offer a basis for further evaluation: agents can narrow a search in this benchmark, especially with historical examples, but incomplete localization leaves room for human checking and testing in broader real-world settings.

Reviewed cross-references

These connections were reviewed by a model, not independently fact-checked by a human. Similarity does not imply agreement; consult the original papers and the evidence below.

  • Tracing security patterns through source code with SecPatRec

    Shared method: Both studies use LLM agents to search and inspect repositories: the vulnerability-localization study describes agents interactively searching repositories, while SecPatRec uses a ReAct-style agent with semantic and lexical code search. This is a shared agentic search approach, not evidence that they achieve comparable results: one localizes vulnerable code, the other recovers security-pattern roles, and their datasets and evaluation measures differ.

    Model review: · openai-codex/gpt-6-luna

    Evidence and provenance

    Selected excerpts, not complete papers. PDF extraction can omit figures or damage equations, tables and reading order; sources may be preprints.

    • 2612.00291v1 — Original paper

      Excerpt reference: static/papers/2612.00291v1.md:129-187
      Basis: Paper text
      Source file SHA-256: 0fb30405b4ceebf83cbd893aa73ecaa016cfeb2be6cc1d7c510efe57e6ceae5b

    • 2611.05823v1 — Original paper

      Excerpt reference: static/papers/2611.05823v1.md:531-600
      Basis: Paper text
      Source file SHA-256: 05bd3d17611b98e2e2bf6f29b6dd6b6a4ee2214385dd7e931c9211d45e43e430

Automatically matched by shared topic keywords. These links do not imply that the sources agree or establish a consensus.