Lune

S&P2021顶会

Using Selective Memoization to Defeat Regular Expression Denial of Service (ReDoS)

James C. Davis, Francisco Servant, Dongyoon Lee

摘要

Regular expressions (regexes) are a denial of service vector in most mainstream programming languages. Recent empirical work has demonstrated that up to 10% of regexes have super-linear worst-case behavior in typical regex engines. It is therefore not surprising that many web services are reportedly vulnerable to regex denial of service (ReDoS). If the time complexity of a regex engine can be reduced transparently, ReDoS vulnerabilities can be eliminated at no cost to application developers. Unfortunately, existing ReDoS defenses — replacing the regex engine, optimizing it, or replacing regexes piecemeal — struggle with soundness and compatibility. Full memoization is sound and compatible, but its space costs are too high. No effective ReDoS defense has been adopted in practice. We present techniques to provably eliminate super-linear regex behavior with low space costs for typical regexes. We propose selective memoization schemes with varying space/time tradeoffs. We then describe an encoding scheme that leverages insights about regex engine semantics to further reduce the space cost of memoization. We also consider how to safely handle extended regex features. We implemented our proposals and evaluated them on a corpus of real-world regexes. We found that selective memoization lowers the space cost of memoization by an order of magnitude for the median regex, and that run-length encoding further lowers the space cost to constant for 90% of regexes. "Those who cannot remember the past are condemned to repeat it." –George Santayana

问 Lune

几分钟读透这篇 Paper,不用再花一下午。

Lune 能读完全文,也能读引用它的顶会 Paper,讲清它的结论、证据和局限,每一点都注明出自哪篇 Paper。不用硬啃,也不靠猜。

已有 14 篇顶会 Paper 引用了它。别等审稿人问起,先弄清它们发现了什么。

可以从这些问题问起

Lune 可以查阅

全文 · 引用它的顶会 Paper · 相关的 Paper

获取答案

免费开始,无需绑卡

脉络

  • Repairing DoS Vulnerability of Real-World Regexes 引用了 Freezing the Web: A Study of ReDoS Vulnerabilities in JavaScript-based Web Servers
  • Exploiting Input Sanitization for Regex Denial of Service 引用了 A Sense of Time for JavaScript and Node.js: First-Class Timeouts as a Cure for Event Handler Poisoning
  • Exploiting Input Sanitization for Regex Denial of Service 引用了 Freezing the Web: A Study of ReDoS Vulnerabilities in JavaScript-based Web Servers
  • Exploiting Input Sanitization for Regex Denial of Service 引用了 Runtime Recovery of Web Applications under Zero-Day ReDoS Attacks
  • SecBench.js: An Executable Security Benchmark Suite for Server-Side JavaScript 引用了 A Sense of Time for JavaScript and Node.js: First-Class Timeouts as a Cure for Event Handler Poisoning
  • SecBench.js: An Executable Security Benchmark Suite for Server-Side JavaScript 引用了 Freezing the Web: A Study of ReDoS Vulnerabilities in JavaScript-based Web Servers
  • SecBench.js: An Executable Security Benchmark Suite for Server-Side JavaScript 引用了 Runtime Recovery of Web Applications under Zero-Day ReDoS Attacks
  • A Sense of Time for JavaScript and Node.js: First-Class Timeouts as a Cure for Event Handler Poisoning 引用了 Freezing the Web: A Study of ReDoS Vulnerabilities in JavaScript-based Web Servers
  • Runtime Recovery of Web Applications under Zero-Day ReDoS Attacks 引用了 A Sense of Time for JavaScript and Node.js: First-Class Timeouts as a Cure for Event Handler Poisoning
  • Runtime Recovery of Web Applications under Zero-Day ReDoS Attacks 引用了 Freezing the Web: A Study of ReDoS Vulnerabilities in JavaScript-based Web Servers
  • ReDoSHunter: A Combined Static and Dynamic Approach for Regular Expression DoS Detection 引用了 Freezing the Web: A Study of ReDoS Vulnerabilities in JavaScript-based Web Servers
它引用的引用它的从左到右按年份排列,引用越多,位置越高。

引用它的顶会 Paper14

  1. SecBench.js: An Executable Security Benchmark Suite for Server-Side JavaScriptMasudul Hasan Masud Bhuiyan, Adithya Srinivas Parthasarathy, Nikos Vasilakis, Michael Pradel 等ICSE 2023 · 20 次引用
  2. ReDoSHunter: A Combined Static and Dynamic Approach for Regular Expression DoS DetectionYeting Li, Zixuan Chen, Jialun Cao, Zhiwu Xu 等USENIX Security 2021 · 20 次引用
  3. Runtime Recovery of Web Applications under Zero-Day ReDoS AttacksZhihao Bai, Ke Wang, Hang Zhu, Yinzhi Cao 等S&P 2021 · 19 次引用
  4. Exploiting Input Sanitization for Regex Denial of ServiceEfe Barlas, Xin Du, James C. DavisICSE 2022 · 16 次引用
  5. Repairing DoS Vulnerability of Real-World RegexesNariyoshi Chida, Tachio TerauchiS&P 2022 · 15 次引用

它引用的 Paper2

  1. Freezing the Web: A Study of ReDoS Vulnerabilities in JavaScript-based Web ServersCristian-Alexandru Staicu, Michael PradelUSENIX Security 2018 · 125 次引用
  2. A Sense of Time for JavaScript and Node.js: First-Class Timeouts as a Cure for Event Handler PoisoningJames C. Davis, Eric R. Williamson, Dongyoon LeeUSENIX Security 2018 · 54 次引用

相关 Paper

  1. FlashRegex: Deducing Anti-ReDoS Regexes from ExamplesYeting Li, Zhiwu Xu, Jialun Cao, Haiming Chen 等ASE 2020 · 17 次引用
  2. Revealer: Detecting and Exploiting Regular Expression Denial-of-Service VulnerabilitiesYinxi Liu, Mingxue Zhang, Wei MengS&P 2021 · 28 次引用
  3. Improving Developers' Understanding of Regex Denial of Service Tools through Anti-Patterns and Fix StrategiesSk Adnan Hassan, Zainab Aamir, Dongyoon Lee, James C. Davis 等S&P 2023
  4. Towards an Effective Method of ReDoS Detection for Non-backtracking EnginesWeihao Su, Hong Huang, Rongchen Li, Haiming Chen 等USENIX Security 2024 · 4 次引用
  5. Regulator: Dynamic Analysis to Detect ReDoSRobert McLaughlin, Fabio Pagani, Noah Spahn, Christopher Kruegel 等USENIX Security 2022
黄昏的海面,两侧是细线勾勒的悬崖