CVE-2026-42256
JSON

6.0medium

net-imap: Denial of service via high iteration count for `SCRAM-*` authentication

Severity
6.0medium CVSS:4.0 by GitHub_M
Exploit likelihood
0.30% (higher than 24% of CVEs; EPSS, by FIRST)
Published
Last changed
Assigned by
GitHub_M
Also known as
GHSA-87pf-fpwv-p7m7

Description

Net::IMAP implements Internet Message Access Protocol (IMAP) client functionality in Ruby. From versions 0.4.0 to before 0.4.24, 0.5.0 to before 0.5.14, and 0.6.0 to before 0.6.4, when authenticating a connection with SCRAM-SHA1 or SCRAM-SHA256, a hostile server can perform a computational denial-of-service attack on the client process by sending a big iteration count value. This issue has been patched in versions 0.4.24, 0.5.14, and 0.6.4.

Affected

Product or packageVersionsReported by
ruby net-imap>= 0.4.0, < 0.4.24, >= 0.5.0, < 0.5.14, >= 0.6.0, < 0.6.4CVE List
net-imap (RubyGems)from 0.6.0 before 0.6.4, from 0.5.0 before 0.5.14, from 0.4.0 before 0.4.24GitHub Advisory Database
ruby-lang net::imapfrom 0.4.0 before 0.4.24, from 0.5.0 before 0.5.14, from 0.6.0 before 0.6.4NVD

All scores

GitHub_M6.0medium CVSS:4.0CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:P/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N
GitHubmedium CVSS:4.0CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:P/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N
NVD6.5medium CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:N/A:H

Classification

CWE-770CWE-1322

SSVC (CISA-ADP): exploitation none, automatable no, technical impact partial.

What each source says

CVE List

Net::IMAP implements Internet Message Access Protocol (IMAP) client functionality in Ruby. From versions 0.4.0 to before 0.4.24, 0.5.0 to before 0.5.14, and 0.6.0 to before 0.6.4, when authenticating a connection with SCRAM-SHA1 or SCRAM-SHA256, a hostile server can perform a computational denial-of-service attack on the client process by sending a big iteration count value. This issue has been patched in versions 0.4.24, 0.5.14, and 0.6.4.

GitHub Advisory Database
Summary

When authenticating a connection with SCRAM-SHA1 or SCRAM-SHA256, a hostile server can perform a computational denial-of-service attack on the client process by sending a big iteration count value.

Details

A hostile IMAP server can send an arbitrarily large PBKDF2 iteration count in the SCRAM server-first-message, causing the client to perform an expensive OpenSSL::KDF.pbkdf2_hmac call. Because the PBKDF2 function is a blocking C extension and holds onto Ruby’s Global VM Lock, it can freeze the entire Ruby VM for the duration of the computation.

OpenSSL enforces an effective maximum by using a 32-bit signed integer for the iteration count, Depending on hardware capabilities and OpenSSL version, this iteration count may be sufficient for to block all Ruby threads in the process for over seven minutes.

This is listed as one of the "Security Considerations", in RFC 7804:

A hostile server can perform a computational denial-of-service attack on clients by sending a big iteration count value. In order to defend against that, a client implementation can pick a maximum iteration count that it is willing to use and reject any values that exceed that threshold (in such cases, the client, of course, has to fail the authentication).

Impact

During SCRAM authentication to a hostile server, the entire Ruby VM will be locked for the duration of the computation. Depending on hardware capabilities and OpenSSL version, this may take many minutes.

OpenSSL::KDF.pbkdf2_hmac is a blocking C function, so Timeout cannot be used to guard against this. And it retains the Global VM lock, so other ruby threads will also be unable to run.

Mitigation
  • Upgrade to a patched version of net-imap that adds the max_iterations option to the SASL-* authenticators, and call Net::IMAP#authenticate with a max_iterations keyword argument.

    NOTE: The default max_iterations is 2³¹ - 1, the maximum signed 32 bit integer, the maximum allowed by OpenSSL. To prevent a denial of service attack, this must be set to a safe value, depending on hardware and version of OpenSSL. It is the user's responsibility to enforce minimum and maximum iteration counts that are appropriate for their security context.

  • Alternatively, avoid SCRAM-* mechanisms when authenticating to untrusted servers.

NVD (es)

Net::IMAP implementa la funcionalidad de cliente del Protocolo de Acceso a Mensajes de Internet (IMAP) en Ruby. Desde las versiones 0.4.0 hasta antes de la 0.4.24, 0.5.0 hasta antes de la 0.5.14, y 0.6.0 hasta antes de la 0.6.4, al autenticar una conexión con SCRAM-SHA1 o SCRAM-SHA256, un servidor hostil puede realizar un ataque de denegación de servicio computacional en el proceso del cliente al enviar un valor de recuento de iteraciones grande. Este problema ha sido parcheado en las versiones 0.4.24, 0.5.14 y 0.6.4.

References

https://github.com/ruby/net-imap/security/advisories/GHSA-87pf-fpwv-p7m7mitigation, vendor-advisory, web
https://github.com/ruby/net-imap/commit/158d0b505074397cdb5ceb58935e42dd2bcfa612patch, web
https://github.com/ruby/net-imap/commit/808001bc45c06f7297a7e96d341279e041a7f7f4patch, web
https://github.com/ruby/net-imap/commit/99f59eab6064955a23debd95410263ad144df758patch, web
https://github.com/ruby/net-imap/releases/tag/v0.4.24release-notes, web
https://github.com/ruby/net-imap/releases/tag/v0.5.14release-notes, web
https://github.com/ruby/net-imap/releases/tag/v0.6.4release-notes, web
https://nvd.nist.gov/vuln/detail/CVE-2026-42256advisory
https://github.com/ruby/net-imappackage
https://github.com/rubysec/ruby-advisory-db/blob/master/gems/net-imap/CVE-2026-42256.ymlweb
https://www.rfc-editor.org/rfc/rfc7804.html#page-15web

Sources

SourceRecordLicence
CVE ListCVE-2026-42256 changed 2026-05-11CVE Terms of Use
GitHub Advisory DatabaseGHSA-87pf-fpwv-p7m7 changed 2026-09-10CC-BY-4.0
NVDCVE-2026-42256 changed 2026-07-24Public domain