CVE-2025-4877: Libssh: write beyond bounds in binary to base64 conversion functions
There's a vulnerability in the libssh package where when a libssh consumer passes in an unexpectedly large input buffer to ssh_get_fingerprint_hash() function. In such cases the bin_to_base64() function can experience an integer overflow leading to a memory under allocation, when that happens it's possible that the program perform out of bounds write leading to a heap corruption.
This issue affects only 32-bits builds of libssh.
Security readout for executives and security teams
Plain-English summary
CVE-2025-4877 is a libssh memory corruption flaw affecting only 32-bit builds. A program using libssh can write past allocated memory when handling an unexpectedly large fingerprint hash conversion input. Business risk is limited by local access, high attack complexity, and 32-bit scope, but affected servers should still be patched through vendor guidance.
Executive priority
Treat this as a scheduled patching item, not an emergency response, unless your environment still runs affected 32-bit RHEL 9 libssh deployments in sensitive workloads.
Technical view
The issue is an integer overflow in libssh bin_to_base64() reached through ssh_get_fingerprint_hash(). The overflow can cause under-allocation followed by an out-of-bounds heap write. The source bundle identifies CWE-787, CVSS 4.5, and affected Red Hat Enterprise Linux 9 libssh package version 0:0.10.4-18.el9, with only 32-bit builds affected.
Likely exposure
Exposure is most plausible on 32-bit systems or 32-bit builds of software linked against libssh. Red Hat lists RHEL 9 libssh 0:0.10.4-18.el9 as affected, while RHEL 8, RHEL 10, libssh2 on RHEL 6/7, and OpenShift Container Platform 4 are listed as unaffected.
Exploitation context
The provided data does not show active exploitation, and KEV status is false. Exploitation requires local access, low privileges, high attack complexity, and a libssh consumer passing an unexpectedly large buffer into the affected fingerprint function.
Researcher notes
Focus review on integer size handling around bin_to_base64() and ssh_get_fingerprint_hash(). The evidence names memory under-allocation and heap overwrite, but does not provide proof of exploitability beyond local, high-complexity conditions.
Mitigation direction
Apply Red Hat fixes from RHSA-2026:18683 where applicable.
Check libssh advisory and vendor guidance for upstream fixed versions.
Prioritize affected 32-bit builds over unaffected 64-bit deployments.
Rebuild or update software statically bundling affected libssh code.
Document exceptions where products are confirmed unaffected by vendor status.
Validation and detection
Inventory libssh packages and versions across hosts, containers, and appliances.
Confirm whether deployments use 32-bit builds or 32-bit compatibility packages.
Check SBOMs for bundled or statically linked libssh copies.
Map Red Hat assets against the affected and unaffected product list.
Verify patched package versions after applying vendor updates.
Generated from the cited source records. This long-tail analysis has not been individually reviewed by a named human.
Potential ATT&CK relevance
Conservative CVE-to-ATT&CK context
These mappings and lookup hints may be relevant to the vulnerability behavior, CWE, affected product, or exposure path. Glexia-inferred context is not an official MITRE, ATT&CK, CWE, or CVE Program mapping.
ATT&CK lookup starting points
Use these exact CWE pages and searches to review the Glexia ATT&CK library from this CVE's weakness and description context.
cwe · low confidence lookup
CWE-787: Exact CWE lookup
Use the exact CWE identifier as the starting point before reviewing related ATT&CK behavior. Open the exact CWE lookup page first, then review the ATT&CK searches from that MITRE weakness context. This is a Glexia lookup hint, not an official ATT&CK mapping.
The affected technology mentions containers, so container-specific ATT&CK technique review may help. This is a Glexia inferred lookup path, not an official MITRE, ATT&CK, or CVE Program mapping.
These fields come from the CVE record and ADP containers, not from Glexia's Take. They preserve time-varying source decisions such as CISA SSVC, KEV status, CVSS metrics, and provider references.
We collect every scored CVSS vector available in the official CNA and ADP containers. When more than one version is present, the table keeps the source vectors side by side instead of collapsing them into the highest score.
CWE links open Glexia weakness intelligence pages with official CWE context, developer remediation guidance, and related CVE mappings.
CWE-787 · source CWE mapping
Out-of-bounds Write
Out-of-bounds Write represents a recurring weakness pattern that can create exploitable paths when design, validation, or implementation controls are missing.