# CVE-2026-47242: Net::IMAP: Command Injection via ID command argument

> Attackers can inject arbitrary IMAP commands via unsanitized arguments in the Ruby Net::IMAP library, potentially leading to code execution.

- **Severity:** Medium 5.8 (`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`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Local or same network only
- **Victim action needed:** A user has to click or open something
- **Fix available:** Yes
- **Published:** 22 Jun 2026
- **Updated:** 23 Jun 2026
- **Also known as:** ALPINE-CVE-2026-47242, AZL-91284, BELL-CVE-2026-47242, CLEANSTART-2026-FP14746, CLEANSTART-2026-YF80791, DEBIAN-CVE-2026-47242, ECHO-d8b1-4397-2a2e, GHSA-46q3-7gv7-qmgg, MINI-5rrx-5qwr-wqvm, MINI-5wpw-974x-p8q7, MINI-6mc8-m78c-mfhc, MINI-6r5v-vjhv-qgrg, MINI-fcwf-h2rm-m547, MINI-fpqq-fpjx-cr84, MINI-m4mm-6g6w-q6hw, MINI-p5c7-gv53-jf2w, MINI-pcgg-wv5g-pfr2, MINI-q3j4-8cvr-7vhw, MINI-qjhr-4qc2-qfpr, MINI-rh55-x2w5-88rc, MINI-vjc3-gxhx-7458, MINI-xhpx-xg48-q48c, MINI-xr2h-cjhc-988p, RHSA-2026:54391, RHSA-2026:54393, RHSA-2026:54416, UBUNTU-CVE-2026-47242

## What is CVE-2026-47242?

CVE-2026-47242 is a medium-severity command injection vulnerability in ruby net-imap, published on 22 Jun 2026. It can only be exploited from the same machine or local network, and only if a user opens a file or follows a link.

### Official description

Net::IMAP implements Internet Message Access Protocol (IMAP) client functionality in Ruby. Prior to 0.6.5 and 0.5.15, 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. Arguments to either command could be used by an attacker to inject arbitrary IMAP commands. This vulnerability is fixed in 0.6.5 and 0.5.15.

Weakness: CWE-93 (Improper Neutralization of CRLF Sequences), CWE-77 (Improper Neutralization of Special Elements used in a Command)

## Which versions are affected by CVE-2026-47242?

4 open source packages ship an affected version, including net-imap.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `net-imap` | RubyGems | All versions | 0.5.15 |
| `net-imap` | RubyGems | All versions | 0.5.15 |
| `net-imap` | RubyGems | From 0.6.0 | 0.6.4.1 |
| `net-imap` | RubyGems | From 0.6.0 | 0.6.4.1 |
| `ruby` | Red Hat:enterprise_linux_eus:10.0 | All versions | 0:3.3.12-11.el10_0.3 |
| `ruby-bundled-gems` | Red Hat:enterprise_linux_eus:10.0 | All versions | 0:3.3.12-11.el10_0.3 |
| `ruby-bundled-gems-debuginfo` | Red Hat:enterprise_linux_eus:10.0 | All versions | 0:3.3.12-11.el10_0.3 |
| `ruby-debuginfo` | Red Hat:enterprise_linux_eus:10.0 | All versions | 0:3.3.12-11.el10_0.3 |
| `ruby-debugsource` | Red Hat:enterprise_linux_eus:10.0 | All versions | 0:3.3.12-11.el10_0.3 |
| `ruby-default-gems` | Red Hat:enterprise_linux_eus:10.0 | All versions | 0:3.3.12-11.el10_0.3 |
| `ruby-devel` | Red Hat:enterprise_linux_eus:10.0 | All versions | 0:3.3.12-11.el10_0.3 |
| `ruby-doc` | Red Hat:enterprise_linux_eus:10.0 | All versions | 0:3.3.12-11.el10_0.3 |
| `ruby-libs` | Red Hat:enterprise_linux_eus:10.0 | All versions | 0:3.3.12-11.el10_0.3 |
| `ruby-libs-debuginfo` | Red Hat:enterprise_linux_eus:10.0 | All versions | 0:3.3.12-11.el10_0.3 |
| `rubygem-bigdecimal` | Red Hat:enterprise_linux_eus:10.0 | All versions | 0:3.1.5-11.el10_0.3 |
| `rubygem-bigdecimal-debuginfo` | Red Hat:enterprise_linux_eus:10.0 | All versions | 0:3.1.5-11.el10_0.3 |
| `rubygem-bundler` | Red Hat:enterprise_linux_eus:10.0 | All versions | 0:2.5.22-11.el10_0.3 |
| `rubygem-io-console` | Red Hat:enterprise_linux_eus:10.0 | All versions | 0:0.7.1-11.el10_0.3 |
| `rubygem-io-console-debuginfo` | Red Hat:enterprise_linux_eus:10.0 | All versions | 0:0.7.1-11.el10_0.3 |
| `rubygem-irb` | Red Hat:enterprise_linux_eus:10.0 | All versions | 0:1.13.1-11.el10_0.3 |
| `rubygem-json` | Red Hat:enterprise_linux_eus:10.0 | All versions | 0:2.7.2-11.el10_0.3 |
| `rubygem-json-debuginfo` | Red Hat:enterprise_linux_eus:10.0 | All versions | 0:2.7.2-11.el10_0.3 |
| `rubygem-minitest` | Red Hat:enterprise_linux_eus:10.0 | All versions | 0:5.20.0-11.el10_0.3 |
| `rubygem-power_assert` | Red Hat:enterprise_linux_eus:10.0 | All versions | 0:2.0.3-11.el10_0.3 |
| `rubygem-psych` | Red Hat:enterprise_linux_eus:10.0 | All versions | 0:5.1.2-11.el10_0.3 |
| `rubygem-psych-debuginfo` | Red Hat:enterprise_linux_eus:10.0 | All versions | 0:5.1.2-11.el10_0.3 |
| `rubygem-racc` | Red Hat:enterprise_linux_eus:10.0 | All versions | 0:1.7.3-11.el10_0.3 |
| `rubygem-racc-debuginfo` | Red Hat:enterprise_linux_eus:10.0 | All versions | 0:1.7.3-11.el10_0.3 |
| `rubygem-rake` | Red Hat:enterprise_linux_eus:10.0 | All versions | 0:13.1.0-11.el10_0.3 |
| `rubygem-rbs` | Red Hat:enterprise_linux_eus:10.0 | All versions | 0:3.4.0-11.el10_0.3 |
| `rubygem-rbs-debuginfo` | Red Hat:enterprise_linux_eus:10.0 | All versions | 0:3.4.0-11.el10_0.3 |
| `rubygem-rdoc` | Red Hat:enterprise_linux_eus:10.0 | All versions | 0:6.6.3.1-11.el10_0.3 |
| `rubygem-rexml` | Red Hat:enterprise_linux_eus:10.0 | All versions | 0:3.4.4-11.el10_0.3 |
| `rubygem-rss` | Red Hat:enterprise_linux_eus:10.0 | All versions | 0:0.3.1-11.el10_0.3 |
| `rubygem-test-unit` | Red Hat:enterprise_linux_eus:10.0 | All versions | 0:3.6.1-11.el10_0.3 |
| `rubygem-typeprof` | Red Hat:enterprise_linux_eus:10.0 | All versions | 0:0.21.9-11.el10_0.3 |
| `rubygems` | Red Hat:enterprise_linux_eus:10.0 | All versions | 0:3.5.22-11.el10_0.3 |
| `rubygems-devel` | Red Hat:enterprise_linux_eus:10.0 | All versions | 0:3.5.22-11.el10_0.3 |
| `ruby` | Red Hat:rhel_e4s:9.4::appstream | All versions | 0:3.3.12-7.module+el9.4.0+24628+a370c2b9.2 |
| `ruby-bundled-gems` | Red Hat:rhel_e4s:9.4::appstream | All versions | 0:3.3.12-7.module+el9.4.0+24628+a370c2b9.2 |

## How do I fix CVE-2026-47242?

Upgrade net-imap to a fixed version for your release line: 0.5.15 or 0.6.4.1.

## Is CVE-2026-47242 being exploited?

There is no known exploitation of CVE-2026-47242 in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2026-47242 and fix it if it is affected.

What it is: CVE-2026-47242 is a medium-severity command injection vulnerability in ruby net-imap, published on 22 Jun 2026. It can only be exploited from the same machine or local network, and only if a user opens a file or follows a link.
Exploitation: There is no known exploitation of CVE-2026-47242 in the wild and no public exploit code.

Affected packages and fixed versions:
- net-imap (RubyGems): affected all versions; fixed in 0.5.15
- net-imap (RubyGems): affected all versions; fixed in 0.5.15
- net-imap (RubyGems): affected from 0.6.0; fixed in 0.6.4.1
- net-imap (RubyGems): affected from 0.6.0; fixed in 0.6.4.1

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2026-47242/ (Markdown: https://insights.sbomify.com/CVE-2026-47242/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2026-47242
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2026-47242
- OSV: https://osv.dev/vulnerability/CVE-2026-47242

---
From sbomify Insights: https://insights.sbomify.com/CVE-2026-47242/
Summaries are generated and may contain mistakes; the official description above is the record.
