Loading advisory.
Loading advisory.
net-imap has quadratic complexity when reading response literals
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.
Published 2026-05-04 22:02 UTC · Modified 2026-09-10 03:51 UTC
Severity and EPSS are shown separately. Helm does not combine them into one score.
| Package | Ecosystem | Affected | Fixed in | Upgrade command |
|---|---|---|---|---|
| net-imap | RubyGems | >= 0.6.0, < 0.6.4 >= 0.5.0, < 0.5.14 < 0.4.24 versions 0.6.0, 0.6.1, 0.6.2, 0.6.3, 0.5.0, 0.5.1, 0.5.10, 0.5.11, 0.5.12, 0.5.13, 0.5.2, 0.5.3, 0.5.4, 0.5.5, 0.5.6, 0.5.7, 0.5.8, 0.5.9, 0.1.0, 0.1.1 and 43 more | 0.6.4, 0.5.14, 0.4.24 | gem install net-imap -v 0.6.4gem install net-imap -v 0.5.14gem install net-imap -v 0.4.24 |
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.
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.
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.
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.
No public exploit code known to Helm's sources (Nuclei templates, Metasploit, Exploit-DB and PoC-in-GitHub). That does not mean none exists.
EPSS went from 0.004 on 2026-11-24 to 0.007 on 2026-11-26, over 2 recorded scores.
| Date | Score | Previous | Model |
|---|---|---|---|
| 2026-11-24 | 0.004 | first score | v2026.06.15 |
| 2026-11-26 | 0.007 | 0.004 | v2026.06.15 |