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

GHSA-GRQQ-QH92-HW79

PerformanceMonitor imposes an unbounded per-value CPU tax on every scanned request and, under threads, drops detection into an unbounded fallback scan

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.14.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-GRQQ-QH92-HW79 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

`PerformanceMonitor` is always on in the default enhanced detection mode: `SusPatternsManager.detect()` calls `record_metric()` after every pattern check. Once a pattern's `recent_times` window reaches `min_samples_for_anomaly`, `record_metric` ran `statistics.mean` and `statistics.stdev` over that window on every call. Those functions use exact-Fraction arithmetic, so each scanned request value paid a CPU cost that is a function of the monitor's window, not of the request, and that no configuration option bounded. Measured on 3.13.0: about 4.3 ms per scanned value in legacy mode against about 46.6 ms per value in enhanced mode once warm, an 11x tax on all production traffic. Combined with the absence of any per-request value bound (GHSA-3hfx-8m47-5f9h) this let a single request with many values hold the event loop for tens of seconds, and it made the reporter's GHSA-3hfx timings 2x to 11x too low for a warmed production process.

A second defect in the same component turned the tax into an unbounded scan under real OS threads. `record_metric` appended to `recent_times` under the monitor lock but the anomaly check iterated the same deque after the lock was released. A concurrent `record_metric` (the sync tree under gunicorn `--threads`, or any threaded WSGI deployment through flaskapi-guard or djapi-guard) could append mid-iteration and raise `RuntimeError: deque mutated during iteration` out of `detect()`. The enhanced-scan exception fallback then ran `pattern.search()` directly on every compiled pattern with no scan window and no timeout, re-exposing the quadratic built-in patterns that GHSA-r7hm-rjvg-xx7j had bounded (about 30 s of CPU per thread on the r7hm payload).

Impact
  • Unauthenticated, remote, default configuration. No option disables the monitor's statistical check.
  • Availability only: CPU exhaustion on the worker; in the threaded case a single request pair can reproduce the race and the subsequent unbounded scan.
  • Async deployments (fastapi-guard) are affected by the CPU tax; threaded sync deployments (flaskapi-guard, djapi-guard, any `guard_core.sync` consumer) are affected by both.
Fix

3.14.0 replaces the exact-Fraction statistics with `math.fsum`-based float mean and sample variance (identical anomaly decisions; 300 `record_metric` calls drop from about 47 ms to about 13 ms, and the end-to-end detection benchmark from about 54 s to about 20 s of CPU), runs the anomaly check inside the same lock as the append that feeds it, snapshots the reporting getters under the lock (they become coroutines in the async tree), and routes the exception fallback through the same bounded matchers the enhanced scan uses. The new `SecurityConfig.detection_max_scan_values` cap (GHSA-3hfx-8m47-5f9h) bounds the number of values a request can push through the monitor.

Workarounds

For users who cannot upgrade: place a request-body size limit and a per-client rate limit in front of the application; threaded sync deployments can run one thread per worker process to avoid the race. `detection_mode="legacy"` avoids the monitor but loses the enhanced-mode detection coverage.

Credit

Found by the maintainers while verifying GHSA-3hfx-8m47-5f9h (reported by @RomanPszonka); the threaded race surfaced in the 3.14.0 CI run.

Status

Fixed in guard-core 3.14.0 https://github.com/rennf93/guard-core/releases/tag/3.14.0 (PyPI https://pypi.org/project/guard-core/3.14.0/), merged in #82 https://github.com/rennf93/guard-core/pull/82 (500d4ef6). Float anomaly statistics under the monitor lock, reporting getters snapshot under the lock (coroutines in the async tree), exception fallback routed through the bounded matchers, and `detection_max_scan_values` bounding the values a request can push through the monitor.

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< 3.14.0
3.14.0
Remediación

Estado del parche por paquete

Paquete / productoEstadoCorregida enDesde divulgaciónÚltima versión
PyPIguard-core
Corregida 3.14.0 — —
Versiones corregidas3.14.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-grqq-qh92-hw79

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