# CVE-2026-47240: Net::IMAP: Command Injection via non-synchronizing literal in "raw" argument

> Attackers can inject arbitrary IMAP commands via non-synchronizing literals in the Ruby Net::IMAP library, potentially leading to code execution.

- **Severity:** Medium 5.8 (`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`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Local or same network only
- **Victim action needed:** A user has to click or open something
- **Fix available:** Yes
- **Published:** 22 Jun 2026
- **Updated:** 23 Jun 2026
- **Also known as:** ALPINE-CVE-2026-47240, AZL-91281, BELL-CVE-2026-47240, CLEANSTART-2026-EX55189, CLEANSTART-2026-WB90286, DEBIAN-CVE-2026-47240, ECHO-aed2-d0ee-eb0a, GHSA-8p34-64r3-mwg8, MINI-2vxc-4x6h-cj2x, MINI-35g3-2376-mr42, MINI-3c7g-3qfv-qrx5, MINI-63m3-rcqm-224w, MINI-7f2c-6f6r-hxmx, MINI-g3g9-72pv-x22m, MINI-jcmf-hh2h-wr2j, MINI-mp8q-q7cp-8366, MINI-mx77-7rcx-8wmg, MINI-p933-3m9m-964v, MINI-r499-82q3-wrrx, MINI-rf2j-693r-j37r, MINI-v6h4-qgqh-5vv3, MINI-wg6r-8q3g-m86g, MINI-wj69-p77w-8mx6, UBUNTU-CVE-2026-47240

## What is CVE-2026-47240?

CVE-2026-47240 is a medium-severity command injection vulnerability in ruby net-imap, published on 22 Jun 2026. It can only be exploited from the same machine or local network, and only if a user opens a file or follows a link.

### Official description

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.

Weakness: CWE-93 (Improper Neutralization of CRLF Sequences), CWE-77 (Improper Neutralization of Special Elements used in a Command)

## Which versions are affected by CVE-2026-47240?

4 open source packages ship an affected version, including net-imap.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `net-imap` | RubyGems | All versions | 0.5.15 |
| `net-imap` | RubyGems | All versions | 0.5.15 |
| `net-imap` | RubyGems | From 0.6.0 | 0.6.4.1 |
| `net-imap` | RubyGems | From 0.6.0 | 0.6.4.1 |

## How do I fix CVE-2026-47240?

Upgrade net-imap to a fixed version for your release line: 0.5.15 or 0.6.4.1.

## Is CVE-2026-47240 being exploited?

There is no known exploitation of CVE-2026-47240 in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2026-47240 and fix it if it is affected.

What it is: CVE-2026-47240 is a medium-severity command injection vulnerability in ruby net-imap, published on 22 Jun 2026. It can only be exploited from the same machine or local network, and only if a user opens a file or follows a link.
Exploitation: There is no known exploitation of CVE-2026-47240 in the wild and no public exploit code.

Affected packages and fixed versions:
- net-imap (RubyGems): affected all versions; fixed in 0.5.15
- net-imap (RubyGems): affected all versions; fixed in 0.5.15
- net-imap (RubyGems): affected from 0.6.0; fixed in 0.6.4.1
- net-imap (RubyGems): affected from 0.6.0; fixed in 0.6.4.1

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2026-47240/ (Markdown: https://insights.sbomify.com/CVE-2026-47240/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2026-47240
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2026-47240
- OSV: https://osv.dev/vulnerability/CVE-2026-47240

---
From sbomify Insights: https://insights.sbomify.com/CVE-2026-47240/
Summaries are generated and may contain mistakes; the official description above is the record.
