CVE-2025-5351 Libssh: double free vulnerability in libssh key export functions
A double free vulnerability in libssh key export functions can cause heap corruption and application instability, leading to denial of service.
- Exploited in the wild
- Not known
- Login needed
- Any signed-in user
- Attackable
- Over the internet
- Victim action needed
- Not needed
- Fix
- Available
What is CVE-2025-5351?
CVE-2025-5351 is a medium-severity use after free vulnerability in Redhat Enterprise Linux, published on 4 Jul 2025. Any signed-in user can exploit it over the network, with no action from the victim.
Official description
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.
Weakness: CWE-415
Which versions are affected by CVE-2025-5351?
It affects 3 products.
Products include Libssh Libssh, Redhat Enterprise Linux, Redhat Openshift Container Platform.
How do I fix CVE-2025-5351?
Apply the vendor's patch.
Upgrade to the fixed version. These bugs are found with fuzzing and sanitisers and avoided by memory-safe languages. More about Use after free.
Is CVE-2025-5351 being exploited?
There is no known exploitation of CVE-2025-5351 in the wild and no public exploit code.
Other vulnerabilities in Redhat Enterprise Linux
- CVE-2026-59851 Libssh: libssh: authentication bypass via missing gssapi principal check
- CVE-2025-5987 Libssh: invalid return code for chacha20 poly1305 with openssl backend
- CVE-2025-14821 Libssh: libssh: insecure default configuration leads to local man-in-the-middle attacks on windows
- CVE-2012-4560 Memory corruption in n/a
- CVE-2012-4562 Integer overflow in n/a
Sources
Also known as AZL-64653, AZL-64659, BELL-CVE-2025-5351, DEBIAN-CVE-2025-5351, GHSA-pfqf-mv4p-9j4r, JLSEC-2025-98 and 2 more.