Skip to content

Commit 5206f09

Browse files
jasnowRubySec CI
authored andcommitted
Updated advisory posts against rubysec/ruby-advisory-db@85b6b5a
1 parent d7f2ab1 commit 5206f09

3 files changed

Lines changed: 283 additions & 0 deletions

File tree

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
---
2+
layout: advisory
3+
title: 'CVE-2026-47240 (net-imap): Net::IMAP: Command Injection via non-synchronizing
4+
literal in "raw" argument'
5+
comments: false
6+
categories:
7+
- net-imap
8+
advisory:
9+
gem: net-imap
10+
cve: 2026-47240
11+
ghsa: 8p34-64r3-mwg8
12+
url: https://www.cve.org/CVERecord?id=CVE-2026-47240
13+
title: 'Net::IMAP: Command Injection via non-synchronizing literal in "raw" argument'
14+
date: 2026-06-09
15+
description: |-
16+
Several Net::IMAP commands accept a "raw data" argument that is sent
17+
verbatim after validation to prevent command injection. However,
18+
if a server does not support non-synchronizing literals, it may
19+
still be possible to inject arbitrary IMAP commands inside
20+
non-synchronizing literals.
21+
22+
### Details
23+
24+
Raw data arguments support embedded literal values, both synchronizing
25+
and non-synchronizing. Non-synchronizing literals can only be safely
26+
sent when the server advertises any of the `LITERAL+`, `LITERAL-`, or
27+
`IMAP4rev2` capabilities. But raw data arguments do not verify server
28+
support for non-synchronizing literals prior to sending.
29+
30+
Servers without support for non-synchronizing literals could handle
31+
them in several different ways: If a server sees a `"}\r\n"` byte
32+
sequence but can't parse the literal bytesize, it _may_ cautiously
33+
decide to close the connection, blocking any command injection attacks.
34+
However, a server without support for non-synchronizing literals may
35+
instead interpret the `"+}\r\n"` as the end of a malformed command
36+
line and respond with a tagged `BAD`. In that case, the contents
37+
of the literal will be interpreted as one or more new pipelined
38+
commands, allowing a CRLF command injection attack to succeed.
39+
40+
This affects the following commands' string arguments:
41+
* `criteria` for `#search` and `#uid_search`
42+
* `search_keys` for `#sort`, `#thread`, `#uid_sort`, and `#uid_thread`
43+
* `attr` for `#fetch` and `#uid_fetch`
44+
45+
Prior to `net-imap` v0.6.4, v0.5.14, and v0.4.24, raw data arguments
46+
were not validated in _any_ way, so they were also vulnerable to
47+
this attack. See CVE-2026-42257 (GHSA-hm49-wcqc-g2xg).
48+
49+
### Impact
50+
51+
Fortunately, `LITERAL-` is supported by most modern IMAP servers. Even
52+
without support for non-synchronizing literals, cautious servers may
53+
handle invalid literal bytesize by closing the connection . However,
54+
servers which handle a non-synchronizing literal just like any other
55+
malformed command will enable this vulnerability.
56+
57+
If a developer passes an unvalidated user-controlled input for one
58+
of these method arguments, an attacker can append CRLF sequence
59+
followed by a new IMAP command (like DELETE mailbox). Although this
60+
does not directly enable data exfiltration, it could be combined with
61+
other attack vectors or knowledge of the target system's attributes,
62+
e.g.: shared mail folders or the application's installed response handlers.
63+
64+
### Mitigation
65+
66+
Update to a version of `net-imap` which validates server support
67+
for non-synchronizing literals before sending them.
68+
69+
If upgrading `net-imap` is not possible:
70+
* Explicitly validate user-controlled inputs to prevent embedded
71+
non-synchronizing literals unless the server supports them.
72+
* For a simpler, more cautious approach: all embedded literals can
73+
be unconditionally prohibited, by checking that string inputs
74+
do not contain any CR or LF bytes.
75+
* Verify that the server advertises any of the `LITERAL+`, `LITERAL-`,
76+
or `IMAP4rev2` capabilities before using untrusted string inputs
77+
for the affected "raw data" arguments.
78+
cvss_v3: 5.8
79+
patched_versions:
80+
- "~> 0.5.15"
81+
- ">= 0.6.4.1"
82+
related:
83+
url:
84+
- https://www.cve.org/CVERecord?id=CVE-2026-47240
85+
- https://rubygems.org/gems/net-imap/versions/0.6.4.1
86+
- https://github.com/ruby/net-imap/releases/tag/v0.6.4.1
87+
- https://github.com/ruby/net-imap/security/advisories/GHSA-8p34-64r3-mwg8
88+
- https://github.com/advisories/GHSA-8p34-64r3-mwg8
89+
notes: |
90+
- cve is reserved
91+
- cvss_v3 - in GHSA ; No cvss_v2, cvss_v4 values.
92+
---
Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
---
2+
layout: advisory
3+
title: 'CVE-2026-47241 (net-imap): Net::IMAP: Denial of Service via incomplete raw
4+
argument validation'
5+
comments: false
6+
categories:
7+
- net-imap
8+
advisory:
9+
gem: net-imap
10+
cve: 2026-47241
11+
ghsa: c4fp-cxrr-mj66
12+
url: https://www.cve.org/CVERecord?id=CVE-2026-47241
13+
title: 'Net::IMAP: Denial of Service via incomplete raw argument validation'
14+
date: 2026-06-09
15+
description: |-
16+
### Summary
17+
18+
Several Net::IMAP commands accept a raw string argument which is only
19+
validated to prevent CRLF injection and then sent verbatim. If this
20+
string is derived from user-controlled input, an attacker can force
21+
the next command to be absorbed as a continuation of the first command.
22+
This will cause the first command to eventually fail, but also prevents
23+
it from returning until another command is sent (from another thread).
24+
That other command will not return until the connection is closed.
25+
26+
### Details
27+
28+
`Net::IMAP::RawData` was hardened in v0.6.4, v0.5.14, and v0.4.24 to
29+
reject string arguments that would smuggle an invalid literal-continuation
30+
marker onto the wire (CVE-2026-42257, GHSA-hm49-wcqc-g2xg). But the
31+
trailing-marker check uses an incorrect regex which does not match
32+
`{0}` or `{0+}`, so an attacker-controlled seach `criteria` or fetch
33+
`attr` string ending in `{0}` or `{0+}` passes validation and is sent
34+
verbatim. Since these arguments are sent as the last argument in the
35+
command, they will be followed by CRLF. Although the CRLF was intended
36+
to end the command, the server will interpret it as part of a literal
37+
prefix. This consumes the next command the client puts on the socket
38+
as additional arguments to the current command.
39+
40+
This affects the following command's arguments:
41+
* `criteria` for `#search` and `#uid_search`
42+
* `search_keys` for `#sort`, `#thread`, `#uid_sort`, and `#uid_thread`
43+
* `attr` for `#fetch` and `#uid_fetch`
44+
45+
The command which contained the attacker's raw data will not be able
46+
to complete until the _next_ command is issued. If commands are only
47+
sent from single thread, the first command will hang until the connection
48+
times out (most likely by the server closing the connection).
49+
50+
If a second command is sent _(from another thread)_, this would allow
51+
the server to respond to the first command. This combined command
52+
_will_ be invalid:
53+
* The `{0}\\r\\n` literal prohibits other arguments (such as a quoted
54+
string) from spanning both commands
55+
* It will be sent without the space delimiter which is required
56+
between arguments.
57+
* The second command's tag will not be a valid argument to any of the
58+
vulnerable commands.
59+
60+
So the server _should_ respond to the first command with a `BAD` response,
61+
which will raise a `BadResponseError`.
62+
63+
But, since the server never saw a second command, the second command will
64+
never receive a tagged response and the thread that sent it will hang until
65+
the connection is closed.
66+
67+
### Impact
68+
69+
This will result in unexpected crashes and timeouts, which could be used
70+
to create a simple denial of service attack. This attack will present
71+
very similarly to common network issues or server issues which also result
72+
in commands hanging or unexpectedly raising exceptions. By itself, this
73+
does not allow command injection. But the confusion caused by these
74+
errors could lead to other downstream issues, especially in a
75+
multi-threaded environment.
76+
77+
### Mitigation
78+
79+
Update to a patched version of `net-imap` which validates that `RawData`
80+
arguments may not end with literal continuation markers.
81+
If `net-imap` cannot be upgraded:\n* Validate that user input to the
82+
affected command arguments does not end with `\"}\"`.
83+
* Use of `Timeout` or other standard strategies for slow connections
84+
and misbehaving servers will also mitigate the effects of this.
85+
86+
### Extra caution is required when issuing commands from multiple threads.
87+
88+
While `net-imap` does have rudimentary support for issuing commands
89+
from multiple threads, the user is responsible for synchronizing that
90+
commands are issued in a logically coherent order, and for ensuring
91+
that commands are only pipelined when it is safe to do so.
92+
93+
Practically, this means that many commands cannot be safely pipelined together,
94+
and user code will often need to wait for state changing commands to successfully
95+
complete before issuing commands that rely on that state change.
96+
cvss_v3: 2.1
97+
patched_versions:
98+
- "~> 0.5.15"
99+
- ">= 0.6.4.1"
100+
related:
101+
url:
102+
- https://www.cve.org/CVERecord?id=CVE-2026-47241
103+
- https://rubygems.org/gems/net-imap/versions/0.6.4.1
104+
- https://github.com/ruby/net-imap/releases/tag/v0.6.4.1
105+
- https://github.com/ruby/net-imap/security/advisories/GHSA-c4fp-cxrr-mj66
106+
- https://github.com/advisories/GHSA-c4fp-cxrr-mj66
107+
notes: |
108+
- cve is reserved
109+
- cvss_v3 - in GHSA ; No cvss_v2, cvss_v4 values.
110+
---
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
---
2+
layout: advisory
3+
title: 'CVE-2026-47242 (net-imap): Net::IMAP: Command Injection via ID command argument'
4+
comments: false
5+
categories:
6+
- net-imap
7+
advisory:
8+
gem: net-imap
9+
cve: 2026-47242
10+
ghsa: 46q3-7gv7-qmgg
11+
url: https://www.cve.org/CVERecord?id=CVE-2026-47242
12+
title: 'Net::IMAP: Command Injection via ID command argument'
13+
date: 2026-06-09
14+
description: |-
15+
### Summary
16+
17+
Two `Net::IMAP` commands, `#id` and `#enable`, do not validate their
18+
arguments. Arguments to either command could be used by an attacker
19+
to inject arbitrary IMAP commands.
20+
21+
Please note that passing untrusted inputs to these commands is usually
22+
inappropriate and expected to be uncommon.
23+
24+
### Details
25+
26+
When `Net::IMAP#id` is called with a hash argument, although the ID
27+
field value strings are correctly quoted (escaping quoted specials),
28+
they were not validated to prohibit CRLF sequences.
29+
30+
While `Net::IMAP#enable` does process its arguments for aliases, it
31+
does not validate them as valid atoms (or as a list of valid atoms).
32+
The `#to_s` value is sent verbatim.
33+
34+
### Impact
35+
36+
This is expected to impact very few users: use of untrusted user input
37+
for either command is expected to be very uncommon.
38+
39+
The documentation for `#enable` explicitly warns that using any arguments
40+
that are not in the explicitly supported list may result in undocumented
41+
behavior. Using arbitrary untrusted user input for `#enable` will always
42+
be inappropriate.
43+
44+
Although client ID field values will most commonly be static and hardcoded,
45+
dynamic input sources may be used. For example, client ID fields may be
46+
set by configuration or version numbers. Using untrusted user inputs
47+
for client ID fields is expected to be uncommon. But any untrusted
48+
inputs to client ID can trivially exploit this vulnerability.
49+
50+
Untrusted inputs to either command may include a CRLF sequence followed
51+
by a new IMAP command (like DELETE mailbox). Although this does not
52+
directly enable data exfiltration, it could be combined with other
53+
attack vectors or knowledge of the target system's attributes,
54+
e.g.: shared mail folders or the application's installed response handlers.
55+
56+
### Mitigation
57+
58+
Update to a version of `net-imap` which validates `#id` and `#enable`
59+
arguments.
60+
61+
Untrusted inputs should _never_ be used for `#enable` arguments.
62+
63+
If `net-imap` cannot be upgraded:
64+
* do not use untrusted inputs for client ID field values
65+
* or add validation that client ID field values must not contain
66+
any CR or LF bytes.
67+
cvss_v3: 4.3
68+
patched_versions:
69+
- "~> 0.5.15"
70+
- ">= 0.6.4.1"
71+
related:
72+
url:
73+
- https://www.cve.org/CVERecord?id=CVE-2026-47242
74+
- https://rubygems.org/gems/net-imap/versions/0.6.4.1
75+
- https://github.com/ruby/net-imap/releases/tag/v0.6.4.1
76+
- https://github.com/ruby/net-imap/security/advisories/GHSA-46q3-7gv7-qmgg
77+
- https://github.com/advisories/GHSA-46q3-7gv7-qmgg
78+
notes: |
79+
- cve is reserved
80+
- cvss_v3 - in GHSA ; No cvss_v2, cvss_v4 values.
81+
---

0 commit comments

Comments
 (0)