CVE-2026-42258

CVE-2026-42258 is a medium-severity command injection vulnerability in net-imap (rubygems), affecting versions >= 0.6.0, <= 0.6.3. It is fixed in 0.6.4, 0.5.14, 0.4.24.

Does this CVE actually affect you?

Kodem shows which CVEs are reachable and running in your applications, so you fix what's exploitable, not just what's listed.

Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.

Runtime intelligence, not another scanner.

Summary

net-imap vulnerable to command Injection via unvalidated Symbol inputs

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 #to_sym ever be called on unvetted user-provided input: that will always be a bug in the calling code for the simple reason that user_input_atom is as \user_input_atom.

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.

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 #to_sym 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.

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).

Untrusted input is inserted into a command that is later executed by the application, allowing the attacker to alter the intent of that command. Typical impact: arbitrary command execution in the application's environment.

Affected versions

net-imap (>= 0.6.0, <= 0.6.3) net-imap (>= 0.5.0, <= 0.5.13) net-imap (>= 0, <= 0.4.23)

Security releases

net-imap → 0.6.4 (rubygems) net-imap → 0.5.14 (rubygems) net-imap → 0.4.24 (rubygems)

Kodem intelligence

Severity tells you how bad this could be in the worst case. It does not tell you whether you are exposed. Exploitability and impact are functions of runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A vulnerable package can sit in your dependency tree and never run.

Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter. Kodem's runtime-powered SCA identifies whether this CVE is reachable in your applications.

Already deployed Kodem?

See it in your environmentNew to Kodem? Get a demo →

Remediation advice

Upgrade the following packages to resolve this vulnerability:

net-imap to 0.6.4 or later; net-imap to 0.5.14 or later; net-imap to 0.4.24 or later

Kodem Kai can prioritize this vulnerability in your dependency tree and generate a fix recommendation.

Frequently Asked Questions

  1. What is CVE-2026-42258? CVE-2026-42258 is a medium-severity command injection vulnerability in net-imap (rubygems), affecting versions >= 0.6.0, <= 0.6.3. It is fixed in 0.6.4, 0.5.14, 0.4.24. Untrusted input is inserted into a command that is later executed by the application, allowing the attacker to alter the intent of that command.
  2. Which versions of net-imap are affected by CVE-2026-42258? net-imap (rubygems) versions >= 0.6.0, <= 0.6.3 is affected.
  3. Is there a fix for CVE-2026-42258? Yes. CVE-2026-42258 is fixed in 0.6.4, 0.5.14, 0.4.24. Upgrade to this version or later.
  4. Is CVE-2026-42258 exploitable, and should I be worried? Whether CVE-2026-42258 is exploitable in your environment depends on whether the vulnerable code is present and reachable. A CVSS score is a worst-case rating; it does not account for your specific deployment, configuration, or usage patterns. Kodem, an Intelligent Application Security platform, uses runtime intelligence to show which vulnerabilities actually execute in production, so you can focus on the ones that represent real risk. Get a demo
  5. What actually determines whether CVE-2026-42258 is exploitable, and how bad it is? Exploitability and impact are not fixed properties of a CVE. They depend on runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A high CVSS score on a dependency that never runs is not the same as real risk. Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter.
  6. How do I fix CVE-2026-42258?
    • Upgrade net-imap to 0.6.4 or later
    • Upgrade net-imap to 0.5.14 or later
    • Upgrade net-imap to 0.4.24 or later

Other vulnerabilities in net-imap

Stop the waste.
Protect your environment with Kodem.