Skip to main content

Ruby net-imap EUVDEUVD-2026-38352

| CVE-2026-47240 MEDIUM
Command Injection (CWE-77)
2026-06-09 https://github.com/ruby/net-imap GHSA-8p34-64r3-mwg8
5.8
CVSS 4.0 · Vendor: https://github.com/ruby/net-imap
View

Attack ChainAIDerived

Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain

  1. Recon
    Attacker crafts CRLF-injected IMAP payload
  2. Delivery
    Attacker supplies payload as user input to net-imap application
  3. Exploit
    Application passes unsanitized input as raw data argument
  4. Install
    net-imap sends non-synchronizing literal without checking server capability
  5. C2
    Server lacking LITERAL+/LITERAL-/IMAP4rev2 returns tagged BAD on malformed literal
  6. Execute
    Server interprets literal contents as new pipelined IMAP command
  7. Impact
    Injected command (e.g., DELETE mailbox) executes in authenticated session context

Vulnerability Assessment

Weakness
CWE
OWASP Top 10:2025
A05:2025 - Injection
ASVS 5.0
V1 - Encoding and Sanitization Command injection prevention
MITRE ATT&CK

1 technique across 1 tactic: Execution

The technique list with ATT&CK links and the kill-chain view is part of the Basic plan and up.

Exploitation Conditions

Exploitation requires two independent conditions to hold simultaneously. First, the application must pass unvalidated, user-controlled string data as a raw data argument to one of the affected Net::IMAP methods: the criteria argument of #search or #uid_search, the search_keys argument of #sort, #thread, #uid_sort, or #uid_thread, or the attr argument of #fetch or #uid_fetch - developer misuse of the raw data API is a prerequisite, and well-written applications that sanitize inputs are not vulnerable. Second, the IMAP server the library connects to must NOT advertise LITERAL+, LITERAL-, or IMAP4rev2 capabilities, and must respond to a malformed non-synchronizing literal by returning a tagged BAD response rather than closing the TCP connection outright; cautious servers that close the connection block the injection path entirely. Exploitation is further limited by the fact that the net-imap client must already be authenticated to the IMAP server - CVSS vector is not available to confirm authentication requirements, but the attack operates within the authenticated session's mailbox permissions. Authentication requirements are not confirmed from available CVSS data.

Impact

No CVSS score or vector has been published for this CVE at time of analysis, making quantitative risk comparison impossible. The upstream advisory classifies severity as moderate. Real-world exploitability is gated by two independent conditions that must both be true: the application must pass unsanitized user-controlled input to an affected raw data argument, and the IMAP server must lack LITERAL+, LITERAL-, or IMAP4rev2 support AND must respond to malformed non-synchronizing literals by returning BAD (rather than closing the connection). The advisory explicitly notes that most modern IMAP servers support LITERAL-, substantially limiting the exposed population. The impact, while not enabling direct data exfiltration, allows injection of arbitrary IMAP commands (e.g., DELETE, RENAME mailboxes) within the permissions of the authenticated session. KEV status is absent and no public POC has been identified, suggesting this is not being actively exploited at scale. The risk is real for legacy or non-standard IMAP server deployments where developers pass unvalidated user input to affected methods.

Exploit ScenarioDerived

An attacker with access to a web application that accepts user-defined IMAP search filters (e.g., a webmail search interface) crafts a criteria string containing a CRLF sequence followed by a complete IMAP command, such as \r\nA001 DELETE INBOX\r\n. When the application passes this input unvalidated to net-imap's #search method as a raw data argument and the IMAP server does not support non-synchronizing literals, the server responds with tagged BAD to the malformed literal marker and then processes the injected DELETE INBOX as a new pipelined command, deleting the mailbox. No public POC has been identified at time of analysis, but the attack is conceptually straightforward for an attacker familiar with IMAP protocol pipelining mechanics.

This Month Plan within 30 days. Why: MEDIUM severity (CVSS 4.0-6.9).
Patch available 0.2% exploitation probability (EPSS)

Get an e-mail when this CVE is exploited, patched or re-scored. Free account.

Alert me

AnalysisAIv1 – Jun 09, 2026

CRLF command injection in Ruby's net-imap gem (CVE-2026-47240) enables attackers to inject arbitrary IMAP commands when applications pass unvalidated user-controlled input to raw data arguments of search, fetch, sort, and thread methods. Affected versions (>= 0.6.0 through 0.6.4, and <= 0.5.14) fail to verify that the connected IMAP server supports non-synchronizing literals before sending them, meaning servers without LITERAL+, LITERAL-, or IMAP4rev2 capability may interpret the malformed literal boundary as a pipelined command rather than closing the connection - allowing injected payloads such as DELETE mailbox to execute. No public exploit has been identified at time of analysis and no CISA KEV listing exists, but the advisory is rated moderate severity by the upstream maintainers and patches are available.

