Skip to content

[Go v1.20] CVE-2025-22869: ssh: limit the size of the internal packet queue while waiting for KEX#1

Merged
germanparente merged 1 commit into
openshift-sustaining:sustaining-v0.33.0from
Atharva-Shinde:v0.33.0-sec
Jul 7, 2026
Merged

[Go v1.20] CVE-2025-22869: ssh: limit the size of the internal packet queue while waiting for KEX#1
germanparente merged 1 commit into
openshift-sustaining:sustaining-v0.33.0from
Atharva-Shinde:v0.33.0-sec

Conversation

@Atharva-Shinde

Copy link
Copy Markdown
git checkout tags/v0.33.0
git checkout -b v0.33.0-sec tags/v0.33.0
curl -L -o CVE.patch "https://go-review.googlesource.com/changes/crypto~652135/revisions/2/patch?download&raw"
git am CVE.patch

CVE.patch

In the SSH protocol, clients and servers execute the key exchange to
generate one-time session keys used for encryption and authentication.
The key exchange is performed initially after the connection is
established and then periodically after a configurable amount of data.
While a key exchange is in progress, we add the received packets to an
internal queue until we receive SSH_MSG_KEXINIT from the other side.
This can result in high memory usage if the other party is slow to
respond to the SSH_MSG_KEXINIT packet, or memory exhaustion if a
malicious client never responds to an SSH_MSG_KEXINIT packet during a
large file transfer.
We now limit the internal queue to 64 packets: this means 2MB with the
typical 32KB packet size.
When the internal queue is full we block further writes until the
pending key exchange is completed or there is a read or write error.

Thanks to Yuichi Watanabe for reporting this issue.

Change-Id: I1ce2214cc16e08b838d4bc346c74c72addafaeec
Reviewed-on: https://go-review.googlesource.com/c/crypto/+/652135
Reviewed-by: Neal Patel <nealpatel@google.com>
Auto-Submit: Gopher Robot <gobot@golang.org>
Reviewed-by: Roland Shoemaker <roland@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
@germanparente

Copy link
Copy Markdown

Looks good to me.
Merged.

@germanparente germanparente merged commit f3c4f7f into openshift-sustaining:sustaining-v0.33.0 Jul 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants