Your RSA-2048 keys break in 2030. Find every one of them before attackers do.
💎 RubyGems
Not in CISA KEV

CVE-2026-42245 — net-imap

Fix: ruby/net-imap@6091f7d

CVE-2026-42245 is a CWE-407 vulnerability in net-imap. A fix is available for net-imap — see the affected versions and patch details below.

net-imap: Quadratic complexity when reading response literals

Also known asGHSA-q2mw-fvj9-vvcw
Published
May 9, 2026
Updated
Aug 12, 2026
Affected
3 pkgs
Patched
3 / 3
Exploits
None indexed
Exploitation data as of Sep 24, 2026 · OSV.dev, NVD, FIRST.org (EPSS)

Exploitation Status

No confirmed exploitation observed yet

  • CISA’s own triage has not observed active exploitation or public proof-of-concept code for this CVE as of its last assessment.

Exploitation and automatability from CISA’s SSVC triage for CVE-2026-42245.

EPSS Exploitation Probability

via FIRST.org ↗
0.7%probability of exploitation in next 30 days
Lower Risk0.00%
Lower risk than most CVEs51th percentile — riskier than 51% of all scored CVEsHighest risk

EPSS (Exploit Prediction Scoring System) is a daily probability model maintained by FIRST.org. It estimates the likelihood a CVE will be exploited in production environments within the next 30 days, derived from real-world threat intelligence signals.

Real-World Exposure

3 pkgs affected
💎net-imap💎net-imap💎net-imap

Real-time download stats are indexed for npm and PyPI packages. This vulnerability affects RubyGems packages — download data is not available via public APIs for these ecosystems.

Description

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.

Affected Packages

3 total 3 fixed
EcosystemPackageVulnerable rangeFix
💎RubyGemsnet-imap≥ 0.6.0&&< 0.6.40.6.4bundle update net-imap --conservative
💎RubyGemsnet-imap≥ 0.5.0&&< 0.5.140.5.14bundle update net-imap --conservative
💎RubyGemsnet-imapall versions0.4.24bundle update net-imap --conservative

Detection & mitigation playbook

Open-source dependency
  1. Detect

    Scan your dependency tree (package-lock.json, pnpm-lock.yaml, requirements.txt, go.sum, etc.) for net-imap, including transitive dependencies — a direct dependency you never call can still pull in a vulnerable version.

  2. Fix

    Update net-imap to 0.6.4 or later, then make sure no transitive (indirect) dependency still pins the vulnerable range — O3 confirms CVE-2026-42245 is resolved across your whole dependency graph.

  3. Workarounds

    If you can't upgrade right away: gate or disable the affected feature, validate untrusted input at the boundary, and avoid passing attacker-controlled data into the vulnerable path. O3's runtime protection blocks exploitation in production as an interim safeguard until the upgrade lands.

  4. How O3 protects you

    O3 Security's impact-aware SCA analyses which vulnerable code paths your application actually calls, so a match like CVE-2026-42245 can be triaged on real exposure rather than presence alone.

Tailored to CVE-2026-42245. Runtime protection reduces exposure until a permanent patch is applied and verified — it complements patching, it doesn't replace it.

Fixing This On Your OS

If you run this on a Linux distribution, patch through your package manager against the distro's own security advisory below — it tracks the exact backported fix for your release, which can ship on a different timeline (and sometimes a different severity) than the upstream project.

Red HatModerate

Red Hat has rated this flaw as Moderate because a malicious IMAP server can trigger excessive CPU consumption, resulting in a denial-of-service (DoS) condition in client applications using the affected Net::IMAP library. Successful exploitation requires interaction with a hostile server, and the impact is strictly…

ProductFixed inAdvisory
Red Hat Enterprise Linux 10ruby4.0-0:4.0.3-35.el10_2RHSA-2026:33540
Red Hat Enterprise Linux 10ruby-0:3.3.10-13.el10_2RHSA-2026:33565
Red Hat Enterprise Linux 10.0 Extended Update Supportruby-0:3.3.10-11.el10_0.2RHSA-2026:35895
Red Hat Enterprise Linux 8ruby:3.3-8100020260615131010.489197e6RHSA-2026:33515
Red Hat Enterprise Linux 9ruby:3.3-9080020260615131001.9RHSA-2026:33576
Red Hat Enterprise Linux 9ruby:4.0-9080020260619130154.9RHSA-2026:33577
Red Hat Enterprise Linux 9.4 Update Services for SAP Solutionsruby:3.3-9040020260630065449.9RHSA-2026:36099
Red Hat Enterprise Linux 9.6 Extended Update Supportruby:3.3-9060020260630075016.9RHSA-2026:37238

Frequently Asked Questions

### 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 o
O3 Security · Impact-Aware SCA

Is CVE-2026-42245 in your dependencies?

O3 Security finds CVE-2026-42245 across RubyGems dependencies, including transitive ones, and its impact-aware SCA ranks findings by whether your code actually calls the vulnerable path.

CVE-2026-42245: net-imap DoS | O3 Security