llamaCVEVulnerability Intelligence
/
Advisory · GitHub · RubyGems · net-imap

GHSA-Q2MW-FVJ9-VVCW

net-imap has quadratic complexity when reading response literals

Parche disponible
Descargar PNG JSON
CVSS
—
low
Fuente: —
ExplotaciónSin evidenciaNo figura en CISA KEV
Exploits públicos0Ninguno conocido
Parche3 versionesPrimer parche a -11 d de la divulgación
Exposición199 dDesde la divulgación, 4 may 2026, 5:02 p. m.
Detección196 dDesde la divulgación hasta su ingreso al índice
Timeline

Ciclo de vida de la vulnerabilidad

Hoy
Divulgación
Publicada
Modificada
Explotación
Remediación
Parche 0.4.24 +2
Monitoreo
Detectada
23 abr 26
4 may 26
10 sept 26
17 nov 26
20 nov 26
23 abr 26
15 jun 26
7 ago 26
29 sept 26
20 nov 26
FechaFaseEventoDetalle
Remediación Parche 0.4.24 net-imap · -11 d desde divulgación
Remediación Parche 0.5.14 net-imap · -11 d desde divulgación
Remediación Parche 0.6.4 net-imap · -11 d desde divulgación
Divulgación Publicada GHSA-Q2MW-FVJ9-VVCW divulgada
Divulgación Modificada Última actualización del registro
Monitoreo Detectada Ingresó al índice
Resumen
Descripción del advisory
Texto original · GitHub · en inglés
Summary

`Net::IMAP::ResponseReader` has quadratic time complexity when reading large responses containing many string literals. A hostile server can send responses which are crafted to exhaust the client's CPU for a denial of service attack.

Details

For each literal in a response, `ResponseReader` rescans the entire growing response buffer. The regular expression that is used to scan the response buffer runs in linear time. With many literals, this becomes O(n²) total work. The regular expression should run in constant time: it is anchored to the end and only the last 23 bytes of the buffer are relevant.

Because the algorithmic complexity is super-linear, this bypasses protection from `max_response_size`: a response can stay well below the default size limit while still causing very large CPU cost.

`Net::IMAP::ResponseReader` runs continuously in the receiver thread until the connection closes.

Impact

This consumes disproportionate CPU time in the client's receiver thread. A hostile server could use this to exhaust the client's CPU for a denial of service attack.

For a response near the default `max_response_size`, each individual regexp scan could take between 100 to 200ms on common modern hardware, and this may be repeated 200k times per megabyte of response. While the regexp is scanning, it retains the Global VM lock, preventing other threads from running.

Although other threads should not be _completely_ blocked, their run time will be significantly impacted.

Mitigation
  • Upgrade to a patched version of net-imap that reads responses more efficiently.
  • Do not connect to untrusted IMAP servers.
  • When connecting to untrusted servers, a _much_ smaller `max_response_size` (for example: 8KiB) will limit the impact. Although this is too small for fetching unpaginated message bodies, it should be enough for most other operations.
Versiones

Rangos afectados

Afectada Corregida Última
net-imap< 0.4.24
net-imap≥ 0.5.0 < 0.5.14
net-imap≥ 0.6.0 < 0.6.4
0.4.24
0.5.0
0.5.14
0.6.0
0.6.4
0.6.8
Remediación

Estado del parche por paquete

Paquete / productoEstadoCorregida enDesde divulgaciónÚltima versión
rubygemsnet-imap
Corregida 0.4.24, 0.5.14, 0.6.4 -11 d · -11 d · -11 d 0.6.8 no afectada
Versiones corregidas0.4.240.5.140.6.4
Explotación

Arsenal público

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

Referencias
Advisoryhttps://nvd.nist.gov/vuln/detail/CVE-2026-42245
Otrahttps://github.com/ruby/net-imap/security/advisories/GHSA-q2mw-fvj9-vvcw
Otrahttps://github.com/ruby/net-imap/commit/6091f7d6b1f3514cafbfe39c76f2b5d73de3ca96
Otrahttps://github.com/ruby/net-imap/commit/88d95231fc8afef11c1f074453f7d75b68c9dfda
Otrahttps://github.com/ruby/net-imap/commit/de685f91a4a4cc75eb80da898c2bf8af08d34819
Otrahttps://github.com/ruby/net-imap
Otrahttps://github.com/ruby/net-imap/releases/tag/v0.4.24
Otrahttps://github.com/ruby/net-imap/releases/tag/v0.5.14
Otrahttps://github.com/ruby/net-imap/releases/tag/v0.6.4
Otrahttps://github.com/rubysec/ruby-advisory-db/blob/master/gems/net-imap/CVE-2026-42245.yml

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