VYPR
Unrated severityNVD Advisory· Published Jun 17, 2026· Updated Jun 18, 2026

libssh2 - Out-of-Bounds Write via Unchecked packet_length in transport.c

CVE-2026-55200

Description

libssh2 through 1.11.1, fixed in commit 7acf3df contains an out-of-bounds write vulnerability in ssh2_transport_read() that fails to enforce upper bounds on packet_length field. Remote attackers can send crafted SSH packets with excessively large packet_length values to corrupt heap memory and achieve remote code execution.

AI Insight

LLM-synthesized narrative grounded in this CVE's description and references.

Affected products

1

Patches

Vulnerability mechanics

Root cause

"Missing upper-bound validation on the packet_length field in ssh2_transport_read() allows an out-of-bounds heap write."

Attack vector

A remote, unauthenticated attacker can send a crafted SSH handshake or protocol message where the `packet_length` field (the first 4 bytes of the packet) is set to a value larger than `LIBSSH2_PACKET_MAXPAYLOAD`. The vulnerable `ssh2_transport_read()` function trusts this value without an upper-bound check, leading to a heap buffer overflow. This can corrupt adjacent heap metadata and potentially achieve remote code execution. The precondition is only that the attacker can establish an SSH connection to a service using libssh2.

Affected code

The vulnerability resides in `ssh2_transport_read()` in `src/transport.c`. The function reads a `packet_length` field from the network but previously only checked that it was not less than 1; no upper-bound check existed, allowing an attacker to supply an arbitrarily large value that would cause an out-of-bounds write into heap memory.

What the fix does

The patch adds an `else if` branch in `ssh2_transport_read()` that returns `LIBSSH2_ERROR_OUT_OF_BOUNDARY` when `p->packet_length > LIBSSH2_PACKET_MAXPAYLOAD`. This rejects any packet whose declared length exceeds the maximum allowed payload size, preventing the subsequent code from using the attacker-controlled large value in a memory copy or allocation that would overflow the heap buffer.

Preconditions

  • networkThe attacker must be able to establish an SSH network connection to a service that uses libssh2.
  • inputThe attacker sends a crafted SSH packet with a packet_length field exceeding LIBSSH2_PACKET_MAXPAYLOAD.

Generated on Jun 18, 2026. Inputs: CWE entries + fix-commit diffs from this CVE's patches. Citations validated against bundle.

References

3

News mentions

0

No linked articles in our index yet.