CVE-2025-5987: Return of Wrong Status Code
A flaw was found in libssh when using the ChaCha20 cipher with the OpenSSL library. If an attacker manages to exhaust the heap space, this error is not detected and may lead to libssh using a partially initialized cipher context. This occurs because the OpenSSL error code returned aliases with the SSH_OK code, resulting in libssh not properly detecting the error returned by the OpenSSL library. This issue can lead to undefined behavior, including compromised data confidentiality and integrity or crashes.
AI Analysis
Technical Summary
CVE-2025-5987 is a vulnerability discovered in libssh version 0.10.0, specifically when the ChaCha20 cipher is used in conjunction with the OpenSSL library. The root cause is a flaw in error handling: when heap exhaustion occurs during cipher initialization, OpenSSL returns an error code that aliases with SSH_OK. Libssh fails to detect this error due to this aliasing, leading it to proceed with a partially initialized cipher context. This improper initialization can cause undefined behavior, including compromised confidentiality and integrity of SSH communications or application crashes. The vulnerability is network exploitable without requiring authentication or user interaction, but the attack complexity is high due to the need to exhaust heap memory remotely. The affected product is Red Hat Enterprise Linux 10, which bundles libssh 0.10.0. The CVSS v3.1 base score is 8.1, indicating a high severity with impacts on confidentiality, integrity, and availability. No known exploits have been reported in the wild yet, but the flaw presents a serious risk for secure communications relying on libssh and OpenSSL with ChaCha20 cipher. The vulnerability was published on July 7, 2025, with Red Hat as the vendor project. The issue highlights the importance of proper error code handling when integrating cryptographic libraries to avoid subtle security flaws.
Potential Impact
The vulnerability can lead to severe impacts on European organizations that use Red Hat Enterprise Linux 10 with libssh 0.10.0, particularly those employing the ChaCha20 cipher for SSH communications. Exploitation could allow attackers to compromise the confidentiality and integrity of data transmitted over SSH, potentially exposing sensitive information or enabling unauthorized command execution. Additionally, the undefined behavior may cause application or service crashes, leading to denial of service conditions. This is especially critical for sectors such as finance, government, healthcare, and critical infrastructure where secure remote access is essential. The high severity and network exploitability without authentication increase the risk profile. Organizations relying on automated SSH-based management or remote access could face operational disruptions and data breaches. The lack of current known exploits provides a window for proactive mitigation, but the potential impact warrants urgent attention.
Mitigation Recommendations
1. Apply official patches from Red Hat as soon as they are released to address CVE-2025-5987. 2. Until patches are available, consider disabling the ChaCha20 cipher in libssh configurations to prevent triggering the vulnerable code path. 3. Monitor SSH service logs and system memory usage to detect abnormal heap exhaustion attempts that could indicate exploitation attempts. 4. Restrict network access to SSH services using firewalls and network segmentation to limit exposure to untrusted networks. 5. Employ intrusion detection systems (IDS) with signatures or heuristics targeting unusual SSH behavior or heap exhaustion patterns. 6. Conduct regular security audits and vulnerability scans to identify systems running vulnerable libssh versions. 7. Educate system administrators about this vulnerability and encourage prompt response to security advisories. 8. Consider deploying application-layer mitigations such as rate limiting SSH connection attempts to reduce attack surface. These measures collectively reduce the risk of exploitation and limit potential damage.
Affected Countries
Germany, France, United Kingdom, Netherlands, Italy, Spain, Poland
CVE-2025-5987: Return of Wrong Status Code
Description
A flaw was found in libssh when using the ChaCha20 cipher with the OpenSSL library. If an attacker manages to exhaust the heap space, this error is not detected and may lead to libssh using a partially initialized cipher context. This occurs because the OpenSSL error code returned aliases with the SSH_OK code, resulting in libssh not properly detecting the error returned by the OpenSSL library. This issue can lead to undefined behavior, including compromised data confidentiality and integrity or crashes.
AI-Powered Analysis
Technical Analysis
CVE-2025-5987 is a vulnerability discovered in libssh version 0.10.0, specifically when the ChaCha20 cipher is used in conjunction with the OpenSSL library. The root cause is a flaw in error handling: when heap exhaustion occurs during cipher initialization, OpenSSL returns an error code that aliases with SSH_OK. Libssh fails to detect this error due to this aliasing, leading it to proceed with a partially initialized cipher context. This improper initialization can cause undefined behavior, including compromised confidentiality and integrity of SSH communications or application crashes. The vulnerability is network exploitable without requiring authentication or user interaction, but the attack complexity is high due to the need to exhaust heap memory remotely. The affected product is Red Hat Enterprise Linux 10, which bundles libssh 0.10.0. The CVSS v3.1 base score is 8.1, indicating a high severity with impacts on confidentiality, integrity, and availability. No known exploits have been reported in the wild yet, but the flaw presents a serious risk for secure communications relying on libssh and OpenSSL with ChaCha20 cipher. The vulnerability was published on July 7, 2025, with Red Hat as the vendor project. The issue highlights the importance of proper error code handling when integrating cryptographic libraries to avoid subtle security flaws.
Potential Impact
The vulnerability can lead to severe impacts on European organizations that use Red Hat Enterprise Linux 10 with libssh 0.10.0, particularly those employing the ChaCha20 cipher for SSH communications. Exploitation could allow attackers to compromise the confidentiality and integrity of data transmitted over SSH, potentially exposing sensitive information or enabling unauthorized command execution. Additionally, the undefined behavior may cause application or service crashes, leading to denial of service conditions. This is especially critical for sectors such as finance, government, healthcare, and critical infrastructure where secure remote access is essential. The high severity and network exploitability without authentication increase the risk profile. Organizations relying on automated SSH-based management or remote access could face operational disruptions and data breaches. The lack of current known exploits provides a window for proactive mitigation, but the potential impact warrants urgent attention.
Mitigation Recommendations
1. Apply official patches from Red Hat as soon as they are released to address CVE-2025-5987. 2. Until patches are available, consider disabling the ChaCha20 cipher in libssh configurations to prevent triggering the vulnerable code path. 3. Monitor SSH service logs and system memory usage to detect abnormal heap exhaustion attempts that could indicate exploitation attempts. 4. Restrict network access to SSH services using firewalls and network segmentation to limit exposure to untrusted networks. 5. Employ intrusion detection systems (IDS) with signatures or heuristics targeting unusual SSH behavior or heap exhaustion patterns. 6. Conduct regular security audits and vulnerability scans to identify systems running vulnerable libssh versions. 7. Educate system administrators about this vulnerability and encourage prompt response to security advisories. 8. Consider deploying application-layer mitigations such as rate limiting SSH connection attempts to reduce attack surface. These measures collectively reduce the risk of exploitation and limit potential damage.
Affected Countries
Technical Details
- Data Version
- 5.1
- Assigner Short Name
- redhat
- Date Reserved
- 2025-06-10T21:55:45.552Z
- Cvss Version
- 3.1
- State
- PUBLISHED
Threat ID: 686bdc1a6f40f0eb72e9f8ac
Added to database: 7/7/2025, 2:39:22 PM
Last enriched: 1/30/2026, 9:21:14 AM
Last updated: 2/3/2026, 1:03:46 PM
Views: 99
Community Reviews
0 reviewsCrowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.
Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.
Related Threats
CVE-2025-7760: CWE-79 Improper Neutralization of Input During Web Page Generation (XSS or 'Cross-site Scripting') in Ofisimo Web-Based Software Technologies Association Web Package Flora
HighCVE-2025-6397: CWE-79 Improper Neutralization of Input During Web Page Generation (XSS or 'Cross-site Scripting') in Ankara Hosting Website Design Website Software
HighCVE-2026-1664: CWE-639 Authorization Bypass Through User-Controlled Key
MediumCVE-2025-11598: CWE-359 Exposure of Private Personal Information to an Unauthorized Actor in Centralny Ośrodek Informatyki mObywatel
LowCVE-2026-1432: CWE-89 Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') in T-Systems Buroweb
CriticalActions
Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.
Need more coverage?
Upgrade to Pro Console in Console -> Billing for AI refresh and higher limits.
For incident response and remediation, OffSeq services can help resolve threats faster.