Cloudanix VulnDB

CVE-2025-5318

Medium · 5.4

CVSS

5.4

EPSS

1.9%

Published

Jun 24, 2025

CISA due date

—

Cloudanix analysis

Monitor only SSVC: Track

A bug in software that handles secure file transfers can let people who already have login access read private memory or interfere with the service.

Exploitation
Remote Authenticated
Attacker needs
Low Privilege
Complexity
Low
Impact
Data Exposure
Component
Library
Class
Buffer Overflow
Remediation
Upgrade
Effort
Medium
Patch risk
Low

What it actually does

Out-of-bounds read in sftp_handle due to incorrect bounds check on handle list, returning invalid pointer used in subsequent processing and allowing access to arbitrary memory.

Why it matters to the business

Organizations relying on libssh for SFTP or SSH services face risk of sensitive data exposure or degraded service behavior from authenticated remote users, increasing compliance and operational exposure.

How an attack unfolds

An authenticated remote attacker connects via SSH, initiates an SFTP session, and supplies a crafted handle that bypasses the faulty comparison, causing the library to dereference an out-of-bounds pointer and leak memory contents or alter execution flow.

How to fix it

Upgrade libssh to a version containing commit dff6c0821ed54f6fbf5b755af43f54cbb723b1b1 or later; for Mageia 6 cinnamon packages upgrade to 3.2.8-4.1.mga6 or newer. Recompile and redeploy any statically linked applications.

How to confirm the fix worked

Verify installed libssh version against fixed commit or package release; run regression tests exercising SFTP handle operations; confirm absence of the vulnerable comparison logic via source review or binary diff.

Typical attack path

  1. Establish authenticated SSH session to target service
  2. Open SFTP subsystem channel
  3. Send SFTP request containing invalid or out-of-range file handle
  4. Trigger sftp_handle processing path that performs incorrect bounds check
  5. Read returned pointer contents to obtain memory disclosure or induce behavioral change

How to detect it

Review SSH daemon and application logs for unusual SFTP session activity or handle-related errors around the time of suspected access; correlate with memory-leak indicators in process dumps if available.

What your security team should do

  • Immediately inventory all systems using libssh and schedule upgrades to the listed fixed versions
  • Prioritize patching internet-facing or high-value SSH/SFTP endpoints first
  • Monitor vendor advisories for downstream packages that embed libssh
  • Apply compensating controls such as network segmentation until patches are deployed

The record

A flaw was found in the libssh library in versions less than 0.11.2. An out-of-bounds read can be triggered in the sftp_handle function due to an incorrect comparison check that permits the function to access memory beyond the valid handle list and to return an invalid pointer, which is used in further processing. This vulnerability allows an authenticated remote attacker to potentially read unintended memory regions, exposing sensitive information or affect service behavior.

Affected packages

Ecosystem Package Introduced Fixed
AlmaLinux:10 libssh 0 0.11.1-4.el10_0
AlmaLinux:10 libssh 0 0.11.1-4.el10_1
AlmaLinux:10 libssh-config 0 0.11.1-4.el10_0
AlmaLinux:10 libssh-config 0 0.11.1-4.el10_1
AlmaLinux:10 libssh-devel 0 0.11.1-4.el10_0
AlmaLinux:10 libssh-devel 0 0.11.1-4.el10_1
AlmaLinux:8 libssh 0 0.9.6-15.el8_10
AlmaLinux:8 libssh-config 0 0.9.6-15.el8_10
AlmaLinux:8 libssh-devel 0 0.9.6-15.el8_10
AlmaLinux:9 libssh 0 0.10.4-15.el9_6
AlmaLinux:9 libssh 0 0.10.4-15.el9_7
AlmaLinux:9 libssh-config 0 0.10.4-15.el9_6
AlmaLinux:9 libssh-config 0 0.10.4-15.el9_7
AlmaLinux:9 libssh-devel 0 0.10.4-15.el9_6
AlmaLinux:9 libssh-devel 0 0.10.4-15.el9_7
Chainguard libssh 0 0.11.3-r0
Chainguard libssh-dev 0 0.11.3-r0
Chainguard libssh2 0 1.11.1-r1
Chainguard libssh2-dev 0 1.11.1-r1
Chainguard libssh2-doc 0 1.11.1-r1
Debian:11 libssh 0 No fix
Debian:12 libssh 0 No fix
Debian:13 libssh 0 No fix
Debian:14 libssh 0 0.11.2-1
SUSE:Linux Enterprise Module for Basesystem 15 SP6 libssh 0 0.9.8-150600.11.3.1
SUSE:Linux Enterprise Module for Basesystem 15 SP7 libssh 0 0.9.8-150600.11.3.1
SUSE:Linux Enterprise Server 12 SP5-LTSS libssh 0 0.6.3-12.15.1
SUSE:Linux Enterprise Server LTSS Extended Security 12 SP5 libssh 0 0.6.3-12.15.1
Wolfi libssh 0 0.11.3-r0
Wolfi libssh-dev 0 0.11.3-r0
Wolfi libssh2 0 1.11.1-r1
Wolfi libssh2-dev 0 1.11.1-r1
Wolfi libssh2-doc 0 1.11.1-r1
openSUSE:Leap 15.6 libssh 0 0.9.8-150600.11.3.1
openSUSE:Tumbleweed libssh 0 0.11.2-1.1

Related vulnerabilities