Executive brief
Net::IMAP is a Ruby library used by applications to communicate with email servers. A security flaw allows an attacker to inject unauthorized commands into the email session if the application uses untrusted data for certain settings. This could allow an attacker to perform unauthorized actions on a mailbox, such as deleting messages, though it is only exploitable if the application is specifically designed to pass user-controlled input into these internal functions.
Technical details
A command injection vulnerability exists in the Ruby Net::IMAP library due to improper neutralization of CRLF sequences in the #id and #enable methods. When #id is called with a hash argument, the library fails to validate field values against newline characters, even though it correctly escapes other special characters. Similarly, the #enable method does not validate its arguments as valid IMAP atoms, sending the string representation verbatim to the server. An attacker who can influence these arguments can inject a CRLF sequence followed by arbitrary IMAP commands (e.g., DELETE). Exploitation typically requires the application to pass untrusted user input into these specific client configuration methods. The issue is resolved in versions 0.6.4.1 and 0.5.15.
Affected products
- Ruby net-imap >= 0.6.0, < 0.6.4.1; < 0.5.15
Timeline
- 2026-06-09: advisory: GitHub Security Advisory published
- 2026-06-22: disclosed: CVE published to NVD