CVE-2025-43857 net-imap rubygem vulnerable to possible DoS by memory exhaustion
A malicious IMAP server can cause memory exhaustion and denial of service in the Ruby net-imap client by sending large literal byte counts.
- Exploited in the wild
- Not known
- Login needed
- Not needed
- Attackable
- Over the internet
- Victim action needed
- A user has to click or open something
- Fix
- Available
What is CVE-2025-43857?
CVE-2025-43857 is a medium-severity denial of service vulnerability in ruby net-imap, published on 28 Apr 2025. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.
Official description
Net::IMAP implements Internet Message Access Protocol (IMAP) client functionality in Ruby. Prior to versions 0.5.7, 0.4.20, 0.3.9, and 0.2.5, there is a possibility for denial of service by memory exhaustion when net-imap reads server responses. At any time while the client is connected, a malicious server can send can send a "literal" byte count, which is automatically read by the client's receiver thread. The response reader immediately allocates memory for the number of bytes indicated by the server response. This should not be an issue when securely connecting to trusted IMAP servers that are well-behaved. It can affect insecure connections and buggy, untrusted, or compromised servers (for example, connecting to a user supplied hostname). This issue has been patched in versions 0.5.7, 0.4.20, 0.3.9, and 0.2.5.
Which versions are affected by CVE-2025-43857?
8 open source packages ship an affected version, including net-imap. It affects 1 product.
| Package | Affected | Fixed in |
|---|---|---|
net-imap RubyGems | All versions | 0.2.5 |
net-imap RubyGems | All versions | 0.2.5 |
net-imap RubyGems | From 0.3.0 | 0.3.9 |
net-imap RubyGems | From 0.3.0 | 0.3.9 |
net-imap RubyGems | From 0.4.0 | 0.4.20 |
net-imap RubyGems | From 0.4.0 | 0.4.20 |
2 more packages
net-imap RubyGems | From 0.5.0 | 0.5.7 |
net-imap RubyGems | From 0.5.0 | 0.5.7 |
Products include Ruby-Lang Net\.
How do I fix CVE-2025-43857?
Upgrade net-imap to a fixed version for your release line: 0.2.5, 0.3.9, 0.4.20 or 0.5.7.
Upgrade, then put limits on request size, rate and nesting depth so one client cannot exhaust the service. More about Denial of service.
Is CVE-2025-43857 being exploited?
There is no known exploitation of CVE-2025-43857 in the wild and no public exploit code.
Other vulnerabilities in ruby net-imap
- CVE-2026-42246 net-imap vulnerable to STARTTLS stripping via invalid response timing
- CVE-2026-42256 net-imap: Denial of service via high iteration count for `SCRAM-*` authentication
- CVE-2026-42257 net-imap: Command Injection via "raw" arguments to multiple commands
- CVE-2026-42258 net-imap: Command Injection via unvalidated Symbol inputs
- CVE-2026-42245 net-imap: Quadratic complexity when reading response literals
Sources
Also known as ALPINE-CVE-2025-43857, DEBIAN-CVE-2025-43857, ECHO-d252-3984-4cf6, GHSA-j3g3-5qv5-52mj, MINI-mfwq-779c-vj46, MINI-mj9j-p5vp-f5jh and 4 more.