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 medium-severity vulnerability identified in libssh version 0.10.0, specifically when using the ChaCha20 cipher in conjunction with the OpenSSL library. The flaw arises from improper error handling during heap exhaustion scenarios. When an attacker exhausts heap space, libssh fails to detect this condition properly because the OpenSSL error codes returned alias with the SSH_OK code. This causes libssh to mistakenly treat an error as a successful operation and proceed with a partially initialized cipher context. The consequence of this flawed error detection is undefined behavior, which can manifest as compromised data confidentiality and integrity or application crashes. The vulnerability is network exploitable (AV:N), requires high attack complexity (AC:H), low privileges (PR:L), and no user interaction (UI:N). The scope is unchanged (S:U), and the impact affects confidentiality, integrity, and availability to a low degree (C:L/I:L/A:L). This vulnerability affects Red Hat Enterprise Linux 10, which bundles libssh 0.10.0. No known exploits are currently in the wild, and no patches are explicitly linked in the provided data, indicating that mitigation may require vendor updates or configuration changes. The root cause is a subtle error code aliasing issue between OpenSSL and libssh, leading to improper error detection and subsequent use of insecure cipher contexts.
Potential Impact
For European organizations, this vulnerability poses a moderate risk primarily to systems running Red Hat Enterprise Linux 10 with libssh 0.10.0, especially those using SSH services with the ChaCha20 cipher enabled. The compromised cipher context could lead to partial exposure or corruption of sensitive data transmitted over SSH, undermining confidentiality and integrity. Additionally, the potential for crashes could disrupt availability of critical services relying on SSH for remote management or automated processes. While exploitation complexity is high and privileges required are low, the lack of user interaction needed means that automated or scripted attacks could be feasible once the heap exhaustion condition is met. Organizations in sectors such as finance, government, and critical infrastructure that rely heavily on secure SSH communications could face operational disruptions or data breaches if this vulnerability is exploited. However, the medium CVSS score and absence of known exploits suggest the threat is not immediate but warrants proactive mitigation.
Mitigation Recommendations
To mitigate CVE-2025-5987, European organizations should prioritize updating libssh to a patched version once available from Red Hat or the upstream project. In the interim, administrators should consider disabling the ChaCha20 cipher in SSH configurations to avoid triggering the vulnerable code path. Monitoring system logs for unusual heap exhaustion or SSH errors can help detect attempted exploitation. Employing resource limits to prevent heap exhaustion attacks and using intrusion detection systems tuned for anomalous SSH behavior can provide additional layers of defense. Furthermore, organizations should audit their SSH usage to ensure minimal exposure of vulnerable services, restrict SSH access via network segmentation and firewall rules, and enforce strict privilege controls to limit the impact of potential exploitation. Regular vulnerability scanning and penetration testing focused on SSH implementations can help identify residual risks.
Affected Countries
Germany, France, United Kingdom, Netherlands, Italy, Spain, Poland, Sweden
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 medium-severity vulnerability identified in libssh version 0.10.0, specifically when using the ChaCha20 cipher in conjunction with the OpenSSL library. The flaw arises from improper error handling during heap exhaustion scenarios. When an attacker exhausts heap space, libssh fails to detect this condition properly because the OpenSSL error codes returned alias with the SSH_OK code. This causes libssh to mistakenly treat an error as a successful operation and proceed with a partially initialized cipher context. The consequence of this flawed error detection is undefined behavior, which can manifest as compromised data confidentiality and integrity or application crashes. The vulnerability is network exploitable (AV:N), requires high attack complexity (AC:H), low privileges (PR:L), and no user interaction (UI:N). The scope is unchanged (S:U), and the impact affects confidentiality, integrity, and availability to a low degree (C:L/I:L/A:L). This vulnerability affects Red Hat Enterprise Linux 10, which bundles libssh 0.10.0. No known exploits are currently in the wild, and no patches are explicitly linked in the provided data, indicating that mitigation may require vendor updates or configuration changes. The root cause is a subtle error code aliasing issue between OpenSSL and libssh, leading to improper error detection and subsequent use of insecure cipher contexts.
Potential Impact
For European organizations, this vulnerability poses a moderate risk primarily to systems running Red Hat Enterprise Linux 10 with libssh 0.10.0, especially those using SSH services with the ChaCha20 cipher enabled. The compromised cipher context could lead to partial exposure or corruption of sensitive data transmitted over SSH, undermining confidentiality and integrity. Additionally, the potential for crashes could disrupt availability of critical services relying on SSH for remote management or automated processes. While exploitation complexity is high and privileges required are low, the lack of user interaction needed means that automated or scripted attacks could be feasible once the heap exhaustion condition is met. Organizations in sectors such as finance, government, and critical infrastructure that rely heavily on secure SSH communications could face operational disruptions or data breaches if this vulnerability is exploited. However, the medium CVSS score and absence of known exploits suggest the threat is not immediate but warrants proactive mitigation.
Mitigation Recommendations
To mitigate CVE-2025-5987, European organizations should prioritize updating libssh to a patched version once available from Red Hat or the upstream project. In the interim, administrators should consider disabling the ChaCha20 cipher in SSH configurations to avoid triggering the vulnerable code path. Monitoring system logs for unusual heap exhaustion or SSH errors can help detect attempted exploitation. Employing resource limits to prevent heap exhaustion attacks and using intrusion detection systems tuned for anomalous SSH behavior can provide additional layers of defense. Furthermore, organizations should audit their SSH usage to ensure minimal exposure of vulnerable services, restrict SSH access via network segmentation and firewall rules, and enforce strict privilege controls to limit the impact of potential exploitation. Regular vulnerability scanning and penetration testing focused on SSH implementations can help identify residual risks.
Affected Countries
For access to advanced analysis and higher rate limits, contact root@offseq.com
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: 9/26/2025, 12:40:19 AM
Last updated: 10/6/2025, 4:24:51 PM
Views: 42
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-61766: CWE-674: Uncontrolled Recursion in weirdgloop mediawiki-extensions-Bucket
MediumCVE-2025-57247: n/a
HighCVE-2025-0038: CWE-1284 - Improper Validation of Specified Quantity in Input in AMD Kria(TM) SOM
MediumCVE-2025-61765: CWE-502: Deserialization of Untrusted Data in miguelgrinberg python-socketio
MediumCVE-2025-11338: Buffer Overflow in D-Link DI-7100G C1
HighActions
Updates to AI analysis are available only with a Pro account. Contact root@offseq.com for access.
Need enhanced features?
Contact root@offseq.com for Pro access with improved analysis and higher rate limits.