CVE-2026-42257 net-imap: Command Injection via "raw" arguments to multiple commands

Medium 5.8 Published Updated

Attackers can inject arbitrary IMAP commands via raw string arguments in the Ruby net-imap library if input is user-controlled.

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-42257?

CVE-2026-42257 is a medium-severity command injection vulnerability in ruby net-imap, published on 9 May 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 versions 0.4.24, 0.5.14, and 0.6.4, several Net::IMAP commands accept a raw string argument that is sent to the server without validation or escaping. If this string is derived from user-controlled input, it may contain contain CRLF sequences, which an attacker can use to inject arbitrary IMAP commands. This issue has been patched in versions 0.4.24, 0.5.14, and 0.6.4.

Weakness: CWE-93, CWE-77

Which versions are affected by CVE-2026-42257?

6 open source packages ship an affected version, including net-imap. It affects 1 product.

PackageAffectedFixed in
net-imap RubyGemsAll versions0.4.24
net-imap RubyGemsAll versions0.4.24
net-imap RubyGemsFrom 0.5.00.5.14
net-imap RubyGemsFrom 0.5.00.5.14
net-imap RubyGemsFrom 0.6.00.6.4
net-imap RubyGemsFrom 0.6.00.6.4

Products include Ruby-Lang Net\.

How do I fix CVE-2026-42257?

Upgrade net-imap to a fixed version for your release line: 0.4.24, 0.5.14 or 0.6.4.

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

Is CVE-2026-42257 being exploited?

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

Sources

Also known as ALPINE-CVE-2026-42257, BELL-CVE-2026-42257, CLEANSTART-2026-NN77724, CLEANSTART-2026-SU72949, CLSA-2026-1791456473, DEBIAN-CVE-2026-42257 and 22 more.

Is CVE-2026-42257 in your software?

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

Check your SBOMs for free