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.
Affected products
| Vendor | Product | Affected | Fixed |
|---|---|---|---|
| ruby | net-imap | >= 0.5.0, < 0.5.7, >= 0.4.0, < 0.4.20, >= 0.3.0, < 0.3.9, >= 0, < 0.2.5 | — |
Fixed in Linux distributions
Distributions backport fixes, so the version that fixes this vulnerability differs per release — upgrade to at least the version shown. From the distributions' security trackers and advisories.
Debian
Security tracker ↗| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| Debian 14 | ruby3.3 | No fix yet | — |
| Debian 13 | ruby3.3 | No fix yet | — |
| Debian 12 | ruby3.1 | No fix yet | — |
Ubuntu
Security tracker ↗| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| Ubuntu 26.10 | jruby +1 | No fix yet | — |
| Ubuntu 26.04 LTS | jruby +1 | No fix yet | — |
| Ubuntu 25.10 | jruby +1 | No fix yet | — |
| Ubuntu 24.04 LTS | jruby +1 | No fix yet | — |
| Ubuntu 22.04 LTS | ruby3.0 | No fix yet | — |
Show 6 more (older releases, extended support, other products)Fewer releases
| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| Ubuntu 20.04 LTS | jruby | No fix yet | — |
| Ubuntu 18.04 LTS | jruby | No fix yet | — |
| Ubuntu 16.04 LTS | jruby | No fix yet | — |
| Ubuntu Pro 20.04 LTS | ruby2.7 | No fix yet | — |
| Ubuntu Pro 18.04 LTS | ruby2.5 | No fix yet | — |
| Ubuntu Pro 14.04 LTS | jruby | No fix yet | — |
Alpine
Security tracker ↗| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| Alpine v3.21 | ruby-net-imap | 0.4.22-r0 | — |
| Alpine v3.20 | ruby-net-imap | 0.4.22-r0 | — |
Amazon Linux
| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| Amazon Linux 2023 | ruby3.2 +5 | 3.2.8-184.amzn2023.0.5 | ALAS2023-2025-1168 |
| Amazon Linux 2023 | ruby3.2-rubygem-bigdecimal | 3.1.3-184.amzn2023.0.5 | ALAS2023-2025-1168 |
| Amazon Linux 2023 | ruby3.2-rubygem-bundler | 2.4.19-184.amzn2023.0.5 | ALAS2023-2025-1168 |
| Amazon Linux 2023 | ruby3.2-rubygem-io-console | 0.6.0-184.amzn2023.0.5 | ALAS2023-2025-1168 |
| Amazon Linux 2023 | ruby3.2-rubygem-irb | 1.6.2-184.amzn2023.0.5 | ALAS2023-2025-1168 |
| Amazon Linux 2023 | ruby3.2-rubygem-json | 2.6.3-184.amzn2023.0.5 | ALAS2023-2025-1168 |
| Amazon Linux 2023 | ruby3.2-rubygem-minitest | 5.25.1-184.amzn2023.0.5 | ALAS2023-2025-1168 |
| Amazon Linux 2023 | ruby3.2-rubygem-power_assert | 2.0.3-184.amzn2023.0.5 | ALAS2023-2025-1168 |
| Amazon Linux 2023 | ruby3.2-rubygem-psych | 5.0.1-184.amzn2023.0.5 | ALAS2023-2025-1168 |
| Amazon Linux 2023 | ruby3.2-rubygem-rake | 13.0.6-184.amzn2023.0.5 | ALAS2023-2025-1168 |
| Amazon Linux 2023 | ruby3.2-rubygem-rbs | 2.8.2-184.amzn2023.0.5 | ALAS2023-2025-1168 |
| Amazon Linux 2023 | ruby3.2-rubygem-rdoc | 6.5.1.1-184.amzn2023.0.5 | ALAS2023-2025-1168 |
| Amazon Linux 2023 | ruby3.2-rubygem-rexml | 3.3.9-184.amzn2023.0.5 | ALAS2023-2025-1168 |
| Amazon Linux 2023 | ruby3.2-rubygem-rss | 0.3.1-184.amzn2023.0.5 | ALAS2023-2025-1168 |
| Amazon Linux 2023 | ruby3.2-rubygem-test-unit | 3.5.7-184.amzn2023.0.5 | ALAS2023-2025-1168 |
| Amazon Linux 2023 | ruby3.2-rubygem-typeprof | 0.21.3-184.amzn2023.0.5 | ALAS2023-2025-1168 |
| Amazon Linux 2023 | ruby3.2-rubygems +1 | 3.4.19-184.amzn2023.0.5 | ALAS2023-2025-1168 |
Wolfi
| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| Wolfi rolling | jruby-9.4 +1 | 9.4.13.0-r0 | — |
| Wolfi rolling | kube-fluentd-operator +3 | 1.18.2-r36 | — |
| Wolfi rolling | ruby-3.1 +2 | No fix yet | — |
Affected packages
| Ecosystem | Package | Affected | Fixed | Record |
|---|---|---|---|---|
| RubyGems | net-imap | >= 0.5.0, < 0.5.7 | 0.5.7 | GHSA-j3g3-5qv5-52mj |
| RubyGems | net-imap | >= 0.4.0, < 0.4.20 | 0.4.20 | GHSA-j3g3-5qv5-52mj |
| RubyGems | net-imap | >= 0.3.0, < 0.3.9 | 0.3.9 | GHSA-j3g3-5qv5-52mj |
| RubyGems | net-imap | < 0.2.5 | 0.2.5 | GHSA-j3g3-5qv5-52mj |
Advisories 2
- ALAS2023-2025-1168 Moderate: ruby3.2 security update (Amazon Linux 2023) Amazon Linux Security Center (ALAS) · Sep 8, 2025
- WID-SEC-2025-0914 Ruby: Schwachstelle ermöglicht Denial of Service BSI CERT-Bund (WID) · Jul 23, 2025
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