Manuscript Offprint

arXiv:2611.06135

SBVUL: Statement-Based Vulnerability Detection

Martin Pinzger, Katharina Stengg, Christian Macho, Stefan Schöberl, Víctor Mayoral Vilches

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Martin Pinzger, Katharina Stengg, Christian Macho

University of Klagenfurt

Klagenfurt, Austria

{martin.pinzger, katharina.stengg, christian.macho}@aau.at

Stefan Schöberl

Software Competence Center Hagenber

Klagenfurt, Austria

stefan.schoeberl@scch.at

Víctor Mayoral Vilches

Alias Robotics

Vitoria-Gasteiz, Spain

victor@aliasrobotics.com

Abstract—Many recent approaches for vulnerability detection use large language models (LLMs) to classify functions as vulnerable or benign, leaving developers to locate the exploitable statements. Furthermore, while these approaches have shown performance improvements, they still fall short in distinguishing vulnerable from patched real-world functions. This paper presents SBVUL, an agentic approach that detects exploitable statements in C/C++ functions. In Phase 1, an LLM agent explores the function and its repository and identifies candidate statements. In Phase 2, a second agent analyzes the control and data flow of each candidate and confirms it, rules it out, or marks it uncertain. We created a manually verified ground truth of exploitable statements for 200 pairs of the PrimeVul Paired test set and ran SBVUL with the open-weight models Qwen 3.8 and DeepSeek V4.1 Flash and Anthropic's Sonnet 5.5 and Opus 5.5. Phase 1 identifies ground-truth statements in 56–77% of the vulnerable functions, and Phase 2 confirms such a statement with an explanation accepted by an LLM judge in 26–73%. However, all models also confirm candidates in 23–61% of the patched functions. Across vulnerable and patched functions, the highest statement-level precision is 0.315 at a recall of 0.605 obtained with Opus 5.5 (xhigh). At the function level, SBVUL with Opus 5.5 classifies 42.0% of the pairs correctly, compared with 33.8% reported for the best previous approach.

Index Terms—vulnerability detection, large language models, LLM agents, statement-level detection

I. INTRODUCTION

To detect software vulnerabilities, static analysis tools encode vulnerability patterns as rules or as taint flows from sources to sinks [23, 41], and code property graphs make such patterns queryable [40]. For C/C++, however, a recent comparison found that static analyzers produced tens of thousands of warnings on programs containing about one hundred known bugs [13]. Deep learning-based detectors instead learn vulnerability patterns from labeled functions or statements [19, 12, 30], but their performance drops sharply on realistic, deduplicated data, partly because they learn artifacts associated with noisy labels rather than the vulnerabilities themselves [5, 8, 4, 28].

Most recent approaches build on large language models (LLMs) [31]. They fine-tune LLMs to reason about vulnerabilities [35, 36], retrieve security knowledge from earlier vulnerabilities [10, 43], provide structural context from abstract syntax trees, control-flow and data-flow graphs, or code property graphs [32, 18], or let multiple agents debate or explore the code with tools [38, 34]. On the PrimeVul Paired test set [9], which pairs each vulnerable C/C++ function with its patched version, GPT-3.5 and GPT-4 perform close to random guessing, and recent approaches still classify only a minority of the pairs correctly. For example, VulTrial [38] classifies 81 of the 435 pairs (18.6%) correctly, VulTriage [32] 147 pairs (33.8%), and VulInstruct [43] 17.2% of the pairs when its explanation must also match the actual vulnerability.

Two limitations reduce the usefulness of these approaches for developers. First, almost all of them classify a function as vulnerable or benign. Even when they explain their decision, as required by VulInstruct [43] and CORRECT [21], the developer still has to locate the statements that make the function exploitable. Second, the few approaches that report vulnerable statements, such as LineVul [12] and the agentic pipeline of SecVulEval [1], take the lines changed by the fixing commit as their ground truth. A fix, however, often adds a check before the exploitable statement and leaves the statement itself unchanged, so this ground truth rewards identifying the changed lines rather than the exploitable statements.

We address these limitations with SBVUL, an agentic approach that detects exploitable statements in C/C++ functions and explains why they are exploitable. These statements perform the operations an attacker can exploit, such as an unchecked memcpy. Following GPTLens [15] and VulAgent [34], SBVUL splits the detection into two phases. In Phase 1, an LLM agent explores the function and its repository with file and text search tools and proposes candidates, each with its line number(s) and an explanation. In Phase 2, a second agent investigates the control and data flow of every candidate and confirms it, rules it out, or marks it uncertain. Based on these results, SBVUL classifies a function as vulnerable if Phase 2 confirms at least one candidate. We implemented two versions of SBVUL, one with LangChain 1^{1} for open-weight models and one with the Claude Code Agent SDK 2^{2} for Anthropic's frontier models.

For the evaluation of SBVUL, we created a ground truth for 200 randomly selected pairs from the PrimeVul Paired test set [9]. We prompted an LLM to identify exploitable state-

This research was funded in whole or in part by the Austrian Science Fund (FWF) 10.55776/P36698. For open access purposes, the author has applied a CC BY public copyright license to any author accepted manuscript version arising from this submission. The research was supported by the Austrian ministries BMIMI, BMWET and the State of Upper Austria in the frame of the SCCH COMET competence center INTEGRATE (FFG 892418).

1^{1}https://github.com/langchain-ai/langchain

2^{2}https://github.com/anthropics/claude-agent-sdk-python ments using the CVE description, the commit message, and the diff, and manually verified the results for every vulnerable function. A confirmed verdict counts as a true positive only if its line number matches a ground-truth statement and an LLM judge accepts its explanation. Every confirmed verdict on a patched function counts as a false positive. We ran SBVUL with Qwen 3.8, DeepSeek V4.1 Flash, Sonnet 5.5, and Opus 5.5 to answer three research questions:

RQ1: What is the performance of SBVUL in finding candidates for exploitable statements in C/C++ functions?

RQ2: What is the performance of SBVUL in confirming the exploitable statements of C/C++ functions?

RQ3: What is the performance of SBVUL in distinguishing vulnerable from patched C/C++ functions?

Phase 1 identifies candidates that match at least one ground-truth statement in 56–77% of the vulnerable functions (RQ1). Phase 2 confirms at least one ground-truth statement with an accepted explanation in 26–73% of the vulnerable functions, with Opus 5.5 performing best, followed by DeepSeek V4.1, Sonnet 5.5, and Qwen 3.8. At the same time, all models also confirm candidates in 23–61% of the patched functions, hence the verdicts alone separate vulnerable from patched code only partly (RQ2). With Opus 5.5, the classification based on confirmed Phase 2 verdicts exceeds the reported results of previous approaches: SBVUL correctly classifies 42% of the pairs, compared with 33.8% for VulTriage and 18.6% for VulTrial (RQ3). Under the lenient CORRECT criterion, which also requires an accepted explanation, SBVUL with Opus 5.5 classifies 75.5% of the pairs correctly, compared with 17.2% for VulInstruct (RQ3).

In summary, this paper makes the following contributions:

SBVUL, an agentic approach that detects exploitable statements in C/C++ functions in two phases and derives the function-level classification from the confirmed statements.

  • Two implementations to run SBVUL with open-weight models and with Anthropic's frontier models.

  • A ground truth of manually verified exploitable statements for 200 pairs of the PrimeVul Paired test set.

  • An evaluation of SBVUL with four LLMs and different reasoning efforts at statement and function level.

  • A replication package with all tools, the ground truth, the instructions, and all results. 3^{3}

References (39)