arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 2510.01002cs.SEcs.CR
收藏

语义对齐、课程驱动和推理增强的漏洞修复框架

Semantics-Aligned, Curriculum-Driven, and Reasoning-Enhanced Vulnerability Repair Framework

Singapore Management University(新加坡管理大学);Monash University(蒙纳士大学);Aalto University(阿尔托大学);National University of Singapore(新加坡国立大学)

Chengran Yang, Ting Zhang, Jinfeng Jiang, Xin Zhou, Haoye Tian, Mingzhe Du, Jieke Shi, Junkai Chen, Yikun Li, Eng Lieh Ouh, Lwin Khin Shar, David Lo

AI总结:

本文提出SeCuRepair框架,通过语义对齐、课程驱动和推理增强解决现有漏洞修复方法的局限性,提升代码修复的准确性和泛化能力。

摘要:

当前基于学习的自动漏洞修复(AVR)方法虽然有前景,但往往在现实场景中泛化效果不佳。我们的诊断分析揭示了现有AVR方法的三个根本性缺陷:(1)跨仓库泛化能力有限,性能在未见代码库中下降;(2)无法捕捉长距离依赖,导致复杂多块修复性能下降;(3)过度依赖表面词汇模式,导致在具有微小语法变化的漏洞上性能显著下降。为解决这些限制,我们提出了SeCuRepair,一种语义对齐、课程驱动和推理增强的漏洞修复框架。其核心是采用“推理后再编辑”范式,要求模型在生成补丁前必须阐明为何及如何修复漏洞。这种显式推理强制模型真正理解修复逻辑而非表面词汇记忆。SeCuRepair还超越了传统监督微调,采用语义感知强化学习,奖励补丁在语法和语义上与Oracle补丁的一致性而非仅仅token重叠。此外,一个难度感知的课程逐步训练模型,从简单的修复开始,逐步过渡到复杂的多块协调编辑。我们对BigVul和新构建的PrimeVul_AVR数据集进行了严格、仓库级的评估。SeCuRepair显著优于所有基线,分别在BigVul和PrimeVul_AVR上以CodeBLEU指标超越最佳基线34.52%和31.52%。全面的消融研究进一步确认了框架各组件对最终性能的贡献。

英文摘要:

Current learning-based Automated Vulnerability Repair (AVR) approaches, while promising, often fail to generalize effectively in real-world scenarios. Our diagnostic analysis reveals three fundamental weaknesses in state-of-the-art AVR approaches: (1) limited cross-repository generalization, with performance drops on unseen codebases; (2) inability to capture long-range dependencies, causing a performance degradation on complex, multi-hunk repairs; and (3) over-reliance on superficial lexical patterns, leading to significant performance drops on vulnerabilities with minor syntactic variations like variable renaming. To address these limitations, we propose SeCuRepair, a semantics-aligned, curriculum-driven, and reasoning-enhanced framework for vulnerability repair. At its core, SeCuRepair adopts a reason-then-edit paradigm, requiring the model to articulate why and how a vulnerability should be fixed before generating the patch. This explicit reasoning enforces a genuine understanding of repair logic rather than superficial memorization of lexical patterns. SeCuRepair also moves beyond traditional supervised fine-tuning and employs semantics-aware reinforcement learning, rewarding patches for their syntactic and semantic alignment with the oracle patch rather than mere token overlap. Complementing this, a difficulty-aware curriculum progressively trains the model, starting with simple fixes and advancing to complex, multi-hunk coordinated edits. We evaluate SeCuRepair on strict, repository-level splits of BigVul and newly crafted PrimeVul_AVR datasets. SeCuRepair significantly outperforms all baselines, surpassing the best-performing baselines by 34.52% on BigVul and 31.52% on PrimeVul\textsubscript{AVR} in terms of CodeBLEU, respectively. Comprehensive ablation studies further confirm that each component of our framework contributes to its final performance.

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

↑