russh: negotiating a MAC-requiring block cipher (CTR/CBC) with mac=none causes a slice-index-out-of-range panic
### Summary `SshBlockCipher` implementations (AES-CBC, AES-CTR, 3DES-CBC, etc.) report `needs_mac() == true`, meaning they are documented/intended to always be paired with a separate integrity MAC. However, key-exchange negotiation only checks `needs_mac()` inside the *fallback* branch of MAC algorithm selection (used when no common MAC algorithm exists). If both peers' preferred MAC lists simply contain `none` and it is successfully negotiated through the normal selection path, nothing rejects pairing `none` with a cipher that requires a MAC. Once negotiated, a single crafted packet from either peer causes `cipher::read()` to shrink an already-allocated buffer below the number of bytes it is about to index, causing a Rust slice-index-out-of-range panic and killing that connection's task. ### Details In `russh/src/cipher/mod.rs`, `read()` for a block cipher: 1. Reads `packet_length_to_read_for_block_length()` bytes up front (16 bytes for any `SshBlockCipher`) into `buffer.buffer`. 2. Decrypts the first block to recover the plaintext packet-length field `len`. 3. Computes `buffer.len = len + cipher.tag_len()`. 4. Calls `buffer.buffer.resize(buffer.len + 4, 0)`. 5. Immediately indexes `buffer.buffer[16..]` (via the constant used for the first block read) to continue decrypting/reading the rest of the packet. When the negotiated MAC is `none`, `tag_len() == 0`. If the attacker (or a MITM holding the session key, or simply the accepting peer testing a hostile client) sends a pack
GHSA-p8qx-h547-fjw9
Primary source · Revision 1
Imported from structured advisory data. Source references identify upstream records or fields; verify affected versions and your deployed configuration.
Security context
Source reference: osv:GHSA-p8qx-h547-fjw9
russh
Source reference: /affected/0/package/name
- Affected versions
- Not stated in this record
- Fixed versions
- 0.63.1
Source reference:
/affected/0/ranges - Prerequisites
- Not stated in this record
Structured affected-version data
Original package identities and version rules from this source.
[
{
"ranges": [
{
"type": "SEMVER",
"events": [
{
"introduced": "0"
},
{
"fixed": "0.63.1"
}
]
}
],
"package": {
"name": "russh",
"purl": "pkg:cargo/russh",
"ecosystem": "crates.io"
},
"database_specific": {
"source": "https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/09/GHSA-p8qx-h547-fjw9/GHSA-p8qx-h547-fjw9.json",
"last_known_affected_version_range": "<= 0.63.0"
}
}
]- Related CVEs
- CVE-2026-102822
Source reference:
/aliases
Publisher severity
low
Source reference: /database_specific/severity
- Event
- #51899 · Revision 1
- Added to Heist Feed
- Publisher date