GHSA-75xq-5h9v-w6px CVE-2026-42258
net-imap vulnerable to command Injection via unvalidated Symbol inputs
- Severity
- 0.0 / 10
- Medium · CVSS 4.0
- Exploit chance (EPSS)
- 0.78%
- Chance of exploitation in the next 30 days. Higher than 56.04% of scored vulnerabilities.
- Known exploited
- No
- Not in CISA's catalog
- Weakness
- CWE-77 Improper Neutralization of Special Elements used in a Command ('Command Injection')
- CWE-93 Improper Neutralization of CRLF Sequences ('CRLF Injection')
- Fix
0.6.4- Upgrade net-imap to this version or later
Description
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_symon 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
flagarguments, it may be appropriate to hard-code Symbol arguments or restrict them to an enumerated list which is valid for the calling application.
Affected versions
RubyGems
| Package | Vulnerable | Fixed in |
|---|---|---|
| net-imap | >= 0.6.0, < 0.6.4 |
0.6.4 |
| net-imap | >= 0.5.0, < 0.5.14 |
0.5.14 |
| net-imap | < 0.4.24 |
0.4.24 |
How to fix
Move to the fixed version or later with your package manager, update the lockfile, and run your tests. If the package only arrives through another dependency, upgrade that dependency first. If none of its releases pulls a fixed version yet, force the version with your package manager's override.
net-imap RubyGems → 0.6.4
- bundler
bundle update net-imap # Gemfile: gem "net-imap", ">= 0.6.4"
Severity breakdown
CVSS 4.0 0.0
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
- Attack vector
- Local
- Attack complexity
- High
- Attack requirements
- Present
- Privileges required
- None
- User interaction
- Passive
- Confidentiality (vulnerable system)
- None
- Integrity (vulnerable system)
- High
- Availability (vulnerable system)
- Low
- Confidentiality (subsequent systems)
- None
- Integrity (subsequent systems)
- None
- Availability (subsequent systems)
- None
CVSS 3.1 5.3
CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:N/I:H/A:L
- Attack vector
- Local
- Attack complexity
- High
- Privileges required
- Low
- User interaction
- None
- Scope
- Unchanged
- Confidentiality
- None
- Integrity
- High
- Availability
- Low
Weakness
CWE-77: Improper Neutralization of Special Elements used in a Command ('Command Injection')
The product constructs all or part of a command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended command when it is sent to a downstream component.
How to prevent it
- Architecture and Design: If at all possible, use library calls rather than external processes to recreate the desired functionality.
- Implementation: If possible, ensure that all external commands called from the program are statically created.
- Implementation: Assume all input is malicious. Use an "accept known good" input validation strategy, i.e., use a list of acceptable inputs that strictly conform to specifications. Reject any input that does not strictly conform to specifications, or transform it into something that does. When performing input validation, consider all potentially relevant properties, including length, type of input, the full range of acceptable values, missing or extra inputs, syntax, consistency across related fields, and conformance to business rules. As an example of business rule logic, "boat" may be syntactically valid because it only contains alphanumeric characters, but it is not valid if the input is only expected to contain colors such as "red" or "blue." Do not rely exclusively on looking for malicious or malformed inputs. This is likely to miss at least one undesirable input, especially if the code's environment changes. This can give attackers enough room to bypass the intended validation. However, denylists can be useful for detecting potential attacks or determining which inputs are so malformed that they should be rejected outright.
- Operation: Run time: Run time policy enforcement may be used in an allowlist fashion to prevent use of any non-sanctioned commands.
- System Configuration: Assign permissions that prevent the user from accessing/opening privileged files.
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 to prevent it
- Implementation: Avoid using CRLF as a special sequence.
- Implementation: Appropriately filter or quote CRLF sequences in user-controlled input.
References
Advisories
Packages
Other links
- github.com/ruby/net-imap/security/advisories/GHSA-75xq-5h9v-w6px
- github.com/ruby/net-imap/commit/aec06996eb87a7e1bbcef1f9f8926e8add2b8c71
- github.com/ruby/net-imap/commit/9db3e9d60bfb8f3735ea95015bf8a700f4af9cbb
- github.com/ruby/net-imap/commit/6bf02aef7e0b5931010c36e377f79a71636b306b
- access.redhat.com/errata/RHSA-2026:33462
- access.redhat.com/errata/RHSA-2026:37238
- access.redhat.com/errata/RHSA-2026:37397
- access.redhat.com/errata/RHSA-2026:38694
- access.redhat.com/errata/RHSA-2026:40380
- access.redhat.com/security/cve/CVE-2026-42258
- bugzilla.redhat.com/show_bug.cgi
- github.com/ruby/net-imap/releases/tag/v0.4.24
- github.com/ruby/net-imap/releases/tag/v0.5.14
- github.com/ruby/net-imap/releases/tag/v0.6.4
- github.com/rubysec/ruby-advisory-db/blob/master/gems/net-imap/CVE-2026-42258.yml
- security.access.redhat.com/data/csaf/v2/vex/2026/cve-2026-42258.json
- access.redhat.com/errata/RHSA-2026:33512
- access.redhat.com/errata/RHSA-2026:33514
- access.redhat.com/errata/RHSA-2026:33515
- access.redhat.com/errata/RHSA-2026:33540
- access.redhat.com/errata/RHSA-2026:33565
- access.redhat.com/errata/RHSA-2026:33576
- access.redhat.com/errata/RHSA-2026:33577
- access.redhat.com/errata/RHSA-2026:33630
- access.redhat.com/errata/RHSA-2026:33721
- access.redhat.com/errata/RHSA-2026:34076
- access.redhat.com/errata/RHSA-2026:35447
- access.redhat.com/errata/RHSA-2026:35834
- access.redhat.com/errata/RHSA-2026:35866
- access.redhat.com/errata/RHSA-2026:35867
- access.redhat.com/errata/RHSA-2026:35895
- access.redhat.com/errata/RHSA-2026:36099
- access.redhat.com/errata/RHSA-2026:36978
Timeline
- Published
- Last updated by the source
- Latest EPSS score
Related advisories
| Advisory | Severity | Why it's related |
|---|---|---|
| GHSA-46q3-7gv7-qmgg Net::IMAP: Command Injection via ID command argument | Medium | Also affects net-imap |
| GHSA-c4fp-cxrr-mj66 Net::IMAP: Denial of Service via incomplete raw argument validation | Low | Also affects net-imap |
| GHSA-8p34-64r3-mwg8 Net::IMAP: Command Injection via non-synchronizing literal in "raw" argument | Medium | Also affects net-imap |
| GHSA-hm49-wcqc-g2xg net-imap vulnerable to command Injection via "raw" arguments to multiple commands | Critical | Also affects net-imap |
| GHSA-87pf-fpwv-p7m7 net-imap vulnerable to denial of service via high iteration count for `SCRAM-*` authentication | Medium | Also affects net-imap |
| GHSA-q2mw-fvj9-vvcw net-imap has quadratic complexity when reading response literals | High | Also affects net-imap |
| GHSA-vcgp-9326-pqcp net-imap vulnerable to STARTTLS stripping via invalid response timing | High | Also affects net-imap |
| GHSA-j3g3-5qv5-52mj net-imap rubygem vulnerable to possible DoS by memory exhaustion | Medium | Also affects net-imap |
MergeHarbor checks every repository's dependencies against this database, ranks what matters by exploitability and reachability, routes it to the owning team and opens the fix pull request.
Check your repos with MergeHarbor