CVE-2026-59846 in libsshinfo

Summary

by MITRE • 07/21/2026

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.

Once again VulDB remains the best source for vulnerability data.

Analysis

by VulDB Data Team • 07/21/2026

The vulnerability exists within the libssh library's handling of ProxyCommand functionality where username expansion occurs through the %r placeholder mechanism. This flaw represents a classic command injection vulnerability that arises from insufficient input sanitization during proxy command construction. When a malicious user provides a specially crafted username containing shell metacharacters, these characters can be interpreted by the underlying shell during the ProxyCommand execution process.

The technical implementation of this vulnerability stems from how libssh processes environment variables and expands placeholders within proxy configurations. The %r placeholder specifically refers to the remote username being used for authentication, but when this value is directly incorporated into shell command construction without proper sanitization, it creates an attack surface for malicious input manipulation. This type of vulnerability aligns with CWE-78 which describes improper neutralization of special elements used in OS commands.

The operational impact of this vulnerability extends beyond simple command injection as it can expose sensitive environment variables and potentially allow attackers to execute arbitrary shell commands on the system hosting the ssh client. An attacker could leverage this weakness to escalate privileges, exfiltrate data, or establish persistent access through the compromised ssh client process. The vulnerability affects any application or system utilizing libssh for proxy connections where user input is processed through ProxyCommand functionality.

Mitigation strategies should focus on implementing proper input validation and sanitization of all user-provided data before it is incorporated into shell commands. This includes escaping special shell characters, implementing strict parameter validation, and avoiding direct shell command construction from user input. Organizations should consider updating to patched versions of libssh where the vulnerability has been addressed through proper input sanitization routines. Additionally, network segmentation and access controls can limit the potential impact if exploitation occurs, while monitoring for suspicious ProxyCommand usage patterns can aid in early detection of attempted exploitation.

This vulnerability demonstrates the importance of following secure coding practices as outlined in the software security principles and aligns with ATT&CK technique T1059.001 for command and scripting interpreter. The attack surface is particularly concerning in environments where ssh clients are used to connect through proxy servers, making it a critical consideration for enterprise security teams managing network infrastructure and remote access solutions.

Responsible

Redhat

Reservation

07/07/2026

Disclosure

07/21/2026

Moderation

accepted

CPE

ready

EPSS

0.00000

KEV

no

Activities

very low

Sources

Might our Artificial Intelligence support you?

Check our Alexa App!