CVE-2026-47240
NoneCVSS
—
EPSS
0.8%
Published
Jun 22, 2026
CISA due date
—
Cloudanix analysis
Some Ruby email applications could be tricked into sending unintended mailbox commands, which may let an attacker alter or delete email if vulnerable versions are used.
- Exploitation
- Requires User Interaction
- Attacker needs
- User Interaction
- Complexity
- Moderate
- Impact
- Data Tampering
- Component
- Library
- Class
- Command Injection
- Remediation
- Upgrade
- Effort
- Medium
- Patch risk
- Low
What it actually does
This is an IMAP command injection issue in the Ruby Net::IMAP client library. Certain methods accept raw IMAP data arguments and, in vulnerable versions, can send non-synchronizing literals in a way that is unsafe when the IMAP server does not support that capability. A crafted argument containing CRLF-delimited IMAP syntax can cause the server to treat the remainder of the literal as additional pipelined IMAP commands. Successful exploitation allows an attacker-influenced input value to issue unintended IMAP commands using the client’s authenticated mail session, potentially modifying mailbox contents, deleting messages, copying messages, changing flags, or disrupting mailbox access. The issue affects search, sort, thread, UID variants, and fetch-related arguments before Net::IMAP 0.6.5 and 0.5.15.
Why it matters to the business
Applications that use vulnerable Net::IMAP versions and pass attacker-controlled or insufficiently trusted values into affected IMAP operations could allow unauthorized mailbox actions. The most likely business consequences are email tampering, message deletion, unintended disclosure through server-side copy or fetch behavior, workflow disruption for mail-driven applications, and incident response effort around mailbox integrity. This is not listed in CISA KEV, has no reported ransomware association, and has a low EPSS score, but it should still be remediated because mailboxes often contain sensitive business data and the vulnerable pattern may exist in automation, helpdesk, ticketing, monitoring, or ingestion systems.
How an attack unfolds
An attacker first needs a path to influence data passed into vulnerable Net::IMAP methods such as search, uid_search, sort, thread, uid_sort, uid_thread, fetch, or uid_fetch. The vulnerable client sends this data as an IMAP literal. If the connected IMAP server does not support non-synchronizing literals, it may reject the malformed command line and then parse the literal body as subsequent IMAP commands. The attacker crafts input so that after the server returns a tagged BAD response, injected commands are interpreted in sequence under the already-authenticated client session. Depending on mailbox permissions and the injected commands, the attacker may mark messages as read, add deletion flags, expunge mail, copy messages to other folders, perform unauthorized searches, or interfere with application mail processing. There is currently no public exploit maturity reported and no known named threat actor activity tied to this vulnerability.
How to fix it
Upgrade the Ruby Net::IMAP package to a fixed version: 0.6.5 or later for the 0.6.x line, or 0.5.15 or later for the 0.5.x line. If Net::IMAP is bundled or pinned through a Ruby application dependency chain, update the lockfile and redeploy the application so the fixed gem is actually loaded at runtime. Review application code for use of search, uid_search, sort, thread, uid_sort, uid_thread, fetch, and uid_fetch where user-controlled input may be passed into criteria, search_keys, or attr arguments. As defense in depth, strictly validate or construct IMAP arguments from allowlisted tokens rather than concatenating raw user input, avoid connecting to untrusted IMAP servers, and restrict mailbox account permissions where possible. If immediate upgrade is not possible, block attacker-controlled values from reaching the affected arguments and disable features that accept arbitrary IMAP search, sort, thread, or fetch expressions.
How to confirm the fix worked
Confirm the deployed Net::IMAP version is 0.6.5 or later, or 0.5.15 or later, using dependency manifests, lockfiles, package inventory, and runtime checks such as `bundle exec ruby -r net/imap -e 'puts Net::IMAP::VERSION'` where applicable. Verify that application containers, build artifacts, and production runtimes do not retain older vendored gem copies. Review code paths to ensure affected methods do not receive raw untrusted input. Where safe testing is possible, use a controlled IMAP test server without non-synchronizing literal support and confirm that crafted CRLF-containing values are rejected or safely encoded rather than producing additional server-side IMAP commands. Monitor mail server logs after remediation to verify that unexpected BAD responses followed by state-changing IMAP commands no longer occur from application accounts.
Typical attack path
- Identify an application or automation that uses Ruby Net::IMAP before 0.6.5 or 0.5.15.
- Find an input path that is passed into affected Net::IMAP command arguments, such as search criteria, sort or thread keys, or fetch attributes.
- Ensure or target an IMAP server behavior where non-synchronizing literals are unsupported or mishandled.
- Submit a crafted value containing IMAP literal-breaking syntax and CRLF-delimited commands.
- The vulnerable client sends the crafted value to the IMAP server during an authenticated IMAP operation.
- The server rejects the malformed literal command and then interprets the injected content as additional pipelined IMAP commands.
- Injected commands execute with the privileges of the authenticated IMAP session, affecting mailbox state or availability.
How to detect it
Look for evidence that an application account issued malformed IMAP commands followed immediately by unexpected valid IMAP commands in the same authenticated session. Useful sources include IMAP server logs, mailbox audit logs, application logs around Net::IMAP operations, reverse proxy or mail gateway logs if IMAP is proxied, endpoint telemetry from application hosts, and dependency inventories showing vulnerable gem versions. Focus on sessions from application service accounts where a tagged BAD response, malformed literal, or parse error is followed by state-changing commands such as STORE, UID STORE, COPY, UID COPY, EXPUNGE, CLOSE, MOVE, UID MOVE, or unexpected FETCH/UID FETCH activity. Investigate any request or application parameter containing CRLF sequences, IMAP literals ending in `+}`, or embedded IMAP commands. Because exploitation occurs over a normal authenticated IMAP session, network indicators may be subtle; session sequencing and mailbox audit anomalies are more reliable than IP-based detection. There are no known public threat actor campaigns for this issue as of the provided context.
- +}\r\n
- }\r\n
- BAD
- tagged BAD
- non-synchronizing literal
- malformed command line
- STORE +FLAGS \\Deleted
- UID STORE
- EXPUNGE
- UID EXPUNGE
- COPY
- UID COPY
- MOVE
- UID MOVE
- CLOSE
- UID FETCH
- Net::IMAP::BadResponseError
- Net::IMAP::ResponseParseError
What your security team should do
- Inventory Ruby applications and services that use Net::IMAP, including transitive or vendored gem usage.
- Prioritize upgrades to Net::IMAP 0.6.5 or later, or 0.5.15 or later, especially for internet-facing, multi-tenant, or mail-processing applications that accept user-supplied search or fetch parameters.
- Search source code for affected method calls: search, uid_search, sort, thread, uid_sort, uid_thread, fetch, and uid_fetch.
- Add input validation or allowlists for IMAP criteria, search keys, thread keys, sort keys, and fetch attributes instead of passing raw request parameters to Net::IMAP.
- Review IMAP server audit logs for application mailbox accounts for malformed commands, tagged BAD responses, unexpected EXPUNGE operations, deletion flag changes, mailbox copies, or unusual UID FETCH activity.
- Use least-privilege mailbox accounts for automation and avoid granting broad mailbox access where read-only access is sufficient.
- Add regression tests that exercise CRLF and IMAP metacharacter handling for all user-controlled mail query features.
The record
Net::IMAP implements Internet Message Access Protocol (IMAP) client functionality in Ruby. Prior to 0.6.5 and 0.5.15, 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. A server without support for non-synchronizing literals may 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 criteria for #search and #uid_search; search_keys for #sort, #thread, #uid_sort, and #uid_thread; and attr for #fetch and #uid_fetch. This vulnerability is fixed in 0.6.5 and 0.5.15.
Affected packages
| Ecosystem | Package | Introduced | Fixed |
|---|
Related vulnerabilities
- CVE-2026-114575 A flaw has been found in TOTOLINK A950RG 4.1.2cu.5268_B20221104. CWE-77
- CVE-2026-112942 launch-editor allows users to open files with line numbers in editor from Node.js. CWE-77
- CVE-2026-55453 OpenPrinting CUPS is an open source printing system for Linux and other Unix-like… CWE-77
- CVE-2026-102827 simple-git, an interface for running git commands in any node.js application, enables… CWE-77
- CVE-2026-102826 simple-git, an interface for running git commands in any node.js application, enables… CWE-77
- CVE-2026-79945 Dell SCG 5.0 Appliance versions prior to 5.36.00.16 and Dell SCG 5.0 Application versions… CWE-77
- CVE-2026-79741 Dell SCG 5.0 Appliance versions prior to 5.36.00.16 and Dell SCG 5.0 Application versions… CWE-77
- CVE-2026-78493 Dell SCG 5.0 Appliance versions prior to 5.36.00.16 and Dell SCG 5.0 Application versions… CWE-77