CVE-2026-42258: Net imap Net-imap Vulnerable To Command Injection Vulnerability

MODERATE
Advisory Identifier: GHSA-75xq-5h9v-w6px
CVSS 5.3
CWE-93 CWE-77
Published
Advisory Summary

CVE-2026-42258 is a MODERATE (CVSS 5.3) net-imap vulnerable to command injection vulnerability (CWE-93: Improper Neutralization of CRLF Sequences ('CRLF Injection')) affecting Net imap libraries in the RubyGems ecosystem. The issue involves net-imap vulnerable to command injection via unvalidated symbol inputs. Remediation is available by upgrading affected packages to version 0.6.4, 0.5.14, 0.4.24.

CVE-2026-42258 at a Glance

CVE Identifier CVE-2026-42258
GHSA Identifier GHSA-75xq-5h9v-w6px
Severity MODERATE
CVSS v3.1 Base Score 5.3
CWE Classification CWE-93: Improper Neutralization of CRLF Sequences ('CRLF Injection')
Affected Product Net imap
Package Ecosystem RubyGems
Published Date
Last Updated

Security Impact

CVSS: 5.3

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:N/I:H/A:L).

Attack Vector Local (AV:L)
Attack Complexity High (AC:H)
Privileges Required Low (PR:L)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality None (C:N)
Integrity High (I:H)
Availability Low (A:L)

How to Fix CVE-2026-42258

To remediate this vulnerability, upgrade all affected Net imap dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

net-imap fixed: 0.6.4
Upgrade net-imap to 0.6.4
net-imap fixed: 0.5.14
Upgrade net-imap to 0.5.14
net-imap fixed: 0.4.24
Upgrade net-imap to 0.4.24
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for net-imap

How to Check if You Are Affected

To determine whether your application is affected by CVE-2026-42258, inspect your project dependencies for Net imap:

inspect dependencies for net-imap

Analyze the terminal output to locate any version of Net imap in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.6.4), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-93: Improper Neutralization of CRLF Sequences ('CRLF Injection'), where the product uses crlf (carriage return line feeds) as a special element, e.g. to separate lines or records, but it does not neutralize or incorrectly neutralizes crlf sequences from inputs. In Net imap, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

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

CVE-2026-42258 Affected Net imap Versions

3 component(s)
Fixed Versions:
0.6.40.5.140.4.24
Product / Package Ecosystem Affected Versions Fixed Version
net-imap
RubyGems
≥ 0.6.0
< 0.6.4
0.6.4
net-imap
RubyGems
≥ 0.5.0
< 0.5.14
0.5.14
net-imap
RubyGems
< 0.4.24
0.4.24

References

