CVE-2025-43857 net-imap rubygem vulnerable to possible DoS by memory exhaustion

Medium 6.0 Published Updated

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.

Weakness: CWE-770, CWE-789, CWE-405, CWE-400

Which versions are affected by CVE-2025-43857?

8 open source packages ship an affected version, including net-imap. It affects 1 product.

PackageAffectedFixed in
net-imap RubyGemsAll versions0.2.5
net-imap RubyGemsAll versions0.2.5
net-imap RubyGemsFrom 0.3.00.3.9
net-imap RubyGemsFrom 0.3.00.3.9
net-imap RubyGemsFrom 0.4.00.4.20
net-imap RubyGemsFrom 0.4.00.4.20
2 more packages
net-imap RubyGemsFrom 0.5.00.5.7
net-imap RubyGemsFrom 0.5.00.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.

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.

Is CVE-2025-43857 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free