CVE-2025-25186 Net::IMAP vulnerable to possible DoS by memory exhaustion

Medium 6.5 Published Updated

A malicious IMAP server can cause memory exhaustion and denial of service in the Ruby Net::IMAP client by sending highly compressed uid-set data.

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-25186?

CVE-2025-25186 is a medium-severity denial of service vulnerability in ruby net-imap, published on 10 Feb 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. Starting in version 0.3.2 and prior to versions 0.3.8, 0.4.19, and 0.5.6, there is a possibility for denial of service by memory exhaustion in `net-imap`'s response parser. At any time while the client is connected, a malicious server can send can send highly compressed `uid-set` data which is automatically read by the client's receiver thread. The response parser uses `Range#to_a` to convert the `uid-set` data into arrays of integers, with no limitation on the expanded size of the ranges. Versions 0.3.8, 0.4.19, 0.5.6, and higher fix this issue. Additional details for proper configuration of fixed versions and backward compatibility are available in the GitHub Security Advisory.

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

Which versions are affected by CVE-2025-25186?

6 open source packages ship an affected version, including net-imap.

PackageAffectedFixed in
net-imap RubyGemsFrom 0.3.20.3.8
net-imap RubyGemsFrom 0.3.20.3.8
net-imap RubyGemsFrom 0.4.00.4.19
net-imap RubyGemsFrom 0.4.00.4.19
net-imap RubyGemsFrom 0.5.00.5.6
net-imap RubyGemsFrom 0.5.00.5.6

How do I fix CVE-2025-25186?

Upgrade net-imap to a fixed version for your release line: 0.3.8, 0.4.19 or 0.5.6.

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-25186 being exploited?

It is not confirmed as exploited in the wild, but public exploit code for CVE-2025-25186 exists.

Sources

Also known as AZL-56555, BELL-CVE-2025-25186, DEBIAN-CVE-2025-25186, GHSA-7fc5-f82f-cx69, MINI-44mx-vwr4-8c9p, OESA-2025-1195 and 2 more.

Is CVE-2025-25186 in your software?

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

Check your SBOMs for free