# CVE-2026-42258: Ruby Net::IMAP command injection via Symbol arguments

Source: https://junglewise.ai/threats/cve-2026-42258-ruby-net-imap-command-injection-via-symbol-arguments  
Publisher: Junglewise Threat Intelligence, https://junglewise.ai/threats  
Published: 2026-05-09. Updated: 2026-07-21  
License: CC BY 4.0 with a link back

CVE-2026-42258 · Severity: critical · CVSS 9.8 · Published 2026-05-09

A vulnerability in the Ruby net-imap library, which is used by applications to communicate with email servers, could allow an attacker to inject unauthorized commands. If an application passes untrusted user input as a 'Symbol' to this library, an attacker could potentially delete mailboxes or perform other unauthorized email operations. This could lead to data loss or disruption of email services for affected users.

Technologies: [net-imap (RubyGems)](https://junglewise.ai/threats/technologies/net-imap). Vendors: [RubyGems](https://junglewise.ai/threats/vendors/rubygems).

## Quick answers

**Is CVE-2026-42258 exploited in the wild?** No. Junglewise Threat Intelligence has no report of CVE-2026-42258 being exploited in the wild.

**How severe is CVE-2026-42258?** Critical severity, with a CVSS score of 9.8, published 9 May 2026.

**Which products and versions are affected?** net-imap (RubyGems) ECOSYSTEM:introduced=0.6.0,fixed=0.6.4.

**Is there a fix for CVE-2026-42258?** Yes. net-imap (RubyGems): upgrade to 0.6.4 or later. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.

**How is CVE-2026-42258 attacked?** It is attacked with local access, in a software library.

**Am I affected by CVE-2026-42258?** Check whether you run net-imap (RubyGems) at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

## How to fix

- net-imap (RubyGems): upgrade to 0.6.4 or later

  ```sh
  bundle update net-imap
  ```


## Technical details

The net-imap library fails to validate Symbol arguments, which are used to represent IMAP 'system flags'. Because these symbols are sent directly to the socket with a '\' prefix and no quoting or validation, an attacker can provide a Symbol containing CRLF sequences or spaces. This enables CRLF injection, allowing the attacker to terminate the intended IMAP command and inject arbitrary new commands (e.g., DELETE). The vulnerability is exploitable if the calling application converts untrusted user input into Symbols (via #to_sym or unsafe deserialization) before passing them to net-imap methods. Patches are available in versions 0.6.4, 0.5.14, and 0.4.24.

## Affected products

- Ruby net-imap >= 0.6.0, <= 0.6.3
- Ruby net-imap >= 0.5.0, <= 0.5.13
- Ruby net-imap <= 0.4.23

## Identifiers

- CVE-2026-42258
- GHSA-75xq-5h9v-w6px

## Timeline

- 2026-04-24: disclosed: Initial disclosure in ruby/net-imap
- 2026-04-24: patched: Fixes released in versions 0.4.24, 0.5.14, and 0.6.4
- 2026-05-04: advisory: GitHub Advisory published
- 2026-05-09: other: NVD publication date

## References

- [https://api.github.com/users/manunio](https://api.github.com/users/manunio)
- [https://github.com/manunio](https://github.com/manunio)
- [https://api.github.com/users/manunio/gists%7B/gist_id%7D](https://api.github.com/users/manunio/gists%7B/gist_id%7D)
- [https://api.github.com/users/manunio/repos](https://api.github.com/users/manunio/repos)
- [https://avatars.githubusercontent.com/u/8413800?v=4](https://avatars.githubusercontent.com/u/8413800?v=4)
- [https://api.github.com/users/manunio/events%7B/privacy%7D](https://api.github.com/users/manunio/events%7B/privacy%7D)

## Related threats

- [Ruby Net::IMAP command injection in ID and ENABLE commands](https://junglewise.ai/threats/cve-2026-47242-ruby-net-imap-command-injection-in-id-and-enable-commands)
- [Ruby Net::IMAP denial of service via incomplete raw argument validation](https://junglewise.ai/threats/cve-2026-47241-ruby-net-imap-denial-of-service-via-incomplete-raw-argument)
- [Ruby Net::IMAP command injection via non-synchronizing literals](https://junglewise.ai/threats/cve-2026-47240-ruby-net-imap-command-injection-via-non-synchronizing-literals)
- [Ruby Net::IMAP command injection in multiple commands](https://junglewise.ai/threats/cve-2026-42257-ruby-net-imap-command-injection-in-multiple-commands)
- [Ruby Net::IMAP computational DoS in SCRAM authentication](https://junglewise.ai/threats/cve-2026-42256-ruby-net-imap-computational-dos-in-scram-authentication)
