CVE-2025-4877

4.5 MEDIUM

📋 TL;DR

A heap corruption vulnerability in 32-bit builds of libssh occurs when ssh_get_fingerprint_hash() receives an unexpectedly large input buffer, causing integer overflow in bin_to_base64() leading to memory under-allocation and out-of-bounds writes. This affects applications using vulnerable libssh versions for SSH fingerprint operations. Only 32-bit architectures are impacted.

💻 Affected Systems

Products:
  • libssh
Versions: libssh versions before the fix in stable-0.11 branch
Operating Systems: Any OS running 32-bit libssh builds
Default Config Vulnerable: ⚠️ Yes
Notes: Only affects 32-bit builds. 64-bit builds are not vulnerable. Applications must call ssh_get_fingerprint_hash() with large input buffers to trigger.

⚠️ Manual Verification Required

This CVE does not have specific version information in our database, so automatic vulnerability detection cannot determine if your system is affected.

Why? The CVE database entry doesn't specify which versions are vulnerable (no version ranges provided by the vendor/NVD).

🔒 Custom verification scripts are available for registered users. Sign up free to download automated test scripts.

Recommended Actions:
  1. Review the CVE details at NVD
  2. Check vendor security advisories for your specific version
  3. Test if the vulnerability is exploitable in your environment
  4. Consider updating to the latest version as a precaution

⚠️ Risk & Real-World Impact

🔴

Worst Case

Remote code execution or denial of service through heap corruption leading to application crash or arbitrary code execution.

🟠

Likely Case

Application crash or instability when processing malformed SSH fingerprint data.

🟢

If Mitigated

Minimal impact with proper input validation and memory protection mechanisms in place.

🌐 Internet-Facing: MEDIUM - SSH services are commonly internet-facing, but exploitation requires specific conditions and 32-bit architecture.
🏢 Internal Only: LOW - Internal systems less likely to process malicious fingerprint data, and many modern systems use 64-bit.

🎯 Exploit Status

Public PoC: ✅ No
Weaponized: UNKNOWN
Unauthenticated Exploit: ✅ No
Complexity: MEDIUM

Exploitation requires control over input to ssh_get_fingerprint_hash() and specific memory layout conditions. No public exploits known.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: libssh stable-0.11 branch with commit 6fd9cc8ce3958092a1aae11f1f2e911b2747732d

Vendor Advisory: https://www.libssh.org/security/advisories/CVE-2025-4877.txt

Restart Required: No

Instructions:

1. Update libssh to patched version from official repository. 2. Recompile applications linking against libssh. 3. No service restart needed for library updates.

🔧 Temporary Workarounds

Migrate to 64-bit

all

Switch to 64-bit builds of libssh and applications, as vulnerability only affects 32-bit.

Recompile with -m64 flag or use 64-bit packages

Input validation

all

Add bounds checking before calling ssh_get_fingerprint_hash() in application code.

Implement size validation in application source code

🧯 If You Can't Patch

  • Restrict access to SSH services using libssh to trusted networks only.
  • Implement application-level input validation for SSH fingerprint operations.

🔍 How to Verify

Check if Vulnerable:

Check libssh version and architecture: ldd --version | grep libssh && file /usr/lib/libssh.so.4

Check Version:

ssh -V 2>&1 | grep libssh || dpkg -l | grep libssh || rpm -qa | grep libssh

Verify Fix Applied:

Verify libssh version contains commit 6fd9cc8ce3958092a1aae11f1f2e911b2747732d: git log --oneline | grep 6fd9cc8

📡 Detection & Monitoring

Log Indicators:

  • Application crashes or segmentation faults in libssh-related processes
  • Unexpected memory allocation failures

Network Indicators:

  • Unusual SSH fingerprint requests with large data payloads

SIEM Query:

process:crash AND module:libssh* OR event_id:1000 AND source:application AND fault_module:libssh

🔗 References

📤 Share & Export