CVE-2025-43857
Nonenet-imap rubygem vulnerable to possible DoS by memory exhaustion
CVSS
—
EPSS
0.5%
Published
Apr 28, 2025
CISA due date
—
Cloudanix analysis
A malicious or compromised mail server can make affected software run out of memory and crash when it connects to retrieve mail.
- Exploitation
- Adjacent Network
- Attacker needs
- None
- Complexity
- Moderate
- Impact
- Denial Of Service
- Component
- Library
- Class
- Denial of service
- Remediation
- Upgrade
- Effort
- Medium
- Patch risk
- Low
What it actually does
The flaw is a denial-of-service condition caused by unsafe memory allocation while processing IMAP server responses. When a client using the vulnerable IMAP response reader receives a server-declared literal byte count, the receiver thread trusts that count and immediately attempts to allocate memory for the advertised size. A malicious, compromised, buggy, or untrusted IMAP server can advertise an excessively large literal size without needing to send a corresponding payload, causing the client process to consume large amounts of memory and potentially crash or be killed by the operating system. The issue is most relevant where software connects to user-supplied, untrusted, insecure, or compromised IMAP endpoints; securely configured connections to trusted, well-behaved IMAP servers materially reduce exposure.
Why it matters to the business
Successful exploitation can interrupt mail-processing workflows, automation jobs, or services that initiate IMAP connections, leading to application crashes, degraded availability, failed background processing, or host-level memory pressure if many processes are affected. The issue is not known to be exploited in the wild, is not in the CISA KEV catalog, is not associated with ransomware campaigns, and has a low EPSS score of 0.0047, so prioritization should be risk-based: higher for systems that connect to externally controlled or user-configurable IMAP servers, and lower for systems restricted to trusted mail infrastructure. For the listed Red Hat Enterprise Linux 9.0 EUS AppStream QEMU-related packages, remediation is available in version 17:6.2.0-11.el9_0.8.
How an attack unfolds
An attacker must be able to influence the IMAP server endpoint contacted by a vulnerable client, operate a malicious IMAP server, compromise a legitimate IMAP server, or position the client to connect over an insecure path to a hostile service. After the client establishes an IMAP session, the malicious server sends a syntactically valid IMAP response containing a literal byte count with an extremely large value. The vulnerable response reader trusts the declared length and allocates memory for that amount in the receiver thread. This can rapidly exhaust process or system memory, causing the application to hang, crash, be terminated by the OOM killer, or trigger broader service instability. No authentication bypass or code execution is implied by the vulnerability itself; the primary impact is availability loss.
How to fix it
Upgrade affected packages to fixed vendor versions. For Red Hat Enterprise Linux 9.0 EUS AppStream packages listed in the advisory, update qemu-guest-agent, qemu-img, qemu-kvm, qemu-kvm-common, qemu-kvm-core, qemu-kvm device packages, block drivers, debuginfo/debugsource packages, and related subpackages to 17:6.2.0-11.el9_0.8 or later. Where the vulnerable IMAP client library is used directly by applications, update the affected net-imap dependency to a vendor-fixed release. As compensating controls, restrict IMAP destinations to trusted servers, disallow user-supplied IMAP hostnames unless strictly validated, require TLS with certificate validation, block plaintext IMAP to untrusted networks, set process/container memory limits, configure supervisor restart backoff, and monitor for repeated OOM events. These mitigations reduce exploitability but should not replace patching.
How to confirm the fix worked
Confirm package remediation by querying installed package versions and verifying that affected Red Hat packages are at 17:6.2.0-11.el9_0.8 or later. On RPM-based systems, use package inventory tools such as rpm -q, dnf repoquery, vendor vulnerability scanners, or configuration management reporting to validate installed versions. For applications using IMAP libraries directly, inspect dependency manifests and lockfiles, then confirm the resolved runtime dependency is a fixed version. Validate exposure reduction by reviewing application configuration to ensure IMAP connections are limited to trusted hosts, TLS certificate verification is enabled, and user-controlled hostnames cannot be used to initiate arbitrary IMAP connections. Operationally, test that mail-processing jobs continue to function after upgrade and that memory limits or restart policies behave as expected under failure conditions.
Typical attack path
- Identify an application, job, or service that uses the vulnerable IMAP client behavior and can be made to connect to an attacker-controlled, untrusted, insecure, or compromised IMAP server.
- Cause or wait for the target software to initiate an IMAP connection to the hostile server.
- Return an IMAP response containing an excessively large literal byte count.
- Trigger immediate memory allocation by the vulnerable response reader thread.
- Cause process memory exhaustion, application crash, operating-system OOM termination, or service degradation.
- Repeat the interaction to sustain denial of service if the application automatically retries or restarts.
How to detect it
To determine whether this was already exploited, review host, application, and mail-client logs for memory exhaustion or crashes that occur immediately after IMAP connections. Useful log sources include system journals, kernel logs, OOM killer logs, application logs for mail ingestion or IMAP polling services, process supervisor logs, container runtime events, endpoint telemetry, and network metadata for outbound IMAP traffic on ports 143, 993, and nonstandard IMAP service ports. Look for repeated crashes of the same mail-processing process, abrupt termination with SIGKILL, kernel OOM messages, sudden resident memory growth after IMAP responses, retry loops to the same IMAP endpoint, and connections to newly introduced or user-supplied mail servers. Network packet captures, if available, may show IMAP server responses with unusually large literal size declarations in curly braces, such as very large numeric values in responses. There are no public threat actors or ransomware campaigns associated with this issue in the provided data, so detection should focus on behavioral artifacts rather than actor-specific infrastructure.
- Out of memory: Killed process
- Memory cgroup out of memory
- oom-kill
- invoked oom-killer
- Killed process
- SIGKILL
- net/imap
- Net::IMAP
- IMAP
- literal
- port 143
- port 993
- {2147483647}
- {4294967295}
- {9999999999}
- qemu-kvm
- qemu-img
- qemu-guest-agent
What your security team should do
- Prioritize patching internet-facing, multi-tenant, automation, or mail-ingestion systems that can connect to user-supplied or externally controlled IMAP servers.
- Upgrade the listed Red Hat Enterprise Linux 9.0 EUS AppStream packages to 17:6.2.0-11.el9_0.8 or later, and update any directly used vulnerable IMAP client dependency to a fixed release.
- Inventory applications that initiate IMAP connections and identify whether destination hostnames can be configured by users, partners, imported data, or external workflows.
- Enforce allowlists for IMAP server destinations and require TLS with certificate validation for all IMAP connections.
- Add memory limits, restart backoff, and alerting for services that perform IMAP polling or mailbox ingestion.
- Hunt for historical process crashes, OOM killer events, and repeated IMAP connection failures involving mail-processing processes.
- Because this is not KEV-listed, not tied to ransomware, and has low EPSS, handle through normal vulnerability management unless the organization relies on untrusted or user-configurable IMAP connectivity.
The record
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).
Affected packages
| Ecosystem | Package | Introduced | Fixed |
|---|---|---|---|
| RubyGems | net-imap | 0 | 0.2.5 |
| RubyGems | net-imap | 0.3.0 | 0.3.9 |
| RubyGems | net-imap | 0.4.0 | 0.4.20 |
| RubyGems | net-imap | 0.5.0 | 0.5.7 |
| Chainguard | gitlab-rails-ce-18.1 | 0 | 18.1.6-r3 |
| Chainguard | gitlab-rails-ce-18.2 | 0 | 18.2.8-r3 |
| Chainguard | gitlab-rails-ce-assets-18.1 | 0 | 18.1.6-r1 |
| Chainguard | gitlab-rails-ce-assets-18.2 | 0 | 18.2.8-r1 |
| Chainguard | gitlab-rails-ce-assets-fips-18.1 | 0 | 18.1.6-r2 |
| Chainguard | gitlab-rails-ce-assets-fips-18.2 | 0 | 18.2.8-r2 |
| Chainguard | gitlab-rails-ce-doc-18.1 | 0 | 18.1.6-r1 |
| Chainguard | gitlab-rails-ce-doc-18.2 | 0 | 18.2.8-r1 |
| Chainguard | gitlab-rails-ce-doc-fips-18.1 | 0 | 18.1.6-r2 |
| Chainguard | gitlab-rails-ce-doc-fips-18.2 | 0 | 18.2.8-r2 |
| Chainguard | gitlab-rails-ce-fips-18.1 | 0 | 18.1.6-r4 |
| Chainguard | gitlab-rails-ce-fips-18.2 | 0 | 18.2.8-r4 |
| Chainguard | graalvm-23 | 0 | 23.0.2-r7 |
| Chainguard | graalvm-23-ce | 0 | 23.0.2-r7 |
| Chainguard | graalvm-23-ce-dbg | 0 | 23.0.2-r7 |
| Chainguard | graalvm-23-ce-default-jdk | 0 | 23.0.2-r7 |
| Chainguard | graalvm-23-ce-jmods | 0 | 23.0.2-r7 |
| Chainguard | graalvm-23-ce-nodejs | 0 | 23.0.2-r7 |
| Chainguard | graalvm-23-ce-nodejs-dbg | 0 | 23.0.2-r7 |
| Chainguard | graalvm-23-ce-nodejs-default-jdk | 0 | 23.0.2-r7 |
| Chainguard | graalvm-23-ce-nodejs-jmods | 0 | 23.0.2-r7 |
| Chainguard | graalvm-23-graalpy | 0 | 23.0.2-r7 |
| Chainguard | graalvm-23-graalpy-venv | 0 | 23.0.2-r7 |
| Chainguard | graalvm-24 | 0 | 24.0.2-r6 |
| Chainguard | graalvm-24-ce | 0 | 24.0.2-r6 |
| Chainguard | graalvm-24-ce-dbg | 0 | 24.0.2-r6 |
| Chainguard | graalvm-24-ce-default-jdk | 0 | 24.0.2-r6 |
| Chainguard | graalvm-24-ce-jmods | 0 | 24.0.2-r6 |
| Chainguard | graalvm-24-ce-nodejs | 0 | 24.0.2-r6 |
| Chainguard | graalvm-24-ce-nodejs-dbg | 0 | 24.0.2-r6 |
| Chainguard | graalvm-24-ce-nodejs-default-jdk | 0 | 24.0.2-r6 |
| Chainguard | graalvm-24-ce-nodejs-jmods | 0 | 24.0.2-r6 |
| Chainguard | graalvm-24-graalpy | 0 | 24.0.2-r6 |
| Chainguard | graalvm-24-graalpy-venv | 0 | 24.0.2-r6 |
| Chainguard | graalvm-25 | 0 | 25.0.1-r0 |
| Chainguard | graalvm-25-ce | 0 | 25.0.1-r0 |
| Chainguard | graalvm-25-ce-dbg | 0 | 25.0.1-r0 |
| Chainguard | graalvm-25-ce-default-jdk | 0 | 25.0.1-r0 |
| Chainguard | graalvm-25-ce-jmods | 0 | 25.0.1-r0 |
| Chainguard | graalvm-25-ce-nodejs | 0 | 25.0.1-r0 |
| Chainguard | graalvm-25-ce-nodejs-dbg | 0 | 25.0.1-r0 |
| Chainguard | graalvm-25-ce-nodejs-default-jdk | 0 | 25.0.1-r0 |
| Chainguard | graalvm-25-ce-nodejs-jmods | 0 | 25.0.1-r0 |
| Chainguard | graalvm-25-graalpy | 0 | 25.0.1-r0 |
| Chainguard | graalvm-25-graalpy-venv | 0 | 25.0.1-r0 |
| Chainguard | jruby-9.4 | 0 | 9.4.13.0-r0 |
| Chainguard | jruby-9.4-default-ruby | 0 | 9.4.13.0-r0 |
| Chainguard | kube-fluentd-operator | 0 | 1.18.2-r36 |
| Chainguard | kube-fluentd-operator-compat | 0 | 1.18.2-r36 |
| Chainguard | kube-fluentd-operator-default-config | 0 | 1.18.2-r36 |
| Chainguard | kube-fluentd-operator-oci-entrypoint | 0 | 1.18.2-r36 |
| Debian:12 | ruby3.1 | 0 | No fix |
| Debian:13 | ruby3.3 | 0 | No fix |
| Wolfi | jruby-9.4 | 0 | 9.4.13.0-r0 |
| Wolfi | jruby-9.4-default-ruby | 0 | 9.4.13.0-r0 |
| Wolfi | kube-fluentd-operator | 0 | 1.18.2-r36 |
| Wolfi | kube-fluentd-operator-compat | 0 | 1.18.2-r36 |
| Wolfi | kube-fluentd-operator-default-config | 0 | 1.18.2-r36 |
| Wolfi | kube-fluentd-operator-oci-entrypoint | 0 | 1.18.2-r36 |
| gem | net-imap | 0.3.0 | 0.3.9 |
| gem | net-imap | 0.4.0 | 0.4.20 |
| gem | net-imap | 0.5.0 | 0.5.7 |
Related vulnerabilities
- CVE-2025-25186 Net::IMAP implements Internet Message Access Protocol (IMAP) client functionality in Ruby. Also affects net-imap
- CVE-2026-1182 GitLab has remediated an issue in GitLab CE/EE affecting all versions from 8.14 before… Also affects gitlab-rails-ce-18.1
- CVE-2026-0595 GitLab has remediated an issue in GitLab CE/EE affecting all versions from 13.9 before… Also affects gitlab-rails-ce-18.1
- CVE-2025-3950 Exposure of Private Personal Information to an Unauthorized Actor in GitLab Also affects gitlab-rails-ce-18.1
- CVE-2025-10569 Allocation of Resources Without Limits or Throttling in GitLab Also affects gitlab-rails-ce-18.1
- CVE-2025-11246 Insufficient Granularity of Access Control in GitLab Also affects gitlab-rails-ce-18.1
- CVE-2025-61594 URI is a module providing classes to handle Uniform Resource Identifiers. Also affects gitlab-rails-ce-18.1
- CVE-2025-68696 httparty is an API tool. Also affects gitlab-rails-ce-18.1