Skip to main content

Net::IMAP CVE-2026-42258

MEDIUM
Command Injection (CWE-77)
2026-05-04 https://github.com/ruby/net-imap GHSA-75xq-5h9v-w6px
5.8
CVSS 4.0 · Vendor: https://github.com/ruby/net-imap
Share

Severity by source

Vendor (https://github.com/ruby/net-imap) PRIMARY
5.8 MEDIUM
CVSS:4.0/AV:L/AC:H/AT:P/PR:N/UI:P/VC:N/VI:H/VA:L/SC:N/SI:N/SA:N/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X
SUSE
5.3 HIGH
AV:L/AC:H/PR:N/UI:R/S:U/C:N/I:H/A:L
Red Hat
7.1 HIGH
qualitative

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

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

CVSS:4.0/AV:L/AC:H/AT:P/PR:N/UI:P/VC:N/VI:H/VA:L/SC:N/SI:N/SA:N/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X
Attack Vector
Local
Attack Complexity
High
Privileges Required
None
User Interaction
P
Scope
X

Lifecycle Timeline

3
CVSS changed
May 09, 2026 - 20:22 NVD
5.8 (MEDIUM)
Source Code Evidence Fetched
May 04, 2026 - 22:31 vuln.today
Analysis Generated
May 04, 2026 - 22:31 vuln.today

DescriptionCVE.org

Summary

Symbol arguments to commands are vulnerable to a CRLF Injection / IMAP Command injection via Symbol arguments passed to IMAP commands.

Details

Symbol arguments represent IMAP "system flags", which are formatted as "atoms" (with no quoting) with a "\" prefix. Vulnerable versions of Net::IMAP sends the symbol name directly to the socket, with no validation.

Because the Symbol input is unvalidated, it could contain invalid flag characters, including SP and CRLF, which could be used to finish the current command and inject new commands.

Although IMAP flag arguments are only valid input for a few IMAP commands, most Net::IMAP commands use generic argument handling, and will allow Symbol (flag) inputs.

Note also that the list of valid symbol inputs should be restricted to an enumerated set of standard RFC defined flag types, which have each been given specific defined semantics. Any user-provided values outside of that list of standard "system flags" needs to use the IMAP keyword syntax, which are sent as atoms, i.e: string inputs. Under no circumstances should #to_sym ever be called on unvetted user-provided input: that will always be a bug in the calling code for the simple reason that user_input_atom is as \user_input_atom.

For forward compatibility with future IMAP extentions, Net::IMAP, does not restrict flag inputs to an enumerated list. That is the responsibility of the calling application code, which knows which flag semantics are valid for its context.

Impact

If a developer passes user-controlled input as a Symbol to most Net::IMAP commands, an attacker can append CRLF sequence followed by a new IMAP command (like DELETE mailbox).

Mitigation

  • Upgrade to a version of Net::IMAP that validates Symbols are valid as an IMAP flag.
  • User-provided input should never be able to control calling #to_sym on string arguments.

For example, do not unsafely serialize and deserialize command arguments (e.g. with YAML or Marshal) in a way that could create unvetted Symbol arguments.

  • For the few IMAP commands which do allow flag arguments, it may be appropriate to hard-code Symbol arguments or restrict them to an enumerated list which is valid for the calling application.

AnalysisAI

Net::IMAP command injection via unvalidated Symbol arguments allows remote attackers to inject arbitrary IMAP commands by passing user-controlled input as Symbol flags, enabling attackers to append CRLF sequences followed by malicious commands like DELETE mailbox. The vulnerability affects Net::IMAP versions 0.4.23 and earlier, 0.5.0-0.5.13, and 0.6.0-0.6.3, and is remedied in versions 0.4.24, 0.5.14, and 0.6.4 respectively. No public exploit code or active exploitation has been reported at the time of analysis.

Technical ContextAI

Net::IMAP is Ruby's standard IMAP (Internet Message Access Protocol) client library. IMAP protocol uses atom-formatted system flags prefixed with a backslash (e.g., \Seen, \Flagged). The vulnerability stems from CWE-77 (Improper Neutralization of Special Elements used in a Command) - specifically, CRLF Injection. When developers pass user-controlled input converted to a Symbol (Ruby's immutable identifier type) to IMAP commands that accept flag arguments, Net::IMAP sends the symbol name directly to the socket without validating that it contains only valid IMAP flag characters. Since symbols bypass quoting in the IMAP protocol, an attacker can inject space (SP) and carriage-return/line-feed (CRLF) characters to terminate the current command and inject new IMAP commands. The root cause is the lack of input validation for symbol-formatted flags before transmission and the library's intentional decision not to restrict flag inputs to RFC-defined standard system flags (\Seen, \Answered, \Flagged, \Deleted, \Draft, \Recent, \Junk, \Important, etc.), delegating that responsibility to calling code.

RemediationAI

Vendor-released patches are available: upgrade to Net::IMAP 0.4.24 (for legacy 0.4.x users), 0.5.14 (for 0.5.x users), or 0.6.4 (for 0.6.x and later users). Apply patches via Bundler with bundle update net-imap or manually install via gem install net-imap -v 0.6.4. For applications already using affected versions, do not pass user-supplied input to #to_sym or directly as Symbol arguments to IMAP commands; instead, restrict flag inputs to an enumerated list of standard RFC-defined system flags (\Seen, \Answered, \Flagged, \Deleted, \Draft, \Recent, and extensions like \Junk, \Important if supported by your server). Avoid unsafe serialization/deserialization (YAML.load, Marshal.load) of IMAP command arguments, as this can silently convert strings to symbols. For IMAP commands that do accept flag arguments (STORE, SELECT, etc.), hard-code symbol literals in source code rather than allowing dynamic flag specification from user input. Trade-off: restricting flags to an enumerated list may limit compatibility with server-specific or future IMAP extensions, but this is the correct defense-in-depth approach for security.

Vendor StatusVendor

SUSE

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

Share

CVE-2026-42258 vulnerability details – vuln.today

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