Skip to main content

CVE-2026-42245 — Vulnerability in net-imap — CVE Details

LOW

net-imap has quadratic complexity when reading response literals

Published May 4, 2026Updated September 10, 2026Source: OSV

What Should I Do?

Address in Next Maintenance Window

Low exploitation probability (0.70%). Schedule for your next planned update.

Does your project use an affected net-imap version?

Paste your Gemfile.lock to check it for CVE-2026-42245 and every other known vulnerability, with CISA KEV and EPSS on each finding. Free with no signup for up to 10 packages, or up to 500 per scan with a free account, which also keeps up to 200 packages in saved projects.

Check my Gemfile.lock

Summary

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.

Advisory Timeline

  • First published May 4, 2026 (206 days ago).
  • Last revised September 10, 2026 — 128 days after initial publication.

Remediation

Upgrade to the fixed version using your package manager.

Bundler
Update net-imap to 0.4.24 or later
gem install net-imap -v 0.4.24
Bundler
Update net-imap to 0.6.4 or later
gem install net-imap -v 0.6.4
Bundler
Update net-imap to 0.5.14 or later
gem install net-imap -v 0.5.14

After upgrading, scan your dependencies again to confirm the vulnerability is resolved.

Affected Packages (3)

Affects 1 ecosystem: RubyGems (1).

PackageFixed In
net-imap RubyGems · Affected: 0.1.0, 0.1.1, 0.2.0, 0.2.1 (+41 more)0.4.24
net-imap RubyGems · Affected: 0.6.0, 0.6.1, 0.6.2, 0.6.30.6.4
net-imap RubyGems · Affected: 0.5.0, 0.5.1, 0.5.10, 0.5.11 (+10 more)0.5.14

Vulnerability Classification

Common Weakness Enumeration (CWE) identifiers for this vulnerability type.

CVSS Score Breakdown

What the CVSS (Common Vulnerability Scoring System) 3.9 score means for each attack dimension.

Attack Vector
Network
Attack Complexity
Low
Privileges Required
None
User Interaction
P
Scope
—
Confidentiality
—
Integrity
—
Availability
—

CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:P/VC:N/VI:N/VA:L/SC:N/SI:N/SA:N

Frequently Asked Questions

What is CVE-2026-42245?
net-imap has quadratic complexity when reading response literals. This vulnerability has been assigned a severity rating of LOW (CVSS score: 3.9/10).
How do I check if my project is affected by CVE-2026-42245?
CVE-2026-42245 affects net-imap. It has a 0.7% probability of exploitation within 30 days (EPSS score). Use GeekWala's free vulnerability scanner to check your dependencies against CVE-2026-42245 and 200,000+ other known vulnerabilities.

Severity & Exploitability

CVSS Score
3.9

Exploitation is difficult, or the impact is minor.

EPSS Score (30-day exploit probability)
0.70%
EPSS percentile: 48.7

This is a below-median EPSS score — only 48.7% of tracked vulnerabilities score at or below it, so most tracked vulnerabilities are considered more likely to be exploited than this one.

Also Known As

GHSA-q2mw-fvj9-vvcw

Related CVEs

Check your own dependencies

Free, with no signup for up to 10 packages.

Check my Gemfile.lock