redos
O que ela faz
Esta skill explica a ReDoS, uma negação de serviço em que uma regex leva muito tempo para processar uma string especialmente construída. Ela é para desenvolvedores e testadores que verificam a velocidade e a segurança do próprio código.
Quando usar
- ✓Quando um desenvolvedor pede ao agente para encontrar expressões regulares que poderiam ficar muito lentas com uma entrada construída de propósito.
- ✓Quando o agente verifica quais motores de regex do projeto podem ser afetados, já que alguns motores não são.
- ✓Quando um relatório precisa mostrar um resultado de tempo que comprove a lentidão.
Link da skill
https://github.com/BitterSecurity/Decepticon/blob/main/packages/decepticon/decepticon/skills/standard/analyst/redos/SKILL.mdCopie e cole na sua IA (Claude, ChatGPT ou Cursor) pedindo para seguir as instruções.
Como usar
O jeito mais fácil: copie a mensagem e cole na sua IA. Ela lê a skill e segue as instruções.
Mensagem pronta para colar
Para Claude Code, Codex ou Cursor: rode na pasta do projeto e a skill fica instalada.
Baixe o SKILL.md e coloque na pasta de skills do seu agente.
Exemplo do que pedir para a IA
“Você pode verificar nosso código autorizado em busca de expressões regulares que poderiam travar o servidor quando recebem uma entrada longa e construída de propósito?”
5 skills novas por semana. 1 minuto de leitura.
Como funciona
O agente procura chamadas de regex, encontra as que têm repetições aninhadas, rastreia até elas a entrada do usuário e mede o tempo de resposta em uma cópia de teste.
Conteúdo técnico (SKILL.md original)
Texto original do autor, em inglês, direto do GitHub.
ReDoS Hunting Playbook
Regular Expression Denial of Service exploits O(2^n) or O(n^2) matching time in backtracking engines. One crafted string can peg a CPU thread for seconds or minutes against an otherwise tiny pattern.
1. Identify Backtracking Engines in Scope
Not all regex engines backtrack:
| Engine | Language/Runtime | Backtracks? | Vulnerable? |
|---|---|---|---|
| PCRE / PCRE2 | C, PHP, Apache, nginx | Yes | YES |
re module |
Python (pre-3.11 re, regex) |
Yes | YES |
java.util.regex |
Java | Yes | YES |
RegExp |
JavaScript / V8 | Yes | YES |
System.Text.RegularExpressions |
.NET | Yes (w/ timeout option) | YES |
regexp package |
Go | DFA-based (RE2) | NO |
Oniguruma |
Ruby | Yes | YES |
| RE2 | C++, re2 Python binding | DFA-based | NO |
If the target uses RE2 or Go's regexp, skip this playbook — no
backtracking, no ReDoS.
2. Source Patterns — Where Tainted Input Reaches Regex
# Python
grep -rn 're\.match\|re\.search\|re\.fullmatch\|re\.compile\|regex\.match' /workspace/src \
| grep -v '#' | grep -v 'test_' | grep -v '_test\.py'
# Node.js / TypeScript
grep -rn 'new RegExp\|\.match(\|\.search(\|\.test(' /workspace/src \
--include='*.js' --include='*.ts' | grep -v 'node_modules'
# Java
grep -rn 'Pattern\.compile\|\.matches(\|\.find(\|String\.matches' /workspace/src \
--include='*.java'
# PHP
grep -rn 'preg_match\|preg_replace\|preg_split' /workspace/src --include='*.php'
# Ruby
grep -rn 'match\|=~\|Regexp\.new\|\.scan(' /workspace/src --include='*.rb' \
| grep -v '#'
# Semgrep for tainted-input-to-regex-sink
semgrep --config p/regex /workspace/src --sarif -o /workspace/sem-redos.sarif 2>/dev/null
For each hit, determine whether the regex pattern is:
- Static (hardcoded string literal) → scan the pattern itself
- Dynamic (constructed from user input) → separate vuln class (regex injection); flag it and continue
3. Catastrophic Pattern Recognition
A regex is potentially catastrophic if it can match the same character through multiple paths. The two canonical forms:
Form 1: Nested quantifiers
(a+)+, (a*)*, ([a-z]+)+, (a|a)+
The inner group can match one character in multiple ways → exponential
backtracking on a string like aaaa...b.
Form 2: Overlapping alternation
(a|aa)+, (a|ab)+c, (x+|y+)+z
Two branches can match the same prefix → exponential when neither eventually matches the suffix.
Quick pattern scanner
# Find potentially catastrophic regexes (grep heuristic)
grep -rn "$(printf \
'(\([^)]*[+*][^)]*\)[+*])\|(\([^)]*|\[^)]*\)[+*])\|(\([^)]*[+*]\)\{[2-9]\})')" \
/workspace/src 2>/dev/null | grep -v 'node_modules\|\.min\.js'
# Better: use vuln-regex-detector (if available)
python3 -c "
import subprocess, json, os, sys
# Try to find all regex literals in Python files
import ast, glob
for path in glob.glob('/workspace/src/**/*.py', recursive=True):
try:
tree = ast.parse(open(path).read())
for node in ast.walk(tree):
if isinstance(node, ast.Call):
fn = getattr(node.func, 'attr', '') or getattr(node.func, 'id', '')
if fn in ('compile','match','search','fullmatch'):
for arg in node.args:
if isinstance(arg, ast.Constant) and isinstance(arg.value, str):
print(path, node.lineno, repr(arg.value))
except Exception:
pass
" 2>/dev/null | head -50
Patterns warranting deeper analysis (flag these):
- Any group with a quantifier inside a quantifier:
(X+)+,(X*)+,(X+)* - Alternation where branches share a prefix:
(ab|a)+,(abc|ab)+ - Long character classes under a star inside a group under a star:
([a-z ]+)+
4. Taint Heuristics — Is This Reachable?
For each flagged regex, trace whether attacker-controlled data reaches the
pattern, the string argument, or both:
stringtainted,patternstatic → ReDoS possible if pattern is vulnerablepatterntainted → also check for Regex Injection (attacker adds their own quantifiers → instant ReDoS)- Both tainted → highest risk
For web endpoints, check:
- URL path / query param → regex for routing or validation
- HTTP body field → input validation regex
- Header (User-Agent, Content-Type) → server-side validation
5. Timing PoC Construction
A valid PoC must demonstrate measurable time difference between a benign and a malicious input
Perguntas frequentes
O que é ReDoS?
É uma lentidão causada por uma expressão regular que leva muito mais tempo com certas entradas, o que pode prender um servidor.
Todos os motores de regex são afetados?
Não. A skill diz que motores como RE2 e o regexp do Go não fazem backtracking, por isso não são afetados dessa forma.
Como a falha é confirmada?
A skill pede um teste de tempo que mostre um aumento claro do tempo de resposta em comparação com uma entrada normal.
Detalhes
Descrição original do autor
Hunt ReDoS (CWE-1333, Catastrophic Backtracking) — identify regexes with nested quantifiers or overlapping alternation that cause super-linear matching time, trace tainted input paths to regex sinks, demonstrate timing PoC, and validate with response-time delta. Covers PCRE/RE2/V8/Python re engine differences. Triggers on: 'ReDoS', 'regex denial', 'catastrophic backtracking', 'redos', 'regex complexity', 'nested quantifiers', 'regex amplification', 'CWE-1333'.
Popularidade
- Estrelas no GitHub
- 6,5 mil
- Posição no ranking
- #13968
- Licença
- Apache-2.0
- Atualizada em
- 01/11/2026
Comentários
- …
Mais skills deste repositório
detector-overview
6,5 milAjuda seu agente a ler o código marcado por um scanner e decidir quais pontos sinalizados são falhas reais de segurança e quais são falsos alarmes.
exploiter-overview
6,5 milAjuda seu agente a combinar várias fraquezas de segurança confirmadas em uma única cadeia de teste e verificar até onde essa cadeia poderia chegar.
llm-redteam-overview
6,5 milAjuda seu agente a encontrar o guia certo de red team de IA para um teste, cobrindo 15 grupos de táticas, da injeção de prompt ao abuso de modelos.
aatmf-t01-prompt-injection
6,5 milExplica a injeção de prompt, em que instruções ocultas tentam sobrepor-se a um sistema de IA, para que testadores de segurança consigam verificá-la.
Skills parecidas
reverse-engineer-anything
422 milAjuda seu agente a analisar apps e pacotes já publicados para explicar recursos, comparar versões ou orientar uma reconstrução, usando a ferramenta REA.
1password
394 milAjuda seu agente a configurar a CLI do 1Password, fazer login e ler ou injetar segredos sem imprimir seus valores no chat.
healthcheck
394 milAjuda seu agente a auditar o computador ou servidor que roda o OpenClaw em busca de riscos como SSH, firewall, atualizações e backups, com correções seguras.