GitHub Advisory / Wiki ADVISORY
https://github.com/ruby/net-imap/security/advisories/GHSA-75xq-5h9v-w6px
NVD — CVE-2026-42258 NVD
https://nvd.nist.gov/vuln/detail/CVE-2026-42258
Security Fix Commit FIX COMMIT
https://github.com/ruby/net-imap/commit/aec06996eb87a7e1bbcef1f9f8926e8add2b8c71
Security Fix Commit FIX COMMIT
https://github.com/ruby/net-imap/commit/9db3e9d60bfb8f3735ea95015bf8a700f4af9cbb
Security Fix Commit FIX COMMIT
https://github.com/ruby/net-imap/commit/6bf02aef7e0b5931010c36e377f79a71636b306b
access.redhat.com/errata/rhsa-2026:33... WEB
https://access.redhat.com/errata/RHSA-2026:33462
access.redhat.com/errata/rhsa-2026:37... WEB
https://access.redhat.com/errata/RHSA-2026:37238
access.redhat.com/errata/rhsa-2026:37... WEB
https://access.redhat.com/errata/RHSA-2026:37397
access.redhat.com/errata/rhsa-2026:38... WEB
https://access.redhat.com/errata/RHSA-2026:38694
access.redhat.com/errata/rhsa-2026:40... WEB
https://access.redhat.com/errata/RHSA-2026:40380
Net imap Security Information SECURITY
https://access.redhat.com/security/cve/CVE-2026-42258
bugzilla.redhat.com/show_bug.cgi WEB
https://bugzilla.redhat.com/show_bug.cgi?id=2468498
Net imap Source Repository REPOSITORY
https://github.com/ruby/net-imap
Net imap Release RELEASE
https://github.com/ruby/net-imap/releases/tag/v0.4.24
Net imap Release RELEASE
https://github.com/ruby/net-imap/releases/tag/v0.5.14
Net imap Release RELEASE
https://github.com/ruby/net-imap/releases/tag/v0.6.4
Net imap Source Repository REPOSITORY
https://github.com/rubysec/ruby-advisory-db/blob/master/gems/net-imap/CVE-2026-42258.yml
Net imap Security Information SECURITY
https://security.access.redhat.com/data/csaf/v2/vex/2026/cve-2026-42258.json
access.redhat.com/errata/rhsa-2026:33... WEB
https://access.redhat.com/errata/RHSA-2026:33512
access.redhat.com/errata/rhsa-2026:33... WEB
https://access.redhat.com/errata/RHSA-2026:33514
access.redhat.com/errata/rhsa-2026:33... WEB
https://access.redhat.com/errata/RHSA-2026:33515
access.redhat.com/errata/rhsa-2026:33... WEB
https://access.redhat.com/errata/RHSA-2026:33540
access.redhat.com/errata/rhsa-2026:33... WEB
https://access.redhat.com/errata/RHSA-2026:33565
access.redhat.com/errata/rhsa-2026:33... WEB
https://access.redhat.com/errata/RHSA-2026:33576
access.redhat.com/errata/rhsa-2026:33... WEB
https://access.redhat.com/errata/RHSA-2026:33577
access.redhat.com/errata/rhsa-2026:33... WEB
https://access.redhat.com/errata/RHSA-2026:33630
access.redhat.com/errata/rhsa-2026:33... WEB
https://access.redhat.com/errata/RHSA-2026:33721
access.redhat.com/errata/rhsa-2026:34... WEB
https://access.redhat.com/errata/RHSA-2026:34076
access.redhat.com/errata/rhsa-2026:35... WEB
https://access.redhat.com/errata/RHSA-2026:35447
access.redhat.com/errata/rhsa-2026:35... WEB
https://access.redhat.com/errata/RHSA-2026:35834
access.redhat.com/errata/rhsa-2026:35... WEB
https://access.redhat.com/errata/RHSA-2026:35866
access.redhat.com/errata/rhsa-2026:35... WEB
https://access.redhat.com/errata/RHSA-2026:35867
access.redhat.com/errata/rhsa-2026:35... WEB
https://access.redhat.com/errata/RHSA-2026:35895
access.redhat.com/errata/rhsa-2026:36... WEB
https://access.redhat.com/errata/RHSA-2026:36099
access.redhat.com/errata/rhsa-2026:36... WEB
https://access.redhat.com/errata/RHSA-2026:36978

Frequently Asked Questions