RemediationAI

Upgrade net-imap to v0.6.4.1 (for the 0.6.x branch) or v0.5.15 (for the 0.5.x branch). These patched versions add server capability verification - checking for LITERAL+, LITERAL-, or IMAP4rev2 in the server's advertised capabilities - before sending non-synchronizing literals in raw data arguments. Release details are at https://github.com/ruby/net-imap/releases/tag/v0.6.4.1 and advisory at https://github.com/ruby/net-imap/security/advisories/GHSA-8p34-64r3-mwg8. If upgrading is not immediately possible, three compensating controls are available with different trade-offs: (1) Validate all user-controlled inputs before passing to affected methods (#search, #uid_search, #sort, #thread, #uid_sort, #uid_thread, #fetch, #uid_fetch), stripping or rejecting strings containing CR (\r) or LF (\n) bytes - targeted but requires correct developer implementation at every call site. (2) Unconditionally prohibit all embedded literals by rejecting any input containing \r or \n; this is simpler and more conservative but may block legitimate complex search criteria using IMAP literal syntax. (3) Verify that the IMAP server advertises LITERAL+, LITERAL-, or IMAP4rev2 capabilities before accepting untrusted string inputs for these arguments - effective, but requires capability-inspection logic to be added to the application layer.

Affected VersionsENISA

net-imap 0.6.0, < 0.6.4.1
net-imap < 0.5.15

Affected Packages

rubygems net-imap fix: 0.5.15, 0.6.4.1

Source: OSV (Open Source Vulnerabilities)

Affects your stack

Affects 1 package in rubygems

Checking this CVE against your own stacks and servers is part of the Basic plan and up.

Technical ContextAI · show details

The vulnerability resides in the Ruby standard library gem net-imap (pkg:rubygems/net-imap). The IMAP protocol distinguishes between synchronizing literals (which pause and await a server continuation before data is sent) and non-synchronizing literals (sent immediately, denoted by the {n+}\r\n syntax), the latter being valid only when the server advertises LITERAL+, LITERAL-, or IMAP4rev2 capabilities. Raw data arguments in net-imap are intended for expert use - they are sent verbatim after a validation pass - but that validation does not check whether the target server supports non-synchronizing literals. When a server without this support receives the {n+}\r\n sequence, it may treat the literal marker as an unknown malformed command terminator (responding with tagged BAD), causing the literal's contents to be interpreted as one or more new pipelined IMAP commands. This is a classic CRLF injection (CWE-77: Improper Neutralization of Special Elements used in a Command). The affected method arguments are: criteria for #search and #uid_search, search_keys for #sort, #thread, #uid_sort, and #uid_thread, and attr for #fetch and #uid_fetch. Prior to v0.6.4/v0.5.14/v0.4.24, these arguments were not validated at all (see related CVE-2026-42257, GHSA-hm49-wcqc-g2xg).

Know when the next one hits your stack

  • Watch products and get an email when something new is published
  • Check this CVE against your own stack and servers
  • Exploit and PoC references, threat intelligence from 22 sources

No credit card · 7-day full trial

Severity by source

