Attack ChainAIDerived
Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain
-
AccessControl SSH username input
-
DeliveryEmbed shell metacharacters in username
-
ExploitInitiate SSH connection via libssh ProxyCommand
-
Executionlibssh expands %r without sanitization
-
PersistShell interprets injected metacharacters
-
ImpactEnvironment variables exposed to attacker
Vulnerability Assessment
| Weakness |
CWE
OWASP Top 10:2025
A05:2025 - Injection
ASVS 5.0
V1 - Encoding and Sanitization Command injection prevention
MITRE ATT&CK
1 technique across 1 tactic: Execution The technique list with ATT&CK links and the kill-chain view is part of the Basic plan and up. |
| Exploitation Conditions | Exploitation requires three concurrent conditions: (1) the target application must use libssh's ProxyCommand functionality with the %r remote-username token in the command template - configurations not using ProxyCommand or not using %r are not affected; (2) the attacker must control or influence the SSH username supplied to the libssh connection, either directly (e.g., as a local user running an SSH client) or indirectly through an application that forwards user-supplied usernames to libssh; (3) a legitimate user must actively initiate the SSH connection (UI:R), meaning passive or automated exploitation without user action is not possible. Exploitation is further limited to the connecting user's process environment - privilege escalation beyond the current user's context is not indicated. Non-default ProxyCommand configurations incorporating %r are required; standard SSH deployments without ProxyCommand directives are not vulnerable. |
| Impact | The CVSS 3.1 vector (AV:L/AC:L/PR:L/UI:R/S:U/C:L/I:L/A:N, score 3.9) places this firmly in the Low band. AV:L confirms the attack is local - remote exploitation is not directly possible without first obtaining local access or control over the SSH username input. PR:L means any low-privileged local user could craft the malicious username. UI:R is a meaningful constraint: a legitimate user must actively initiate an SSH connection through the affected ProxyCommand configuration, limiting opportunistic mass exploitation. The impact is bounded - C:L and I:L reflect environment variable disclosure and minor unintended shell behavior, not arbitrary root-level command execution or data destruction (A:N). No EPSS score is available in the provided data, and the vulnerability is neither in CISA KEV nor has a public POC identified, suggesting it was discovered through code review or security audit rather than active exploitation. Real-world priority is low-to-medium for most environments; however, deployments where libssh is used as a library within privileged ProxyCommand contexts (e.g., automated SSH jump-host tooling) warrant higher attention due to potential environment variable leakage of credentials or secrets. |
| Exploit ScenarioDerived | A local attacker crafts an SSH username containing shell metacharacters such as $(printenv) or $AWS_SECRET_ACCESS_KEY and presents this username to an application using libssh with a ProxyCommand that includes %r. When a legitimate user initiates an SSH connection through that configuration, libssh expands %r into the crafted username without sanitization, causing the shell executing the ProxyCommand to evaluate the injected expression and potentially write environment variable contents to a location the attacker can read. No public POC is identified at time of analysis. |
Get an e-mail when this CVE is exploited, patched or re-scored. Free account.
Alert meAnalysisAIv1 – Jul 21, 2026
Shell metacharacter injection in libssh's ProxyCommand handling allows a crafted SSH username to break out of the intended command string when the %r token is expanded. Affecting libssh deployments that use ProxyCommand with %r substitution, a low-privileged local attacker who controls the username passed to the connection can cause the shell executing the ProxyCommand to expand environment variables or alter its behavior, leaking sensitive environment data. No public exploit is identified and this is not listed in CISA KEV; CVSS rates this Low (3.9), consistent with the constrained local attack surface and limited impact.
RemediationAI
Apply the vendor-released patch for libssh as distributed through the Red Hat advisory at https://access.redhat.com/security/cve/CVE-2026-59846; the exact fixed version is not independently confirmed from the available data, and the Bugzilla entry at https://bugzilla.redhat.com/show_bug.cgi?id=2498179 should be monitored for fix version confirmation. As an immediate compensating control, audit all SSH client configurations that use ProxyCommand with %r expansion and replace %r with a hardcoded, trusted username where possible - this eliminates the injection vector but breaks dynamic username proxying workflows that legitimate multi-user jump-host setups may rely on. Alternatively, restrict which users can supply SSH usernames to ProxyCommand-using configurations, or wrap ProxyCommand execution in a script that sanitizes input before shell expansion. Avoid deploying libssh-based tooling in contexts where untrusted input directly influences the SSH username without sanitization.
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 library implementing the SSH protocol used by numerous Linux applications and embedded systems. ProxyCommand is an SSH configuration directive that routes connections through an intermediary shell command; the %r token within ProxyCommand strings is replaced with the remote (target) username at connection time. When libssh performs this expansion without sanitizing shell metacharacters in the username, characters such as $, $(), backticks, semicolons, or pipes are passed verbatim into the shell command string, causing the /bin/sh interpreter executing the ProxyCommand to perform unintended variable expansion or command substitution. CWE is not formally assigned in the available data, but the root cause aligns with CWE-78 (OS Command Injection via improper neutralization of special elements) or CWE-116 (Improper Encoding or Escaping of Output). The issue was reported by Red Hat's security team (secalert@redhat.com), suggesting it affects Red Hat-distributed builds of libssh.
Know when Libssh gets its next vulnerability
- 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:L/PR:L/UI:R/S:U/C:L/I:L/A:N
Local attack requiring low-privilege username control and user-initiated SSH connection; impact limited to environment variable disclosure and minor shell behavior alteration with no availability impact.
Primary rating from Vendor (redhat).
CVSS VectorVendor: redhat
DescriptionCVE.org
A flaw was found in libssh. A malicious username expanded through %r in ProxyCommand handling can inject shell metacharacters, exposing environment variables and causing unintended shell behavior.
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
OS command injection occurs when an application passes unsanitized user input directly into system shell commands.
Affected Products (CPE)CVE.org
The SSH transport protocol with certain OpenSSH extensions, found in OpenSSH before 9.6 and other products, allows remot
A vulnerability was found in libssh's server-side state machine before versions 0.7.6 and 0.8.4. Rated critical severity
libssh 0.9.4 has a NULL pointer dereference in tftpserver.c if ssh_buffer_new returns NULL. Rated medium severity (CVSS
Multiple integer overflows in libssh before 0.5.3 allow remote attackers to cause a denial of service (infinite loop or
Multiple buffer overflows in libssh before 0.5.3 allow remote attackers to cause a denial of service (crash) or possibly
Cryptographic key derivation failure in libssh versions prior to 0.11.2 (when built against OpenSSL older than 3.0) can
A flaw was found with the libssh API function ssh_scp_new() in versions before 0.9.3 and before 0.8.8. Rated high severi
A flaw was found in libssh when using the ChaCha20 cipher with the OpenSSL library.
The (1) SSH_MSG_NEWKEYS and (2) SSH_MSG_KEXDH_REPLY packet handlers in package_cb.c in libssh before 0.6.5 do not proper
Double free vulnerability in the sftp_mkdir function in sftp.c in libssh before 0.5.3 allows remote attackers to cause a
Multiple double free vulnerabilities in the (1) agent_sign_data function in agent.c, (2) channel_request function in cha
Stack-based buffer overflow in libssh's SFTP server allows a connected client to crash the server or potentially execute
EUVD-2026-46254
GHSA-fvwj-j79q-57v7
NVD
CVE.org
EPSS
VulDB
Exploit-DB