Repairing DoS Vulnerability of Real-World Regexes
Abstract
There has been much work on synthesizing and repairing regular expressions (regexes for short) from examples. These programming-by-example (PBE) methods help the users write regexes by letting them reflect their intention by examples. However, the existing methods may generate regexes whose matching may take super-linear time and are vulnerable to regex denial of service (ReDoS) attacks. This paper presents the first PBE repair method that is guaranteed to generate only invulnerable regexes. Importantly, our method can handle real-world regexes containing lookarounds and backreferences. Due to the extensions, the existing formal definitions of ReDoS vulnerabilities that only consider pure regexes are insufficient. Therefore, we first give a novel formal semantics and complexity of backtracking matching algorithms for real-world regexes, and with them, give the first formal definition of ReDoS vulnerability for real-world regexes. Next, we present a novel condition called real-world strong 1-unambiguity that is sufficient for guaranteeing the invulnerability of real-world regexes, and formalize the corresponding PBE repair problem. Finally, we present an algorithm that solves the repair problem. The algorithm builds on and extends the previous PBE methods to handle the realworld extensions and with constraints to enforce the real-world strong 1-unambiguity condition.
Ask Lune
Know this paper in minutes, not an afternoon.
Lune can read every page of it and the top-tier papers that cite it, and gives you its claims, its evidence and its limits, each one cited to the paper it comes from. No skimming, no AI slop.
8 top-tier papers have cited it since. Know what they found before your reviewers do.
Lune can draw on
the full paper · the top-tier papers that cite it · related work
Free to start. No credit card required.
Lineage
- Linear Matching of JavaScript Regular Expressions cites Using Selective Memoization to Defeat Regular Expression Denial of Service (ReDoS)
- Linear Matching of JavaScript Regular Expressions cites Revealer: Detecting and Exploiting Regular Expression Denial-of-Service Vulnerabilities
- Linear Matching of JavaScript Regular Expressions cites Freezing the Web: A Study of ReDoS Vulnerabilities in JavaScript-based Web Servers
- Repairing Regex-Dependent String Functions cites Multi-modal synthesis of regular expressions
- Improving Developers' Understanding of Regex Denial of Service Tools through Anti-Patterns and Fix Strategies cites Using Selective Memoization to Defeat Regular Expression Denial of Service (ReDoS)
- Improving Developers' Understanding of Regex Denial of Service Tools through Anti-Patterns and Fix Strategies cites FlashRegex: Deducing Anti-ReDoS Regexes from Examples
- Improving Developers' Understanding of Regex Denial of Service Tools through Anti-Patterns and Fix Strategies cites Revealer: Detecting and Exploiting Regular Expression Denial-of-Service Vulnerabilities
- Improving Developers' Understanding of Regex Denial of Service Tools through Anti-Patterns and Fix Strategies cites Freezing the Web: A Study of ReDoS Vulnerabilities in JavaScript-based Web Servers
- Revealer: Detecting and Exploiting Regular Expression Denial-of-Service Vulnerabilities cites Freezing the Web: A Study of ReDoS Vulnerabilities in JavaScript-based Web Servers
Cited by top-tier papers8
- Linear Matching of JavaScript Regular ExpressionsAurèle Barrière, Clément Pit-ClaudelPLDI 2024 · 11 citations
- Repairing Regex-Dependent String FunctionsNariyoshi Chida, Tachio TerauchiASE 2024 · 3 citations
- Improving Developers' Understanding of Regex Denial of Service Tools through Anti-Patterns and Fix StrategiesSk Adnan Hassan, Zainab Aamir, Dongyoon Lee, James C. Davis et al.S&P 2023
- SoK: Automated Vulnerability Repair: Methods, Tools, and AssessmentsYiwei Hu, Zhen Li, Kedie Shu, Shenghua Guan et al.USENIX Security 2025
- LogicEval: A Systematic Framework for Evaluating Automated Repair Techniques for Logical Vulnerabilities in Real-World SoftwareSyed Md. Mukit Rashid, Abdullah Al Ishtiaq, Kai Tu, Yilu Dong et al.ACL 2026
Builds on5
- Freezing the Web: A Study of ReDoS Vulnerabilities in JavaScript-based Web ServersCristian-Alexandru Staicu, Michael PradelUSENIX Security 2018 · 125 citations
- Multi-modal synthesis of regular expressionsQiaochu Chen, Xinyu Wang, Xi Ye, Greg Durrett et al.PLDI 2020 · 81 citations
- Using Selective Memoization to Defeat Regular Expression Denial of Service (ReDoS)James C. Davis, Francisco Servant, Dongyoon LeeS&P 2021 · 43 citations
- Revealer: Detecting and Exploiting Regular Expression Denial-of-Service VulnerabilitiesYinxi Liu, Mingxue Zhang, Wei MengS&P 2021 · 28 citations
- FlashRegex: Deducing Anti-ReDoS Regexes from ExamplesYeting Li, Zhiwu Xu, Jialun Cao, Haiming Chen et al.ASE 2020 · 17 citations
Related papers
- RegexScalpel: Regular Expression Denial of Service (ReDoS) Defense by Localize-and-FixYeting Li, Yecheng Sun, Zhiwu Xu, Jialun Cao et al.USENIX Security 2022
- Repairing Regular Expressions for ExtractionNariyoshi Chida, Tachio TerauchiPLDI 2023 · 9 citations
- ReDoSHunter: A Combined Static and Dynamic Approach for Regular Expression DoS DetectionYeting Li, Zixuan Chen, Jialun Cao, Zhiwu Xu et al.USENIX Security 2021 · 20 citations
- Towards an Effective Method of ReDoS Detection for Non-backtracking EnginesWeihao Su, Hong Huang, Rongchen Li, Haiming Chen et al.USENIX Security 2024 · 4 citations
- Regulator: Dynamic Analysis to Detect ReDoSRobert McLaughlin, Fabio Pagani, Noah Spahn, Christopher Kruegel et al.USENIX Security 2022