Vendor (https://github.com/ruby/net-imap) PRIMARY 5.8 MEDIUM
CVSS:4.0/AV:L/AC:L/AT:P/PR:N/UI:P/VC:N/VI:H/VA:L/SC:N/SI:N/SA:N
SUSE 6.5 MEDIUM
AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:H/A:L
Red Hat 6.1 MEDIUM

Primary rating from Vendor (https://github.com/ruby/net-imap).

CVSS VectorVendor: https://github.com/ruby/net-imap

Attack Vector
Local
Attack Complexity
Low
Attack Requirements
Present
Privileges Required
None
User Interaction
Passive
Vulnerable system: Confidentiality
None
Vulnerable system: Integrity
High
Vulnerable system: Availability
Low
Subsequent system: Confidentiality
None
Subsequent system: Integrity
None
Subsequent system: Availability
None

Lifecycle Timeline

1
CVSS changed
Jun 22, 2026 - 21:39 NVD
5.8 (MEDIUM)

DescriptionCVE.org

Several Net::IMAP commands accept a "raw data" argument that is sent verbatim after validation to prevent command injection. However, if a server does not support non-synchronizing literals, it may still be possible to inject arbitrary IMAP commands inside non-synchronizing literals.

Details

Raw data arguments support embedded literal values, both synchronizing and non-synchronizing. Non-synchronizing literals can only be safely sent when the server advertises any of the LITERAL+, LITERAL-, or IMAP4rev2 capabilities. But raw data arguments do not verify server support for non-synchronizing literals prior to sending.

Servers without support for non-synchronizing literals could handle them in several different ways: If a server sees a "}\r\n" byte sequence but can't parse the literal bytesize, it _may_ cautiously decide to close the connection, blocking any command injection attacks. However, a server without support for non-synchronizing literals may instead interpret the "+}\r\n" as the end of a malformed command line and respond with a tagged BAD. In that case, the contents of the literal will be interpreted as one or more new pipelined commands, allowing a CRLF command injection attack to succeed.

This affects the following commands' string arguments:

  • criteria for #search and #uid_search
  • search_keys for #sort, #thread, #uid_sort, and #uid_thread
  • attr for #fetch and #uid_fetch

Prior to net-imap v0.6.4, v0.5.14, and v0.4.24, raw data arguments were not validated in _any_ way, so they were also vulnerable to this attack. See CVE-2026-42257 (GHSA-hm49-wcqc-g2xg).

Impact

Fortunately, LITERAL- is supported by most modern IMAP servers. Even without support for non-synchronizing literals, cautious servers may handle invalid literal bytesize by closing the connection . However, servers which handle a non-synchronizing literal just like any other malformed command will enable this vulnerability.

If a developer passes an unvalidated user-controlled input for one of these method arguments, an attacker can append CRLF sequence followed by a new IMAP command (like DELETE mailbox). Although this does not directly enable data exfiltration, it could be combined with other attack vectors or knowledge of the target system's attributes, e.g.: shared mail folders or the application's installed response handlers.

Mitigation

Update to a version of net-imap which validates server support for non-synchronizing literals before sending them.

If upgrading net-imap is not possible:

  • Explicitly validate user-controlled inputs to prevent embedded non-synchronizing literals unless the server supports them.
  • For a simpler, more cautious approach: all embedded literals can be unconditionally prohibited, by checking that string inputs do not contain any CR or LF bytes.
  • Verify that the server advertises any of the LITERAL+, LITERAL-, or IMAP4rev2 capabilities before using untrusted string inputs for the affected "raw data" arguments.

Threat Intelligence Overview

EPSS Score
0.2%
Top 59% exploitable
Threat Intel
1
1 sources
Data Quality
8 sources
Confidence: High
EUVD NVD CVE.org EPSS Vulnrichment GHSA MSRC Vendor GitHub VulDB

How this decision was reached

The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.

SignalValue
Severity MEDIUM
CISA KEV No
Public POC No
EPSS 0.2%
Patch available Yes
Active threat No
Deciding rule
MEDIUM severity (CVSS 4.0-6.9)
What every action level means
Emergency Immediate action required. Criteria: CRITICAL + in CISA KEV (actively exploited) without patch, OR CRITICAL + EPSS > 30% without patch, OR CRITICAL + active threat signals without patch.
Act Now Prioritize within 24-48h. Criteria: in KEV with patch available, OR CRITICAL + public POC, OR HIGH + EPSS > 10%, OR CRITICAL + active threat, OR any CRITICAL severity.
This Week Schedule remediation this week. Criteria: HIGH severity (CVSS 7.0-8.9). Patch within normal change window.
This Month Plan within 30 days. Criteria: MEDIUM severity (CVSS 4.0-6.9), lower exploitation probability. Include in regular patch cycle.
Monitor Track and reassess. Criteria: LOW severity (CVSS 0.1-3.9), minimal exploitation risk. No immediate action needed.

SSVC AssessmentENISA

SSVC Decision· derived
Defer
Exploitation
None
System Exposure· derived
Small
Automatable
No
Human Impact· derived
Medium
Technical Impact
Partial

Priority Score

29
Low Medium High Critical
KEV: 0
EPSS: 0
CVSS: +29
PoC: 0
Weaponized: 0
Threat intel: 0
Gov advisory: 0

Attack Technique

OS command injection occurs when an application passes unsanitized user input directly into system shell commands.

Vendor StatusVendor

SUSE

Severity: Moderate
Product Status
SUSE Linux Enterprise Desktop 15 SP7 Not-Affected
SUSE Linux Enterprise Desktop 15 SP7 Affected
SUSE Linux Enterprise High Availability Extension 15 SP7 Not-Affected
SUSE Linux Enterprise High Availability Extension 16.0 Affected
SUSE Linux Enterprise High Availability Extension 16.1 Affected

This site uses cookies essential for authentication and security. No tracking or analytics cookies are used. Privacy Policy