CVE-2025-5351: Libssh: double free vulnerability in libssh key export functions

Published May 30, 2025
·
Updated

A Double Free vulnerability exists in libssh’s key export mechanism when built against OpenSSL 3.0 or later. The flaw lies in the pkikeytoblob() function, where a memory structure (params) is deallocated during error handling but not properly nullified. If a subsequent operation encounters an error, the same structure may be freed again, leading to undefined behavior and potential process crashes. Although exploitation requires authenticated access and specific memory failure conditions, the flaw could be leveraged to destabilize applications using libssh for exporting SSH key material.

Affected versions : libssh >= 0.10.0, built with OpenSSL >= 3.0

Other sources

A flaw was found in the key export functionality of libssh. The issue occurs 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 in low-memory scenarios, posing a risk to system reliability where key export operations are performed.

MITRE

Libssh: double free vulnerability in libssh key export functions

Microsoft

Affected Software

14 affected componentsFixes available
libssh libssh>=0.10.0
OpenSSL OpenSSL>=3.0
libssh libssh>=0.10.0<0.11.2
redhat OpenShift Container Platform=4.0
redhat Enterprise Linux=6.0
redhat Enterprise Linux=7.0
redhat Enterprise Linux=8.0
redhat Enterprise Linux=9.0
redhat Enterprise Linux=10.0
Microsoft cbl2 libssh 0.10.6-1
Microsoft cbl2 libssh 0.10.6-1
Microsoft azl3 libssh 0.10.6-1
Microsoft azl3 libssh 0.10.6-2
Microsoft cbl2 libssh 0.10.6-2

Event History

May 30, 2025
Data Sourced
via Red Hat·07:17 AM
DescriptionSeverityAffected Software
Jul 4, 2025
CVE Published
via MITRE·08:16 AM
Data Sourced
via MITRE·08:16 AM
DescriptionSeverityWeakness
Data Sourced
via NVD·09:15 AM
DescriptionSeverityWeaknessAffected Software
Jul 17, 2025
Data Sourced
via Microsoft·07:00 AM
DescriptionSeverityWeakness
Data Sourced
via Microsoft·07:00 AM
Affected Software
Updated
via Microsoft·07:00 AM
SeverityAffected Software
Updated
via Microsoft·07:00 AM
Affected Software
Updated
via Microsoft·07:00 AM
DescriptionSeverity

Frequently Asked Questions

1

What is the severity of CVE-2025-5351?

CVE-2025-5351 is classified as a critical severity vulnerability due to its potential to cause memory corruption.

2

How do I fix CVE-2025-5351?

To fix CVE-2025-5351, ensure you update libssh and OpenSSL to the latest versions that contain the patch.

3

Which versions are affected by CVE-2025-5351?

CVE-2025-5351 affects libssh versions starting from 0.10.0 and OpenSSL versions starting from 3.0.

4

What should I do if I cannot upgrade due to compatibility issues related to CVE-2025-5351?

If you cannot upgrade, you should apply any available mitigations or workarounds as outlined by the vendor until an upgrade is possible.

5

Is it safe to use OpenSSL 3.0 with libssh given CVE-2025-5351?

Using OpenSSL 3.0 with libssh is not safe without applying the necessary patches for CVE-2025-5351.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203