arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2610.34928cs.SE
收藏

SemWeaver:利用分析器内部证据优化大语言模型生成的静态漏洞检查器

Beyond Compilation Feedback: Refining Vulnerability Checkers with Program-Analysis Evidence

Huazhong University of Science and Technology(华中科技大学);Macquarie University(麦考瑞大学)

Chengzhi Yi, Shenao Wang, Yanjie Zhao, Xiao Cheng, Haoyu Wang

AI总结:

SemWeaver 是一款插件式优化层,利用静态分析框架内部的控制流图等证据优化 LLM 生成的静态漏洞检查器,在 Linux 内核检查器评估中提升了 F₁ 值至 0.575,覆盖更多易受攻击版本。

摘要:

近期研究表明,大语言模型(LLM)可从安全补丁中合成静态分析检查器,但可编译的检查器未必正确。补丁仅揭示了变更内容,未说明变更为何安全,因此生成的检查器往往仅匹配表面编辑,遗漏更深层的语义条件。现有优化循环会反馈编译错误与验证报告,但这些信号仅描述症状,未解释检查器对代码的误解之处。我们发现,分析框架本身已包含填补此缺口所需的信息:控制流图、符号值、内存区域及检查器回调均在分析器内部可用,但当前优化策略未予利用。SemWeaver是一款插件式优化层,它提取与补丁相关的分析器内部证据,并将其与源代码上下文、验证反馈组装为带 provenance 标记的结构化数据包。迭代编辑循环会在易受攻击版本与修复版本上优化检查器,由保留门控机制保障:该机制接受警告恢复或误报减少,同时防止过度剪枝。我们在来自 Linux 内核修复的 39 个 KNighter 衍生 CSA 检查器上评估 SemWeaver。借助分析器内部证据,优化覆盖了 23 个警告为阳性的易受攻击版本(而 KNighter 循环仅覆盖 15 个),并将版本级 F₁ 值从 0.448 提升至 0.575。移除内部证据的 ablation 实验恢复的静默案例更少,且产生不同的检查器编辑,表明两种证据配置针对互补的识别缺口。额外实验涵盖 12 个主题子集上的三种编辑器模型、CodeQL 查询优化及受控源代码形式变体。对全部 11 个非绑定比较的定性追踪,将每个警告计数变化归因于特定检查器修复,例如识别降低的回调或展开表达式强制转换。

英文摘要:

Recent work shows that LLMs can synthesize static-analysis checkers from security patches, but a compilable checker is not necessarily a correct one. A patch reveals what changed, not why the change is safe, so generated checkers often match only the surface edit and miss the deeper semantic condition. Existing refinement loops feed back compilation errors and validation reports, yet these signals describe symptoms without explaining what the checker misunderstands about the code. We observe that the analysis framework itself already computes the information needed to close this gap. Control-flow graphs, symbolic values, memory regions and checker callbacks are available inside the analyzer but unused by current refinement strategies. SemWeaver is a plug-in refinement layer that extracts patch-relevant analyzer evidence and assembles it with source context and validation feedback into a structured, provenance-labelled bundle. An iterative editing loop refines the checker on both the vulnerable and fixed revisions, guarded by a retention gate that accepts warning recovery or false-positive reduction while preventing over-pruning. We evaluate SemWeaver on 39 KNighter-derived CSA checkers from Linux kernel fixes. With analyzer evidence, refinement reaches 23 warning-positive vulnerable revisions (vs. 15 for KNighter's loop) and raises version-level $F_1$ from 0.448 to 0.575. An ablation removing internal evidence recovers fewer silent cases and produces different checker edits, indicating that the two evidence configurations address complementary recognition gaps. Additional experiments cover three editor models on a 12-subject subset, a CodeQL query refinement, and controlled source-form variations. A qualitative follow-up on all 11 non-tied comparisons traces each warning-count change to a specific checker repair, such as recognizing a lowered callback or unwrapping an expression cast.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