CVE-2025-5318
📋 TL;DR
This vulnerability in libssh allows an authenticated remote attacker to trigger an out-of-bounds read in the sftp_handle function, potentially exposing sensitive memory contents or affecting service behavior. It affects libssh versions less than 0.11.2 and requires attacker authentication.
💻 Affected Systems
- libssh
⚠️ Risk & Real-World Impact
Worst Case
Remote authenticated attacker reads sensitive memory contents (passwords, keys, session data) leading to full system compromise or data exfiltration.
Likely Case
Information disclosure of limited memory regions, potentially exposing some sensitive data or causing service instability.
If Mitigated
Minimal impact with proper network segmentation, authentication controls, and monitoring in place.
🎯 Exploit Status
Requires authenticated SFTP access and specific conditions to trigger the out-of-bounds read.
🛠️ Fix & Mitigation
✅ Official Fix
Patch Version: 0.11.2 or later
Vendor Advisory: https://access.redhat.com/errata/RHSA-2025:18231
Restart Required: Yes
Instructions:
1. Update libssh to version 0.11.2 or later using your package manager. 2. Restart services using libssh. 3. Verify the update was successful.
🔧 Temporary Workarounds
Disable SFTP
linuxDisable SFTP functionality if not required
# Configure SSH server to disable SFTP subsystem
# In sshd_config: Subsystem sftp internal-sftp # Comment out or remove
Restrict SFTP Access
linuxLimit SFTP access to trusted users only
# In sshd_config: Match User trusted_user
ForceCommand internal-sftp
ChrootDirectory /var/sftp
🧯 If You Can't Patch
- Implement strict network segmentation to isolate vulnerable systems
- Enforce strong authentication and limit SFTP access to minimal required users
🔍 How to Verify
Check if Vulnerable:
Check libssh version: ssh -V 2>&1 | grep -i libssh or dpkg -l | grep libssh
Check Version:
ssh -V 2>&1 | grep -o 'libssh_[0-9.]*'
Verify Fix Applied:
Verify libssh version is 0.11.2 or later: ssh -V 2>&1 | grep 'libssh_0\.1[1-9]\|libssh_1\.'
📡 Detection & Monitoring
Log Indicators:
- Unusual SFTP connection patterns
- Multiple failed authentication attempts followed by SFTP access
- System logs showing memory access errors
Network Indicators:
- Anomalous SFTP traffic patterns
- Unexpected data exfiltration over SFTP
SIEM Query:
source="sshd" AND "sftp" AND ("error" OR "failed" OR "invalid")
🔗 References
- https://access.redhat.com/errata/RHSA-2025:18231
- https://access.redhat.com/errata/RHSA-2025:18275
- https://access.redhat.com/errata/RHSA-2025:18286
- https://access.redhat.com/errata/RHSA-2025:19012
- https://access.redhat.com/errata/RHSA-2025:19098
- https://access.redhat.com/errata/RHSA-2025:19101
- https://access.redhat.com/errata/RHSA-2025:19295
- https://access.redhat.com/errata/RHSA-2025:19300
- https://access.redhat.com/errata/RHSA-2025:19313
- https://access.redhat.com/errata/RHSA-2025:19400
- https://access.redhat.com/errata/RHSA-2025:19401
- https://access.redhat.com/errata/RHSA-2025:19470
- https://access.redhat.com/errata/RHSA-2025:19472
- https://access.redhat.com/errata/RHSA-2025:19807
- https://access.redhat.com/errata/RHSA-2025:19864
- https://access.redhat.com/errata/RHSA-2025:20943
- https://access.redhat.com/errata/RHSA-2025:21013
- https://access.redhat.com/errata/RHSA-2025:21329
- https://access.redhat.com/errata/RHSA-2025:21829
- https://access.redhat.com/errata/RHSA-2025:22275
- https://access.redhat.com/errata/RHSA-2025:23078
- https://access.redhat.com/errata/RHSA-2025:23079
- https://access.redhat.com/errata/RHSA-2025:23080
- https://access.redhat.com/errata/RHSA-2026:0326
- https://access.redhat.com/errata/RHSA-2026:1541
- https://access.redhat.com/security/cve/CVE-2025-5318
- https://bugzilla.redhat.com/show_bug.cgi?id=2369131
- https://www.libssh.org/security/advisories/CVE-2025-5318.txt