CVE-2026-15370: Libssh: libssh: stack buffer overflow in sftp server longname construction
A flaw was found in libssh server-side SFTP directory listing. In processreaddir() in src/sftpserver.c, the server allocates a fixed stack buffer as char longname[MAXLONGNAMELEN] and passes attacker-controlled directory entry names into readdirlongname(). In the pre-patch implementation, readdirlongname() appends metadata and the filename into zlongname with repeated unbounded strcat() calls. Because zlongname points at the caller-owned fixed stack buffer, sufficiently long filenames in an attacker-controlled directory can overflow that stack buffer during SSHFXPREADDIR processing, leading to crashes and possible code execution on the server.
Other sources
A flaw was found in libssh. During SFTP server directory listing, the longname field is constructed with unsafe concatenation into a fixed-size stack buffer. When a client causes the server to list attacker-controlled filenames, sufficiently long names can overflow that stack buffer and may lead to crashes or possible code execution on the server.
— MITRE
Affected Software
Event History
Frequently Asked Questions
What is the severity of CVE-2026-15370?
CVE-2026-15370 has a medium severity rating of 6.7.
How do I fix CVE-2026-15370?
To fix CVE-2026-15370, ensure that you update to the latest patched version of libssh.
What is the impact of CVE-2026-15370?
CVE-2026-15370 enables a stack buffer overflow, which can lead to information leakage or code execution due to attacker-controlled input.
Is CVE-2026-15370 exploitable remotely?
Yes, CVE-2026-15370 is remotely exploitable due to its nature in the server-side SFTP directory listing.
Which software is affected by CVE-2026-15370?
CVE-2026-15370 affects the libssh library.