Abstract
Large Language Models (LLMs) have shown promise in code analysis but often struggle with high false positive rates in vulnerability detection due to a lack of deep program context and systematic reasoning. We present VulAgent, a novel multi-agent framework that treats vulnerability detection as a "hypothesis-validation" process. By mimicking the structured skepticism of human security auditors, VulAgent reduces false positives by 36% and improves the identification of vulnerable-fixed code pairs by an average of 246% over state-of-the-art baselines.
Introduction: The Context Gap in LLM Security Auditing
While LLMs can identify suspicious code patterns, project-level vulnerability detection remains challenging. A "dangerous" function call (such as strcpy) is only a vulnerability if it is reachable by an attacker and lacks proper guards like length checks. Current single-agent or simple "chain-of-thought" approaches often fail to correlate complex program flows across different files, leading to "theoretical" flaws that are safe in practice. VulAgent addresses this by using external program context to verify initial suspicions, moving away from simple classification toward a more rigorous proof-based approach.
The VulAgent Framework
VulAgent introduces a four-phase pipeline inspired by the workflow of human security researchers. This systematic approach ensures that every potential vulnerability is not just identified but rigorously vetted against the actual program state.
Phase I: Multi-view Detection
The process begins with a MetaAgent that analyzes the code's semantics. Instead of applying generic detection logic, it routes the code to specialized "Inspectors" (e.g., agents focused on memory safety, authorization, or concurrency). This "divide and conquer" strategy ensures high coverage of different vulnerability types (CWEs) by leveraging agents with domain-specific knowledge.
Phase II: Hypothesis Construction
Once a potential issue is flagged, the TriggerPlannerAgent constructs a structured hypothesis. Instead of a binary label, it generates Hypothesis Conditions (the specific preconditions required for the bug to manifest) and a Trigger Path (the symbolic trace from user-controlled input to the vulnerable "sink").
Phase III: Hypothesis-Conditions Validation
The AssumptionPruner then attempts to verify these conditions. It uses context retrieved from static analysis tools like Joern to check if the hypothesis's preconditions are actually possible within the project's global invariants. If a condition is contradicted by the codebase—for example, if a variable is always initialized before use—the report is discarded as a false positive.
Phase IV: Protection Checking
Finally, the FinalValidator performs a targeted check for "guards"—defensive code like null-checks, boundary checks, or sanitization routines—that might neutralize the vulnerability along the trigger path. This step ensures that even if a path is reachable, it is only reported if it remains unprotected.
Evaluation and Key Results
VulAgent was evaluated on two major benchmarks: PrimeVul, a large-scale C/C++ dataset, and SVEN, a hand-checked corpus focusing on vulnerable-fixed pairs. The framework was tested against top-tier models including GPT-4o, Qwen3, and DeepSeek v3.1.
- Accuracy: Improved overall accuracy by 6.6% on average across datasets.
- Pair-wise Identification: In the difficult task of distinguishing a vulnerable function from its fixed counterpart, VulAgent outperformed baselines by up to 450% (246% on average).
- False Positive Reduction: Reduced the False Positive Rate (FPR) by approximately 36% compared to state-of-the-art LLM frameworks like VulTrial.
- Generalization: The gains were robust regardless of the underlying LLM "backbone," suggesting the structured process is as critical as the model's raw reasoning power.
Discussion and Limitations
The core innovation of VulAgent is the "Human Auditor" paradigm: moving from "Is this code vulnerable?" to "Can I prove this hypothesis holds under these specific conditions?" By decoupling discovery from validation, the system avoids the confirmation bias inherent in single-agent reasoning.
However, the system's efficacy is tied to the quality of static analysis tools like Joern. If the analysis fails due to complex build options, the validation phase may become overly conservative. Additionally, while VulAgent excels at memory and authorization patterns, it is currently less effective for configuration-driven vulnerabilities. Future work will explore "context mining" to more intelligently retrieve hypothetical conditions from even larger, more complex codebases.
Summary updated