Critical Memory Management Flaw in libssh: Potential Heap Corruption Risk

libssh Updated 03 Oct 2025

Summary

25/06/2025
N/A
Yes i
Medium
4.2

UBUNTU-CVE-2025-5351: A flaw was found in the key export functionality of libssh. Affects libssh versions < 0.10.6-2ubuntu0.1. Fixed in 0.10.6-2ubuntu0.1. How to fix ↓

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored Devnack Penetration testing for web, API and mobile Manual testing by engineers who build software, not an auditor's checklist. Trusted by teams at Swift and Google Talk to Devnack

Background

libssh is a widely used library that provides an implementation of the SSH (Secure Shell) protocol, allowing secure communication over unsecured networks. It is utilized in various applications for secure data transmission, remote command execution, and secure file transfers. The library's functionality is critical for maintaining the integrity and confidentiality of data in transit. However, a recently discovered vulnerability poses a significant risk to applications relying on libssh, particularly in low-memory scenarios.

Vulnerability Detail

A flaw was found in the key export functionality of libssh, specifically in the internal function responsible for converting cryptographic keys into serialized formats. During error handling, a memory structure is freed but not cleared, leading to a potential double free issue if an additional failure occurs later in the function. This condition may result in heap corruption or application instability, posing a risk to system reliability where key export operations are performed. The CVSS score for this vulnerability is 4.2, indicating a medium severity level.

How To Fix

Minimum fixed version

0.10.6-2ubuntu0.1

This is the first release that contains the fix.

sudo apt-get install --only-upgrade libssh

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Workaround

As a temporary measure, consider limiting the use of key export operations in low-memory environments until the package can be updated. Additionally, monitor application logs for any unusual behavior that may indicate instability due to this vulnerability.

Conclusion

The vulnerability in libssh presents a significant risk due to improper memory management during key export operations. It is crucial for users to update to the patched versions of the library to mitigate potential heap corruption and application instability. Utilizing tools like Vulert can help monitor for such vulnerabilities effectively.

See every vulnerability recorded for libssh →

Share this vulnerability

FAQ

The vulnerability involves a flaw in the key export functionality that can lead to heap corruption due to improper memory management during error handling.

You can use Vulert, which monitors and alerts for open-source vulnerabilities in your software. Check your application against the manifest file using the Vulert playground at Vulert Scanner.

The consequences may include application instability, heap corruption, and potential security risks in systems where key export operations are performed.

Yes, patches are available for both Ubuntu 24.04 LTS and Ubuntu 25.04. Updating to the specified versions will resolve the issue.

If immediate updates are not possible, limit the use of key export operations and monitor your application for any signs of instability.

Related vulnerabilities

Recent vulnerabilities recorded for libssh.

How To Fix

Minimum fixed version

0.10.6-2ubuntu0.1

This is the first release that contains the fix.

sudo apt-get install --only-upgrade libssh

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback