Skip to main content

libssh CVE-2026-59846

| EUVDEUVD-2026-46254 LOW
Command Injection (CWE-77)
2026-07-21 secalert@redhat.com GHSA-fvwj-j79q-57v7
3.9
CVSS 3.1 · Vendor: redhat
View

Attack ChainAIDerived

Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain

  1. Access
    Control SSH username input
  2. Delivery
    Embed shell metacharacters in username
  3. Exploit
    Initiate SSH connection via libssh ProxyCommand
  4. Execution
    libssh expands %r without sanitization
  5. Persist
    Shell interprets injected metacharacters
  6. Impact
    Environment 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.

Monitor Track and reassess. Why: LOW severity (CVSS 0.1-3.9).
Patch available 0.1% exploitation probability (EPSS)

Get an e-mail when this CVE is exploited, patched or re-scored. Free account.

Alert me

AnalysisAIv1 – 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

Vendor (redhat) PRIMARY 3.9 LOW
AV:L/AC:L/PR:L/UI:R/S:U/C:L/I:L/A:N
vuln.today AI 3.9 LOW

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.

3.1 AV:L/AC:L/PR:L/UI:R/S:U/C:L/I:L/A:N
4.0 AV:L/AC:L/AT:N/PR:L/UI:A/VC:L/VI:L/VA:N/SC:N/SI:N/SA:N

Primary rating from Vendor (redhat).

CVSS VectorVendor: redhat

Attack Vector
Local
Attack Complexity
Low
Privileges Required
Low
User Interaction
Required
Scope
Unchanged
Confidentiality
Low
Integrity
Low
Availability
None

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

EPSS Score
0.1%
Top 99% exploitable
Prevalence
Medium
SSH library used across many Linux tools and embedded systems
Data Quality
5 sources
Confidence: Medium

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.

SignalValue
Severity LOW
CISA KEV No
Public POC No
EPSS 0.1%
Patch available Yes
Active threat No
Deciding rule
LOW severity (CVSS 0.1-3.9)
What every action level means
Emergency Immediate action required. Criteria: CRITICAL + in CISA KEV (actively exploited) without patch, OR CRITICAL + EPSS > 30% without patch, OR CRITICAL + active threat signals without patch.
Act Now Prioritize within 24-48h. Criteria: in KEV with patch available, OR CRITICAL + public POC, OR HIGH + EPSS > 10%, OR CRITICAL + active threat, OR any CRITICAL severity.
This Week Schedule remediation this week. Criteria: HIGH severity (CVSS 7.0-8.9). Patch within normal change window.
This Month Plan within 30 days. Criteria: MEDIUM severity (CVSS 4.0-6.9), lower exploitation probability. Include in regular patch cycle.
Monitor Track and reassess. Criteria: LOW severity (CVSS 0.1-3.9), minimal exploitation risk. No immediate action needed.

SSVC AssessmentENISA

SSVC Decision· derived
Defer
Exploitation· derived
None
System Exposure· derived
Small
Automatable· derived
No
Human Impact· derived
Low

Priority Score

20
Low Medium High Critical
KEV: 0
EPSS: 0
CVSS: +20
PoC: 0
Weaponized: 0
Threat intel: 0
Gov advisory: 0

Attack Technique

OS command injection occurs when an application passes unsanitized user input directly into system shell commands.

Affected Products (CPE)CVE.org

cpe:2.3:a:libssh:libssh:-:*:*:*:*:*:*:*
cpe:2.3:a:redhat:hardened_images:-:*:*:*:*:*:*:*
cpe:2.3:o:redhat:enterprise_linux:8.0:*:*:*:*:*:*:*
cpe:2.3:o:redhat:enterprise_linux:9.0:*:*:*:*:*:*:*
cpe:2.3:o:redhat:enterprise_linux:10.0:*:*:*:*:*:*:*

More in Libssh

View all
CVE-2023-48795 MEDIUM POC
5.9 Dec 18

The SSH transport protocol with certain OpenSSH extensions, found in OpenSSH before 9.6 and other products, allows remot

CVE-2018-10933 CRITICAL POC
9.1 Oct 17

A vulnerability was found in libssh's server-side state machine before versions 0.7.6 and 0.8.4. Rated critical severity

CVE-2020-16135 MEDIUM POC
5.9 Jul 29

libssh 0.9.4 has a NULL pointer dereference in tftpserver.c if ssh_buffer_new returns NULL. Rated medium severity (CVSS

CVE-2012-4562 HIGH
7.5 Nov 30

Multiple integer overflows in libssh before 0.5.3 allow remote attackers to cause a denial of service (infinite loop or

CVE-2012-4560 HIGH
7.5 Nov 30

Multiple buffer overflows in libssh before 0.5.3 allow remote attackers to cause a denial of service (crash) or possibly

CVE-2025-5372 HIGH
8.8 Jul 04

Cryptographic key derivation failure in libssh versions prior to 0.11.2 (when built against OpenSSL older than 3.0) can

CVE-2019-14889 HIGH
8.8 Dec 10

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

CVE-2025-5987 HIGH
8.1 Jul 07

A flaw was found in libssh when using the ChaCha20 cipher with the OpenSSL library.

CVE-2015-3146 HIGH
7.5 Apr 13

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

CVE-2012-6063 HIGH
7.5 Nov 30

Double free vulnerability in the sftp_mkdir function in sftp.c in libssh before 0.5.3 allows remote attackers to cause a

CVE-2012-4559 MEDIUM
6.8 Nov 30

Multiple double free vulnerabilities in the (1) agent_sign_data function in agent.c, (2) channel_request function in cha

CVE-2026-15370 HIGH
7.3 Jul 21

Stack-based buffer overflow in libssh's SFTP server allows a connected client to crash the server or potentially execute

This site uses cookies essential for authentication and security. No tracking or analytics cookies are used. Privacy Policy