|
| 1 | +--- |
| 2 | +gem: dalli |
| 3 | +ghsa: 5xvx-r8rg-5qm2 |
| 4 | +url: https://github.com/petergoldstein/dalli/security/advisories/GHSA-5xvx-r8rg-5qm2 |
| 5 | +title: A quiet block, an interrupted get_multi, or a value containing CR/LF |
| 6 | + can return another key's value |
| 7 | +date: 2026-10-28 |
| 8 | +description: | |
| 9 | + Three ways a connection can get out of step with memcached, so that a |
| 10 | + request reads the reply meant for a different request. Reads can then |
| 11 | + return another key's value, which can expose one user's cached data to |
| 12 | + another. |
| 13 | +
|
| 14 | + 1. A `quiet` (or `multi`) block on one thread or fiber. memcached still |
| 15 | + replies to a quiet request that fails, for example an `add` of a key |
| 16 | + that already exists. If another thread or fiber uses the same |
| 17 | + `Dalli::Client` while the block is open, its next request reads that |
| 18 | + reply as its own. This happens with the default options and a client |
| 19 | + shared across threads or fibers. Clients on 5.2 with |
| 20 | + `defer_drain: true` aren't affected. It affects every supported line, |
| 21 | + with both protocols; with the binary protocol (3.2 and 4.3) the |
| 22 | + connection stays out of step even after the block ends. |
| 23 | +
|
| 24 | + 2. A pipelined `get_multi` interrupted by a non-network exception (its |
| 25 | + block raising or breaking, `Timeout.timeout`, or a value that can't be |
| 26 | + deserialized). A later `get_multi` large enough to use the interleaved |
| 27 | + path parses the old replies first and leaves its own on the |
| 28 | + connection. It affects 4.3 and later. |
| 29 | +
|
| 30 | + 3. A value containing CR/LF, on 3.2 with `protocol: :meta`. 3.2's meta |
| 31 | + protocol read a value up to the first CRLF instead of by its size, so |
| 32 | + a stored value containing a crafted reply was returned for a later |
| 33 | + read of a different key, possibly with flags that cause it to be |
| 34 | + deserialized (Marshal by default). It affects 3.2.0 to 3.2.14 with |
| 35 | + `protocol: :meta`. |
| 36 | +
|
| 37 | + ### Workarounds |
| 38 | +
|
| 39 | + - Don't share a client across threads or fibers while using |
| 40 | + `quiet`/`multi`; use a connection pool. On 5.2, `defer_drain: true` |
| 41 | + avoids the first issue. |
| 42 | + - Avoid raising or breaking out of a `get_multi` block, and avoid |
| 43 | + wrapping `get_multi` in `Timeout.timeout`. |
| 44 | + - On 3.2, use the binary protocol (the default). |
| 45 | +patched_versions: |
| 46 | + - "~> 3.2.15" |
| 47 | + - "~> 4.3.9" |
| 48 | + - "~> 5.0.12" |
| 49 | + - "~> 5.1.6" |
| 50 | + - ">= 5.2.4" |
| 51 | +related: |
| 52 | + url: |
| 53 | + - https://github.com/petergoldstein/dalli/security/advisories/GHSA-5xvx-r8rg-5qm2 |
| 54 | + - https://github.com/petergoldstein/dalli/commit/322a496 |
| 55 | + - https://github.com/petergoldstein/dalli/commit/0a34a51 |
| 56 | + - https://rubygems.org/gems/dalli/versions/5.2.4 |
| 57 | + - https://github.com/petergoldstein/dalli/releases/tag/v5.2.4 |
| 58 | + - https://rubygems.org/gems/dalli/versions/5.1.6 |
| 59 | + - https://github.com/petergoldstein/dalli/releases/tag/v5.1.6 |
| 60 | + - https://rubygems.org/gems/dalli/versions/5.0.12 |
| 61 | + - https://github.com/petergoldstein/dalli/releases/tag/v5.0.12 |
| 62 | + - https://rubygems.org/gems/dalli/versions/4.3.9 |
| 63 | + - https://github.com/petergoldstein/dalli/releases/tag/v4.3.9 |
| 64 | + - https://rubygems.org/gems/dalli/versions/3.2.15 |
| 65 | + - https://github.com/petergoldstein/dalli/releases/tag/v3.2.15 |
| 66 | +notes: | |
| 67 | + - No CVE in GHSA. |
| 68 | + - "A CVE has been requested through GitHub but not yet |
| 69 | + assigned, so the entry has no cve: field." |
| 70 | + - No CVSS score in GHSA; GitHub severity is high. |
0 commit comments