Regex dos

From zakirkun/ice-tea · View interactive version

Regex dos is an AI agent skill from the GitHub repository zakirkun/ice-tea. Detects catastrophically backtracking regular expressions applied to user-controlled input, causing CPU-intensive denial of service.

How to use this skill

Skill file

Regular Expression Denial of Service (ReDoS)

Overview

Certain regex patterns with nested quantifiers (e.g., (a+)+, (a|aa)+, ([a-zA-Z]+)*) cause catastrophic backtracking when matched against specially crafted inputs. A single request with a malicious string can cause the regex engine to run for seconds, minutes, or hours, exhausting server CPU.

Classic vulnerable patterns:

Detection Strategy

Look for regular expressions with:

Remediation

Vulnerable:

const emailRegex = /^([a-zA-Z0-9])(([a-zA-Z0-9])*([._-])?)+@.../;
req.body.email.match(emailRegex); // ReDoS with crafted email
Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.