CVE-2026-42258: net-imap: Command Injection via unvalidated Symbol inputs

Published May 4, 2026
·
Updated

Summary

Symbol arguments to commands are vulnerable to a CRLF Injection / IMAP Command injection via Symbol arguments passed to IMAP commands.

Details

Symbol arguments represent IMAP "system flags", which are formatted as "atoms" (with no quoting) with a "\" prefix. Vulnerable versions of Net::IMAP sends the symbol name directly to the socket, with no validation.

Because the Symbol input is unvalidated, it could contain invalid flag characters, including SP and CRLF, which could be used to finish the current command and inject new commands.

Although IMAP flag arguments are only valid input for a few IMAP commands, most Net::IMAP commands use generic argument handling, and will allow Symbol (flag) inputs.

Note also that the list of valid symbol inputs should be restricted to an enumerated set of standard RFC defined flag types, which have each been given specific defined semantics. Any user-provided values outside of that list of standard "system flags" needs to use the IMAP keyword syntax, which are sent as atoms, i.e: string inputs. Under no circumstances should #tosym ever be called on unvetted user-provided input: that will always be a bug in the calling code for the simple reason that userinputatom is as \userinputatom.

For forward compatibility with future IMAP extentions, Net::IMAP, does not restrict flag inputs to an enumerated list. That is the responsibility of the calling application code, which knows which flag semantics are valid for its context.

Impact

If a developer passes user-controlled input as a Symbol to most Net::IMAP commands, an attacker can append CRLF sequence followed by a new IMAP command (like DELETE mailbox).

Mitigation Upgrade to a version of Net::IMAP that validates Symbols are valid as an IMAP flag. User-provided input should never be able to control calling #tosym on string arguments.

For example, do not unsafely serialize and deserialize command arguments (e.g. with YAML or Marshal) in a way that could create unvetted Symbol arguments. For the few IMAP commands which do allow flag arguments, it may be appropriate to hard-code Symbol arguments or restrict them to an enumerated list which is valid for the calling application.

Other sources

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, symbol arguments to commands are vulnerable to a CRLF Injection / IMAP Command injection via Symbol arguments passed to IMAP commands. This issue has been patched in versions 0.4.24, 0.5.14, and 0.6.4.

MITRE

Affected Software

6 affected componentsFixes available
rubygems/net-imap>=0<=0.4.23
0.4.24
rubygems/net-imap>=0.5.0<=0.5.13
0.5.14
rubygems/net-imap>=0.6.0<=0.6.3
0.6.4
ruby-lang Net\<0.4.24
ruby-lang Net\>=0.5.0<0.5.14
ruby-lang Net\>=0.6.0<0.6.4

Event History

May 4, 2026
Advisory Published
via GitHub·10:04 PM
Data Sourced
via GitHub·10:04 PM
DescriptionWeaknessAffected Software
May 9, 2026
CVE Published
via MITRE·07:40 PM
Data Sourced
via MITRE·07:40 PM
DescriptionWeakness
Data Sourced
via NVD·08:16 PM
DescriptionSeverityWeaknessAffected Software
Free Weekly Intel

Don't miss critical vulnerabilities

Join thousands of security professionals who receive our weekly digest of trending CVEs, zero-days, and exploited vulnerabilities.

No spam. Unsubscribe anytime.

Frequently Asked Questions

1

What is the severity of CVE-2026-42258?

CVE-2026-42258 is considered a medium severity vulnerability due to its potential for CRLF Injection and IMAP Command injection.

2

Which versions are affected by CVE-2026-42258?

CVE-2026-42258 affects net-imap versions prior to 0.4.24, 0.5.14, and 0.6.4.

3

How do I fix CVE-2026-42258?

To fix CVE-2026-42258, upgrade net-imap to version 0.4.24, 0.5.14, or 0.6.4 or later.

4

What does CVE-2026-42258 target specifically?

CVE-2026-42258 targets the misuse of Symbol arguments in IMAP commands which can lead to injection vulnerabilities.

5

Can CVE-2026-42258 impact email security?

Yes, CVE-2026-42258 can compromise email security by allowing attackers to exploit injection points within IMAP commands.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203