GHSA-WG34-2PGP-VX43
@RateLimit can be bypassed with a client-supplied X-Forwarded-For header and its counter map is unbounded
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:L
Fuente: GitHub
Ciclo de vida de la vulnerabilidad
| Fecha | Fase | Evento | Detalle |
|---|---|---|---|
| Divulgación | Publicada | GHSA-WG34-2PGP-VX43 divulgada · CVSS 6.5 (GitHub) | |
| Remediación | Parche 5.5.7 | org.omnifaces:omnifaces · 0 d desde divulgación | |
| Monitoreo | Detectada | Ingresó al índice | |
| Monitoreo | Verificada | Última verificación contra las fuentes |
Impact
`@RateLimit` without `clientId`, and `RateLimiter#checkRateLimit(HttpServletRequest, ...)`, keyed the rate limit on `Servlets#getRemoteAddr()`. That method trusts the `Forwarded`, `X-Forwarded-For` and `X-Real-IP` request headers, which the client controls. A client could send a different value on every request, get a fresh counter every time, and so never hit the limit.
Every new key also stayed in the counter map for one time window. The map was scanned in full on every request. A client which varies the header could therefore grow the map without bound and make each request slower. The cost is quadratic in the number of requests per time window.
A check with a short time window also removed the counters of a longer time window, which reset their limit.
Patches
Fixed in 5.5.7:
- The rate limit key is now `HttpServletRequest#getRemoteAddr()`. Proxy headers are not consulted.
- An IPv6 address is keyed by its `/64` network prefix. An IPv4-mapped address, or one in the NAT64 well-known prefix `64:ff9b::/96`, is keyed by its embedded IPv4 address.
- Each counter expires by its own time window. A periodic task removes expired counters, so requests no longer scan the map.
- The number of tracked request counters is capped by the new `org.omnifaces.RATE_LIMITER_MAX_TRACKED_COUNTERS` context param, which defaults to 100000. When the cap is reached, a request which needs a new counter is rejected.
When the application runs behind a reverse proxy, configure the servlet container to resolve the client IP address from trusted proxies only. Examples are Tomcat's `RemoteIpValve`, WildFly/Undertow's `proxy-address-forwarding` and Payara/GlassFish's `auth-pass-through-enabled`. Otherwise all clients share the IP address of the proxy and therefore one rate limit.
Workarounds
Pass an explicit client ID based on `HttpServletRequest#getRemoteAddr()` to `RateLimiter#checkRateLimit(String, ...)`, instead of relying on `@RateLimit` without `clientId`. Alternatively, let the reverse proxy remove or overwrite the `Forwarded`, `X-Forwarded-For` and `X-Real-IP` headers. The second option prevents the bypass only. The counter map is still scanned on every request.
Not affected
`Servlets#getRemoteAddr()` and `Faces#getRemoteAddr()` keep reading proxy headers. Their javadoc now warns against using them for security decisions. The IP address logged by `FacesRequestLogger`, `FacesExceptionFilter`, `FullAjaxExceptionHandler` and `ScriptErrorServlet` therefore stays client-supplied. That value is for information only and drives no security decision.
Desglose de métricas
Rangos afectados
Estado del parche por paquete
| Paquete / producto | Estado | Corregida en | Desde divulgación | Última versión |
|---|---|---|---|---|
mavenorg.omnifaces:omnifaces |
Corregida | 5.5.7 | 0 d | 5.5.7 no afectada |
5.5.7Arsenal público
Sin exploits, módulos ni PoC públicos conocidos a la fecha de verificación.
https://github.com/omnifaces/omnifaces/security/advisories/GHSA-wg34-2pgp-vx43Las referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
