paperbot · PL 论文追踪

全部论文 待读 收藏

LARA: Static ReDoS Detection for Regular Expressions with Lookahead via Matching Automata

LARA:基于匹配自动机的带前瞻正则表达式静态 ReDoS 检测
ASE Proceedings of the 41st IEEE/ACM International Conference on Automated Software Engineering2026引用 0 inbox
Mengxi Wang, Chengyao Peng, Weihao Su, Guiyi He, Rongchen Li, Hong Huang, Haiming Chen
crossref: 2026-10-09

AI 速览

一句话:提出 matching NFA,将带前瞻正则转换为标准 ε-NFA,把前瞻感知的 ReDoS 检测归约为 ε-NFA 歧义分析。

带前瞻断言的正则表达式在现代软件中广泛使用,但与回溯引擎交互时可能引发 ReDoS 漏洞。现有静态方法依赖 ε-NFA 歧义分析,无法刻画前瞻求值开销;动态与混合方法则代价高或覆盖不全。本文提出 LARA,一种面向带前瞻正则表达式(REwLA)的静态 ReDoS 检测器。其核心贡献是 matching NFA,将 REwLA 转换为标准 ε-NFA。该自动机与原 REwLA 语言不等价,但作者证明其 match degree 等于原 REwLA 的 la-match degree,因此包含前瞻开销的复杂度上界得以保持,从而把前瞻感知的 ReDoS 检测归约为标准 ε-NFA 歧义分析,使现有检测技术可直接应用。在 42,794 个去重真实 REwLA 上评估,LARA 在多工具共同确认的 5,889 个漏洞中识别 5,871 个,优于所有基线;在来自 177 个真实 CVE 的 400 个确认漏洞正则上召回率 99.50%,并在真实引擎上成功利用 4,468 个漏洞,中位分析时间 0.05 秒、内存 7.67 MB。

问题
带前瞻断言的正则表达式与回溯引擎交互会导致 ReDoS 漏洞,而现有静态方法基于 ε-NFA 歧义分析,无法捕捉前瞻求值开销,动态与混合方法又存在高成本或覆盖不全的问题。
方法
提出 matching NFA,将带前瞻正则表达式转换为标准 ε-NFA,并证明其 match degree 等于原 REwLA 的 la-match degree,从而在保留含前瞻开销的复杂度上界的同时,将前瞻感知的 ReDoS 检测归约为标准 ε-NFA 歧义分析。
评估
在 42,794 个去重真实 REwLA 上与多种基线对比,对多工具确认的 5,889 个漏洞检出 5,871 个;在来自 177 个真实 ReDoS CVE 的 400 个确认漏洞正则上召回率达 99.50%,并在真实回溯引擎上成功利用 4,468 个漏洞,中位分析时间 0.05 秒、内存 7.67 MB。
原文摘要(Abstract)

Regular expressions (regexes) with lookahead assertions are widely used in modern software, yet their interaction with backtracking engines can cause Regular expression Denial of Service (ReDoS) vulnerabilities. Existing static methods rely on 𝜀-NFA ambiguity analysis, which cannot capture lookahead evaluation cost, while dynamic and hybrid methods incur high cost or incomplete coverage. We present LARA, a static ReDoS detector for regular expressions with lookahead (REwLA), which subsumes standard regexes. Our core contribution is the matching NFA, which transforms a REwLA into a standard 𝜀-NFA. The matching NFA is not language-equivalent to the original REwLA; however, we prove that its match degree equals the la-match degree of the original REwLA, so the same complexity upper bound is preserved, including lookahead overhead. This reduces lookahead-aware ReDoS detection to standard 𝜀-NFA ambiguity analysis, enabling existing detection techniques to be applied directly to the matching NFA. We evaluate LARA on 42,794 deduplicated real-world REwLA. Among 5,889 vulnerabilities jointly confirmed by multiple tools and validated on real backtracking engines, LARA identifies 5,871, outperforming all baselines. On 400 confirmed vulnerable regexes from 177 real-world ReDoS CVEs, LARA achieves 99.50% recall. LARA successfully exploits 4,468 vulnerabilities on real engines, with a median analysis time of 0.05 s and 7.67 MB memory.

链接与引用

DOI 原文 · PDF(开放获取) ·

BibTeX
@inproceedings{paperbot12507,
  title = {LARA: Static ReDoS Detection for Regular Expressions with Lookahead via Matching Automata},
  author = {Mengxi Wang and Chengyao Peng and Weihao Su and Guiyi He and Rongchen Li and Hong Huang and Haiming Chen},
  booktitle = {ASE},
  year = {2026},
  doi = {10.1145/3832783.3837475}
}