arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2510.09037cs.AIcs.PL
收藏

通过定位引导指令修复正则表达式漏洞

Repairing Regex Vulnerabilities via Localization-Guided Instructions

Department of Computer Science, Yonsei University(延世大学计算机科学系)

Sicheol Sung, Joonghyuk Hahn, Yo-Sub Han

AI总结:

针对正则表达式拒绝服务漏洞修复中规则方法泛化性差与LLM方法可靠性低的问题,提出混合框架LRR,通过符号模块定位漏洞子模式并调用LLM生成等价修复,将修复率提升15.4个百分点。

摘要:

正则表达式(regexes)是现代计算的基础,用于输入验证和数据解析等关键任务,然而其普及性使系统暴露于正则表达式拒绝服务攻击(ReDoS)之下,这是一种需要自动化修复方法的漏洞。然而,当前方法受到一种权衡的阻碍。基于符号和规则的系统很精确,但无法修复未见过的或复杂的漏洞模式。相反,大型语言模型(LLMs)具备必要的泛化能力,但对于要求严格语法和语义正确性的任务来说却不可靠。我们通过引入一个混合框架——局部正则表达式修复(LRR)来解决这一僵局,该框架旨在利用LLM的泛化能力同时确保可靠性。我们的核心见解是将问题识别与修复过程解耦。首先,一个确定性的符号模块定位精确的易受攻击子模式,创建一个受限且易于处理的问题空间。然后,调用LLM为这一孤立片段生成语义等价的修复。这种组合架构成功解决了基于规则的修复无法处理的复杂修复案例,同时避免了纯LLM方法的语义错误。我们的工作为自动化修复中解决此类问题提供了一种经过验证的方法,将修复率比现有技术提高了15.4个百分点。我们的代码可在 https://github.com/cdltlehf/LRR 获取。

英文摘要:

Regular expressions (regexes) are foundational to modern computing for critical tasks like input validation and data parsing, yet their ubiquity exposes systems to regular expression denial of service (ReDoS), a vulnerability requiring automated repair methods. Current approaches, however, are hampered by a trade-off. Symbolic, rule-based system are precise but fails to repair unseen or complex vulnerability patterns. Conversely, large language models (LLMs) possess the necessary generalizability but are unreliable for tasks demanding strict syntactic and semantic correctness. We resolve this impasse by introducing a hybrid framework, localized regex repair (LRR), designed to harness LLM generalization while enforcing reliability. Our core insight is to decouple problem identification from the repair process. First, a deterministic, symbolic module localizes the precise vulnerable subpattern, creating a constrained and tractable problem space. Then, the LLM invoked to generate a semantically equivalent fix for this isolated segment. This combined architecture successfully resolves complex repair cases intractable for rule-based repair while avoiding the semantic errors of LLM-only approaches. Our work provides a validated methodology for solving such problems in automated repair, improving the repair rate by 15.4%p over the state-of-the-art. Our code is available at https://github.com/cdltlehf/LRR.

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

↑