arXiv:2607.26656cs.CRcs.AI2026-07被引 1

用图结构引导智能体跨函数检测漏洞,让模型自己找证据。

Graph Is the Verifier: Agentic Reinforcement Learning for Interprocedural Vulnerability Detection

论文配图:Graph Is the Verifier: Agentic Reinforcement Learning for Interprocedural Vulnerability Detection
图 1 · 摘自论文原文
  • 构建代码属性图,让智能体主动查询调用关系与数据流。
  • 在真实漏洞数据上,71.7%的漏洞需跨函数证据才能识别。
  • 比现有方法更少调用工具,且在分布外数据上表现更稳。

真实漏洞常跨越多个函数,但多数学习型检测器孤立分析每个函数:在真实CVE样本中,71.7%的漏洞函数需外部证据才能正确分类。代理强化学习(RL)可通过让模型自主收集证据弥补此差距,但缺乏可靠奖励——仅基于最终判断的奖励可被无调查行为获得。我们提出VulAgentRL,一种基于代码属性图(CPG)的代理强化学习框架,用于跨函数漏洞检测。在推理时,策略从CPG中查询调用者、被调者、数据流等信息;在训练时,同一图验证策略引用的证据。因每个CPG节点具有持久整数标识符,验证为精确匹配而非文本比对,确保奖励仅授予有证据支持的判断。我们通过蒸馏教师调查过程初始化策略,证明该冷启动必要——因强化学习无法学习从未采样的工具使用行为。在仓库级划分下,无需泄露,VulAgentRL在严格成对正确率指标上超越最先进基线,包括前沿模型,且调用次数更少,其优势在分布外语料和类别不平衡条件下依然保持。

原文摘要 · Abstract (English)

Real-world vulnerabilities often span multiple functions, yet most learning-based detectors classify each function in isolation: on a sample of real CVEs, we find that 71.7% of vulnerable functions require evidence from outside the function to be classified correctly. Agentic reinforcement learning (RL) could close this gap by enabling a model to gather that evidence itself, but it lacks a reliable reward, since a reward defined on the final verdict alone can be obtained without performing any investigation. We propose VulAgentRL, an agentic RL framework for interprocedural vulnerability detection built on a Code Property Graph (CPG). The CPG serves two roles: at inference time the policy queries it for callers, callees, dataflow, and other queries, and at training time the same graph verifies the evidence the policy cites. Because every CPG node carries a persistent integer identifier, this verification is an exact comparison rather than a textual match, so the reward credits verdicts that are supported by evidence. We further initialize the policy by distilling teacher investigations, and show that this warm start is necessary, since RL cannot acquire tool-use behavior it never samples. Under a repository-level split that prevents leakage, VulAgentRL outperforms state-of-the-art baselines, including frontier models, on the strict pair-wise-correct metric while issuing fewer tool calls, and its advantage persists on an out-of-distribution corpus and under class imbalance.

漏洞检测强化学习代码分析智能体

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