Repairing DoS Vulnerability of Real-World Regexes

Nariyoshi Chida, Tachio Terauchi
10/23/2020
cs.PL

Official code: NariyoshiChida/SP2022 (2 stars, last commit 2024-09-30).

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.

Show full abstract

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 real-world extensions and with constraints to enforce the real-world strong 1-unambiguity condition.

View on arXivView PDF

Code Implementations(1)

This is an artifact of our paper titled "Repairing DoS Vulnerability of Real-World Regexes" (S&P 2022).

20Dec 9, 20212 years ago

Similar Papers

Cite this paper

@article{chida2020repairing,
  title  = {Repairing DoS Vulnerability of Real-World Regexes},
  author = {Nariyoshi Chida and Tachio Terauchi},
  year   = {2020},
  eprint = {2010.12450},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/2010.12450}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2010.12450.svg)](https://codeofpaper.com/paper/2010.12450)

Discussion