What is CVE-2026-42258?
CVE-2026-42258 is a security vulnerability in Net imap involving net-imap vulnerable to command Injection via unvalidated Symbol inputs under CWE-93: Improper Neutralization of CRLF Sequences ('CRLF Injection').
Which Net imap versions are affected?
Affected versions include releases prior to 0.6.4, 0.5.14, 0.4.24 across affected packages: net-imap.
What version fixes CVE-2026-42258?
Upgrading to 0.6.4, 0.5.14, 0.4.24 (or the latest patched release for your respective branch) resolves the vulnerability.
Is net-imap affected?
Yes, net-imap is affected in releases prior to 0.6.4, 0.5.14, 0.4.24. Upgrade your dependency to 0.6.4, 0.5.14, 0.4.24 or later.
What is the CVSS score of CVE-2026-42258?
CVE-2026-42258 has a CVSS v3.1 base score of 5.3 (MODERATE) with vector string CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:N/I:H/A:L.
What CWE is associated with CVE-2026-42258?
CVE-2026-42258 is classified under CWE-93: Improper Neutralization of CRLF Sequences ('CRLF Injection') (The product uses CRLF (carriage return line feeds) as a special element, e.g. to separate lines or records, but it does not neutralize or incorrectly neutralizes CRLF sequences from inputs.).
How can I check RubyGems dependencies for CVE-2026-42258?
Run the dependency tree command: 'inspect dependencies for net-imap'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-75xq-5h9v-w6px",
  "modified" : "2026-07-22T12:31:55Z",
  "published" : "2026-05-04T22:04:08Z",
  "aliases" : [ "CVE-2026-42258" ],
  "summary" : "net-imap vulnerable to command Injection via unvalidated Symbol inputs",
  "details" : "### Summary\n\nSymbol arguments to commands are vulnerable to a CRLF Injection / IMAP Command injection via Symbol arguments passed to IMAP commands.\n\n### Details\n\nSymbol 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.\n\nBecause 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.\n\nAlthough 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.\n\nNote 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`.\n\nFor 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.\n\n### Impact\n\nIf 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`).\n\n### Mitigation\n* Upgrade to a version of Net::IMAP that validates Symbols are valid as an IMAP `flag`.\n* User-provided input should never be able to control calling `#to_sym` on string arguments.\n\n  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.\n* 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.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:N/I:H/A:L"
  }, {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:L/AC:H/AT:P/PR:N/UI:P/VC:N/VI:H/VA:L/SC:N/SI:N/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "RubyGems",
      "name" : "net-imap"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0.6.0"
      }, {
        "fixed" : "0.6.4"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 0.6.3"
    }
  }, {
    "package" : {
      "ecosystem" : "RubyGems",
      "name" : "net-imap"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0.5.0"
      }, {
        "fixed" : "0.5.14"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 0.5.13"
    }
  }, {
    "package" : {
      "ecosystem" : "RubyGems",
      "name" : "net-imap"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "0.4.24"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 0.4.23"
    }
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/ruby/net-imap/security/advisories/GHSA-75xq-5h9v-w6px"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-42258"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/ruby/net-imap/commit/aec06996eb87a7e1bbcef1f9f8926e8add2b8c71"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/ruby/net-imap/commit/9db3e9d60bfb8f3735ea95015bf8a700f4af9cbb"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/ruby/net-imap/commit/6bf02aef7e0b5931010c36e377f79a71636b306b"
  }, {
    "type" : "WEB",
    "url" : "https://access.redhat.com/errata/RHSA-2026:33462"
  }, {
    "type" : "WEB",
    "url" : "https://access.redhat.com/errata/RHSA-2026:37238"
  }, {
    "type" : "WEB",
    "url" : "https://access.redhat.com/errata/RHSA-2026:37397"
  }, {
    "type" : "WEB",
    "url" : "https://access.redhat.com/errata/RHSA-2026:38694"
  }, {
    "type" : "WEB",
    "url" : "https://access.redhat.com/errata/RHSA-2026:40380"
  }, {
    "type" : "WEB",
    "url" : "https://access.redhat.com/security/cve/CVE-2026-42258"
  }, {
    "type" : "WEB",
    "url" : "https://bugzilla.redhat.com/show_bug.cgi?id=2468498"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/ruby/net-imap"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/ruby/net-imap/releases/tag/v0.4.24"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/ruby/net-imap/releases/tag/v0.5.14"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/ruby/net-imap/releases/tag/v0.6.4"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/rubysec/ruby-advisory-db/blob/master/gems/net-imap/CVE-2026-42258.yml"
  }, {
    "type" : "WEB",
    "url" : "https://security.access.redhat.com/data/csaf/v2/vex/2026/cve-2026-42258.json"
  }, {
    "type" : "WEB",
    "url" : "https://access.redhat.com/errata/RHSA-2026:33512"
  }, {
    "type" : "WEB",
    "url" : "https://access.redhat.com/errata/RHSA-2026:33514"
  }, {
    "type" : "WEB",
    "url" : "https://access.redhat.com/errata/RHSA-2026:33515"
  }, {
    "type" : "WEB",
    "url" : "https://access.redhat.com/errata/RHSA-2026:33540"
  }, {
    "type" : "WEB",
    "url" : "https://access.redhat.com/errata/RHSA-2026:33565"
  }, {
    "type" : "WEB",
    "url" : "https://access.redhat.com/errata/RHSA-2026:33576"
  }, {
    "type" : "WEB",
    "url" : "https://access.redhat.com/errata/RHSA-2026:33577"
  }, {
    "type" : "WEB",
    "url" : "https://access.redhat.com/errata/RHSA-2026:33630"
  }, {
    "type" : "WEB",
    "url" : "https://access.redhat.com/errata/RHSA-2026:33721"
  }, {
    "type" : "WEB",
    "url" : "https://access.redhat.com/errata/RHSA-2026:34076"
  }, {
    "type" : "WEB",
    "url" : "https://access.redhat.com/errata/RHSA-2026:35447"
  }, {
    "type" : "WEB",
    "url" : "https://access.redhat.com/errata/RHSA-2026:35834"
  }, {
    "type" : "WEB",
    "url" : "https://access.redhat.com/errata/RHSA-2026:35866"
  }, {
    "type" : "WEB",
    "url" : "https://access.redhat.com/errata/RHSA-2026:35867"
  }, {
    "type" : "WEB",
    "url" : "https://access.redhat.com/errata/RHSA-2026:35895"
  }, {
    "type" : "WEB",
    "url" : "https://access.redhat.com/errata/RHSA-2026:36099"
  }, {
    "type" : "WEB",
    "url" : "https://access.redhat.com/errata/RHSA-2026:36978"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-77", "CWE-93" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-05-04T22:04:08Z",
    "nvd_published_at" : "2026-05-09T20:16:28Z"
  }
}