CVE-2026-47242: Net :IMAP: Command Injection Vulnerability

MODERATE
Advisory Identifier: GHSA-46q3-7gv7-qmgg
CWE-93 CWE-77
Published
Advisory Summary

CVE-2026-47242 is a MODERATE :imap: command injection vulnerability (CWE-93: Improper Neutralization of CRLF Sequences ('CRLF Injection')) affecting Net libraries in the RubyGems ecosystem. The issue involves :imap: command injection via id command argument. Remediation is available by upgrading affected packages to version 0.6.4.1, 0.5.15.

CVE-2026-47242 at a Glance

CVE Identifier CVE-2026-47242
GHSA Identifier GHSA-46q3-7gv7-qmgg
Severity MODERATE
CVSS v3.1 Base Score N/A
CWE Classification CWE-93: Improper Neutralization of CRLF Sequences ('CRLF Injection')
Affected Product Net
Package Ecosystem RubyGems
Published Date
Last Updated

How to Fix CVE-2026-47242

To remediate this vulnerability, upgrade all affected Net 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.1
Upgrade net-imap to 0.6.4.1
net-imap fixed: 0.5.15
Upgrade net-imap to 0.5.15
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-47242, inspect your project dependencies for Net:

inspect dependencies for net-imap

Analyze the terminal output to locate any version of Net 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.1), 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, 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 Two `Net::IMAP` commands, `#id` and `#enable`, do not validate their arguments. Arguments to either command could be used by an attacker to inject arbitrary IMAP commands. Please note that passing untrusted inputs to these commands is usually inappropriate and expected to be uncommon. ### Details When `Net::IMAP#id` is called with a hash argument, although the ID field value strings are correctly quoted (escaping quoted specials), they were not validated to prohibit CRLF sequences. While `Net::IMAP#enable` does process its arguments for aliases, it does not validate them as valid atoms (or as a list of valid atoms). The `#to_s` value is sent verbatim. ### Impact This is expected to impact very few users: use of untrusted user input for either command is expected to be very uncommon. The documentation for `#enable` explicitly warns that using any arguments that are not in the explicitly supported list may result in undocumented behavior. Using arbitrary untrusted user input for `#enable` will always be inappropriate. Although client ID field values will most commonly be static and hardcoded, dynamic input sources may be used. For example, client ID fields may be set by configuration or version numbers. Using untrusted user inputs for client ID fields is expected to be uncommon. But any untrusted inputs to client ID can trivially exploit this vulnerability. Untrusted inputs to either command may include a CRLF sequence followed by a new IMAP command (like DELETE mailbox). Although this does not directly enable data exfiltration, it could be combined with other attack vectors or knowledge of the target system's attributes, e.g.: shared mail folders or the application's installed response handlers. ### Mitigation Update to a version of `net-imap` which validates `#id` and `#enable` arguments. Untrusted inputs should _never_ be used for `#enable` arguments. If `net-imap` cannot be upgraded: * do not use untrusted inputs for client ID field values * or add validation that client ID field values must not contain any CR or LF bytes.

CVE-2026-47242 Affected Net Versions

2 component(s)
Fixed Versions:
0.6.4.10.5.15
Product / Package Ecosystem Affected Versions Fixed Version
net-imap
RubyGems
≥ 0.6.0
< 0.6.4.1
0.6.4.1
net-imap
RubyGems
< 0.5.15
0.5.15

References

Frequently Asked Questions

What is CVE-2026-47242?
CVE-2026-47242 is a security vulnerability in Net involving :IMAP: Command Injection via ID command argument under CWE-93: Improper Neutralization of CRLF Sequences ('CRLF Injection').
Which Net versions are affected?
Affected versions include releases prior to 0.6.4.1, 0.5.15 across affected packages: net-imap.
What version fixes CVE-2026-47242?
Upgrading to 0.6.4.1, 0.5.15 (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.1, 0.5.15. Upgrade your dependency to 0.6.4.1, 0.5.15 or later.
What CWE is associated with CVE-2026-47242?
CVE-2026-47242 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-47242?
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-46q3-7gv7-qmgg",
  "modified" : "2026-07-06T22:54:06Z",
  "published" : "2026-06-09T20:31:52Z",
  "aliases" : [ "CVE-2026-47242" ],
  "summary" : "Net::IMAP: Command Injection via ID command argument",
  "details" : "### Summary\n\nTwo `Net::IMAP` commands, `#id` and `#enable`, do not validate their arguments.  Arguments to either command could be used by an attacker to inject arbitrary IMAP commands.\n\nPlease note that passing untrusted inputs to these commands is usually inappropriate and expected to be uncommon.\n\n### Details\n\nWhen `Net::IMAP#id` is called with a hash argument, although the ID field value strings are correctly quoted (escaping quoted specials), they were not validated to prohibit CRLF sequences.\n\nWhile `Net::IMAP#enable` does process its arguments for aliases, it does not validate them as valid atoms (or as a list of valid atoms).  The `#to_s` value is sent verbatim.\n\n### Impact\n\nThis is expected to impact very few users: use of untrusted user input for either command is expected to be very uncommon.\n\nThe documentation for `#enable` explicitly warns that using any arguments that are not in the explicitly supported list may result in undocumented behavior.  Using arbitrary untrusted user input for `#enable` will always be inappropriate.\n\nAlthough client ID field values will most commonly be static and hardcoded, dynamic input sources may be used.  For example, client ID fields may be set by configuration or version numbers.  Using untrusted user inputs for client ID fields is expected to be uncommon.  But any untrusted inputs to client ID can trivially exploit this vulnerability.\n\nUntrusted inputs to either command may include a CRLF sequence followed by a new IMAP command (like DELETE mailbox). Although this does not directly enable data exfiltration, it could be combined with other attack vectors or knowledge of the target system's attributes, e.g.: shared mail folders or the application's installed response handlers.\n\n### Mitigation\n\nUpdate to a version of `net-imap` which validates `#id` and `#enable` arguments.\n\nUntrusted inputs should _never_ be used for `#enable` arguments.\n\nIf `net-imap` cannot be upgraded:\n* do not use untrusted inputs for client ID field values\n* or add validation that client ID field values must not contain any CR or LF bytes.",
  "severity" : [ {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:L/AC:L/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.1"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 0.6.4"
    }
  }, {
    "package" : {
      "ecosystem" : "RubyGems",
      "name" : "net-imap"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "0.5.15"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 0.5.14"
    }
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/ruby/net-imap/security/advisories/GHSA-46q3-7gv7-qmgg"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-47242"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/ruby/net-imap"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/ruby/net-imap/releases/tag/v0.6.4.1"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/rubysec/ruby-advisory-db/blob/master/gems/net-imap/CVE-2026-47242.yml"
  }, {
    "type" : "WEB",
    "url" : "https://www.cve.org/CVERecord?id=CVE-2026-47242"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-77", "CWE-93" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-06-09T20:31:52Z",
    "nvd_published_at" : "2026-06-22T21:16:24Z"
  }
}