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

Medium 5.8 Published Updated

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

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

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, CWE-77

Which versions are affected by CVE-2026-47240?

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

PackageAffectedFixed in
net-imap RubyGemsAll versions0.5.15
net-imap RubyGemsAll versions0.5.15
net-imap RubyGemsFrom 0.6.00.6.4.1
net-imap RubyGemsFrom 0.6.00.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.

Upgrade, and pass arguments to programs as a list instead of through a shell. More about Command injection.

Is CVE-2026-47240 being exploited?

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

Sources

Also known as ALPINE-CVE-2026-47240, AZL-91281, BELL-CVE-2026-47240, CLEANSTART-2026-EX55189, CLEANSTART-2026-WB90286, DEBIAN-CVE-2026-47240 and 18 more.

Is CVE-2026-47240 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free