libssh CVE-2025-4878
LOWAttack ChainAIDerived
Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain
-
AccessLocal user access
-
DeliveryCraft non-existent key filename
-
ExploitCall privatekey_from_file() with crafted path
-
ExecutionTrigger uninitialized variable read
-
PersistHeap corruption or data leak
-
ImpactDisrupt SSH authentication or leak sensitive memory
Vulnerability Assessment
| Weakness |
CWE
ASVS 5.0
V15 - Secure Coding and Architecture Memory lifecycle management
MITRE ATT&CK
2 techniques across 2 tactics: Execution, Privilege Escalation The technique list with ATT&CK links and the kill-chain view is part of the Basic plan and up. |
| Exploitation Conditions | The vulnerability requires the following specific conditions: (1) libssh's privatekey_from_file() function must be called by an application with a filename parameter that references a non-existent file; (2) the caller must be a local user (not remote) with authenticated access to the system; (3) the application must not validate the filename before passing it to libssh. The flaw does NOT require non-default configuration or special compilation flags - it exists in standard libssh builds. However, exploitation is limited to scenarios where an attacker can influence the filename parameter passed to privatekey_from_file(). Applications that only load hardcoded or administrator-controlled key paths are not vulnerable. The high CVSS complexity factor (AC:H) reflects that heap layout must be in a particular state for meaningful exploitation; reliable exploitation of memory corruption is non-trivial without detailed knowledge of the target application's heap behavior. |
| Impact | Real-world risk is LOW to MODERATE despite the concerning CWE-416 (use-after-free). Multiple signals support this assessment: CVSS 3.6 is below the critical threshold, attack vector is LOCAL (not network-accessible), privilege requirement is LOW (authenticated user), and attack complexity is HIGH. The vulnerability requires an authenticated attacker with local access who can trigger a specific code path by providing a non-existent filename to an application using libssh's privatekey_from_file(). EPSS data is unavailable for comparison, but the combination of local-only access, authentication requirement, and high complexity significantly constrains real-world exploitability compared to a network-reachable use-after-free. KEV status is unknown, indicating this may not be actively exploited at scale. However, the CWE-416 classification is serious - use-after-free vulnerabilities can escalate to code execution under specific heap conditions, though the CVSS score (which omits code execution from the impact assessment) suggests the vendor assesses practical impact as limited to confidentiality and integrity of the SSH signing operation. Risk is elevated in scenarios where libssh handles untrusted filename inputs from local users, particularly in privilege-separated SSH utilities or configuration management tools. |
| Exploit ScenarioDerived | A local authenticated user on a system running an application that uses libssh (e.g., a configuration management tool or privilege-separated SSH utility) supplies a non-existent filename path to the application's key-loading functionality. The application calls libssh's privatekey_from_file() with this path, triggering the uninitialized variable condition. Depending on heap state, the attacker may leak sensitive data from memory or corrupt heap structures, potentially disrupting SSH authentication or triggering a crash. While direct remote exploitation is not possible, a local attacker could chain this with other vectors to escalate privileges or disrupt services. |
Get an e-mail when this CVE is exploited, patched or re-scored. Free account.
Alert meAnalysisAIv1 – May 06, 2026
Uninitialized variable in libssh's privatekey_from_file() function can cause heap corruption or signing failures when a non-existent key file is specified, allowing local authenticated attackers to trigger memory corruption with potential for information disclosure. CVSS 3.6 reflects local attack vector and high complexity; exploitation requires authenticated access and specific file conditions.
RemediationAI
Apply the upstream fix by upgrading libssh to a version containing commit 697650caa97eaf7623924c75f9fcfec6dd423cd1 or b35ee876adc92a208d47194772e99f9c71e0bedb, or use the next stable release after these patches are integrated. For distribution packages, follow https://access.redhat.com/security/cve/CVE-2025-4878 for Red Hat/CentOS updates or equivalent vendor advisories for other distributions. If immediate patching is not possible, mitigate by ensuring that applications using libssh validate filenames before passing them to privatekey_from_file() and do not accept untrusted filename inputs from local users; however, this workaround relies on application-level validation and does not address the underlying library flaw. Additionally, restrict local access to systems running vulnerable libssh instances and apply the principle of least privilege to processes using libssh authentication.
Affected ProductsAI
libssh is affected in versions prior to the patches identified in commits 697650caa97eaf7623924c75f9fcfec6dd423cd1 and b35ee876adc92a208d47194772e99f9c71e0bedb. No specific version ranges are provided in the available data; however, the upstream commits represent the fixes. CPE identifiers for libssh should be checked against the Red Hat security advisory at https://access.redhat.com/security/cve/CVE-2025-4878 and the libssh advisory at https://www.libssh.org/security/advisories/CVE-2025-4878.txt for precise affected version ranges and distribution-specific patched versions.
Affects your stack
Find out whether the stacks and servers you run are on an affected version.
Checking this CVE against your own stacks and servers is part of the Basic plan and up.
Technical ContextAI · show details
libssh is a C SSH client library that implements the SSH protocol for secure remote shell access. The vulnerability exists in the privatekey_from_file() function, which handles loading private key files for authentication. When a filename parameter references a non-existent file, the function fails to properly initialize a variable before use, creating a use-after-free (CWE-416) condition. This uninitialized memory can contain residual heap data, leading to either memory corruption when the uninitialized variable is dereferenced, or information disclosure if the uninitialized data is read. The flaw is particularly dangerous in multi-threaded environments or scenarios where heap state is predictable, as attackers may be able to influence what data resides in the uninitialized memory location.
Know when the next one hits your stack
- Watch products and get an email when something new is published
- Check this CVE against your own stack and servers
- Exploit and PoC references, threat intelligence from 22 sources
No credit card · 7-day full trial
Severity by source
AV:L/AC:H/PR:L/UI:N/S:U/C:L/I:L/A:N
Primary rating from Vendor (redhat) · only source for this CVE.
CVSS VectorVendor: redhat
DescriptionCVE.org
A vulnerability was found in libssh, where an uninitialized variable exists under certain conditions in the privatekey_from_file() function. This flaw can be triggered if the file specified by the filename doesn't exist and may lead to possible signing failures or heap corruption.
Threat Intelligence Overview
How this decision was reached
The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.
What every action level means
SSVC AssessmentENISA
Priority Score
Attack Technique
Use-after-free vulnerabilities occur when a program continues to access memory through a pointer after that memory has been deallocated.
Memory corruption occurs when a program writes data beyond the boundaries of allocated memory regions or accesses memory in unintended ways, violating the integrity of the process's address space.
Information disclosure occurs when an application unintentionally exposes sensitive data that aids attackers in reconnaissance or directly compromises security.
NVD
CVE.org
EPSS
GitHub PoC
Exploit-DB