llamaCVEVulnerability Intelligence
/
Advisory · GitHub · PyPI · guard-core

GHSA-9845-MQQR-7RXP

SemanticAnalyzer request scan is quadratic in content length, letting plain repeated characters hold the event loop for seconds per request

Parche disponible
Descargar PNG JSON
CVSS 3.1
7.5
Alta
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H Fuente: GitHub
ExplotaciónSin evidenciaNo figura en CISA KEV
Exploits públicos0Ninguno conocido
Parche1 versión3.13.0
Exposición85 dDesde la divulgación, 26 ago 2026, 2:49 p. m.
Detección85 dDesde la divulgación hasta su ingreso al índice
Timeline

Ciclo de vida de la vulnerabilidad

Hoy
Divulgación
Publicada
Explotación
Remediación
Monitoreo
Detectada +1
26 ago 26
20 nov 26
26 ago 26
17 sept 26
8 oct 26
29 oct 26
20 nov 26
FechaFaseEventoDetalle
Divulgación Publicada GHSA-9845-MQQR-7RXP divulgada · CVSS 7.5 (GitHub)
Monitoreo Detectada Ingresó al índice
Monitoreo Verificada Última verificación contra las fuentes
Resumen
Descripción del advisory
Texto original · GitHub · en inglés
Summary

`SemanticAnalyzer.analyze()` (`guard_core/detection_engine/semantic.py`), invoked by the default enhanced detection mode on every scanned request value, ran in time quadratic in the length of the scanned content. The blow-up is triggered by ordinary repeated characters with no attack syntax, so any unauthenticated request whose body reaches the analyzer consumes a large, fixed amount of CPU. The work runs on the event loop and cannot be cancelled by a timeout (a CPU-bound regex holds the GIL), so a small number of concurrent requests saturates a worker.

Details

Four `attack_structures` patterns used unbounded greedy quantifiers whose character class did not exclude their own start character: `function_call` (`\w+\s*\([^)]*\)`), `path_traversal` (`\.{2,}[/\\]`), `url_pattern` (`[a-z]+://`) and `tag_like` (`<[^>]+>`). On non-matching input the outer scan tries O(n) start positions and each greedily consumes O(n) characters before failing, giving O(n^2) total. `detection_max_content_length` bounds the input length but not the quadratic factor.

Reachability was confirmed on the 3.12.0 tag: `guard_core/handlers/suspatterns_handler.py` calls `semantic_analyzer.analyze(content)` on scanned content with no length cap in the analyzer itself. No non-default option is required.

Impact
  • Trigger: a request body of repeated characters, for example the byte `a` repeated. No SQL, HTML or other attack syntax is required.
  • Cost: `SemanticAnalyzer.analyze("a" * n)` grew about 4x per doubling of `n`: about 0.25 s at 2500 bytes, 0.99 s at 5000, 3.95 s at 10000, 15.8 s at 20000 (measured on the 1.0.0 through 3.12.0 code). At the default `detection_max_content_length` of 10000 the per-request cost is about 4 s of uncancellable CPU.
  • Unauthenticated, remote, enabled by default wherever enhanced-mode detection scans request values. A handful of concurrent requests denies service to a worker.
Fix

3.13.0 bounds `function_call` (`\w{1,64}\s*\([^)]{0,256}\)`), `path_traversal` (`\.{2,20}[/\\]`) and `url_pattern` (`[a-z]{1,32}://`) so per-position work is constant, and scans `tag_like` only up to the last `>` in the content (`_tag_scan_window`), making `analyze()` linear in input length. Measured after the fix: about 0.09 s at 20000 bytes versus 15.8 s before. Detection results on the 3.13.0 detection corpus are unchanged.

Workarounds

For users who cannot upgrade: lower `detection_max_content_length` (the cost is quadratic in the capped length, so a smaller cap helps super-linearly, at the price of coverage on long bodies), and place a request-body size limit and a per-client rate limit in front of the application.

Credit

Found during the guard-core 3.13.0 hardening review.

Status

Filed retroactively on 2026-08-26. Fixed in guard-core 3.13.0 https://github.com/rennf93/guard-core/releases/tag/3.13.0 (`SemanticAnalyzer` quantifiers bounded, `tag_like` scanned through `_tag_scan_window`); 3.14.0 keeps the fix and adds the per-request scan cap (GHSA-3hfx-8m47-5f9h).

Vector CVSS 3.1

Desglose de métricas

Opción resaltada = valor del vector · izquierda = peor caso · GitHub
Vector de ataqueAV:N
RedAdyacenteLocalFísica
ComplejidadAC:L
BajaAlta
PrivilegiosPR:N
NingunoBajosAltos
InteracciónUI:N
NingunaRequerida
AlcanceS:U
CambiadoSin cambio
ConfidencialidadC:N
AltoBajoNinguno
IntegridadI:N
AltoBajoNinguno
DisponibilidadA:H
AltoBajoNinguno
Versiones

Rangos afectados

Afectada Corregida
guard-core≥ 1.0.0 < 3.13.0
1.0.0
3.13.0
Remediación

Estado del parche por paquete

Paquete / productoEstadoCorregida enDesde divulgaciónÚltima versión
PyPIguard-core
Corregida 3.13.0 — —
Versiones corregidas3.13.0
Explotación

Arsenal público

Sin exploits, módulos ni PoC públicos conocidos a la fecha de verificación.

Referencias
Advisoryhttps://github.com/Guard-Core/guard-core/security/advisories/GHSA-9845-mqqr-7rxp

Las referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.