SecPod

Learn Search

Search across all Learn content

← Back to Security Research
ProxyCommand Panic: CVE-2025-61984 Lets Attackers Hijack SSH Clients

ProxyCommand Panic: CVE-2025-61984 Lets Attackers Hijack SSH Clients

A newly discovered vulnerability in OpenSSH’s ProxyCommand feature, identified as CVE-2025-61984, allows remote attackers to execute arbitrary code on client systems. This critical flaw stems from the insufficient filtering of control characters within usernames when the ProxyCommand string is expan...

Oct 22, 2025By Meghana Raatni4 min read

A newly discovered vulnerability in OpenSSH’s ProxyCommand feature, identified as CVE-2025-61984, allows remote attackers to execute arbitrary code on client systems. This critical flaw stems from the insufficient filtering of control characters within usernames when the ProxyCommand string is expanded. A proof-of-concept (PoC) exploit has been released, demonstrating the vulnerability across multiple shells, prompting immediate attention for organizations relying on SSH proxy configurations.

Vulnerability Details

The vulnerability arises from how ssh(1) processes the ProxyCommand directive within a user’s ~/.ssh/config file. When administrators include the %r token to insert the remote username into the proxy command, control characters, such as newlines, are not adequately stripped. This oversight allows an attacker who can manipulate the username field to inject line breaks, disrupting the intended exec invocation.

When the malformed exec line fails due to a syntax error, execution continues on the subsequent line, enabling attacker-supplied commands to run with the privileges of the SSH client.

Root Cause

The root cause of CVE-2025-61984 lies in OpenSSH’s failure to properly sanitize control characters, particularly newlines, within usernames. An attacker can craft a username containing a newline character followed by a malicious command. This crafted username is then passed to the shell via SSH’s ProxyCommand. While OpenSSH filters many dangerous shell metacharacters, it fails to filter characters that could force a syntax error in certain shells.

Proof of Concept (PoC)

Researchers have released a PoC exploit that demonstrates the attack in Bash, fish, and csh shells. In Bash, injecting $[*] within an exec invocation produces a syntax error, halting the built-in but allowing subsequent lines to run.

For example:

block
bash bash -xc "$(printf 'exec $[*]\n\necho compromised')"

This command prints “compromised” following the initial parse error. Similar techniques target fish (using exec cat \\$p[0]) and csh (using exec $[) to achieve code execution. Zsh remains unaffected because non-interactive shells abort entirely on parse errors.

Attack Vector

A common attack vector involves a malicious Git submodule URL. If a repository’s .gitmodules entry contains a crafted username and the user’s SSH configuration employs ProxyCommand with %r, the injected control characters trigger the proxy command to execute arbitrary scripts before establishing the SSH connection.

The exploit requires two conditions on the victim’s machine:

  • A shell that continues execution after a syntax error (like Bash).
  • An SSH configuration file (~/.ssh/config) with a ProxyCommand that uses the %r token to include the remote username.

Affected Versions and Impact

This expansion vulnerability affects OpenSSH client versions before 10.1.

Successful exploitation of this vulnerability allows for remote code execution on the client machine. This can lead to complete system compromise, data theft, and the potential for lateral movement within a network.

Mitigation & Recommendations

The definitive solution is to upgrade OpenSSH clients to version 10.1/10.1p1 or later, where control characters in usernames are explicitly disallowed. For administrators unable to upgrade immediately, quoting the %r token in the SSH configuration can mitigate the risk:

block
ProxyCommand /usr/bin/nc -X connect -x proxy:8080 '%r@%h:%p'

This quoting prevents newline injection by treating the username string literally.

Additional defense-in-depth measures include:

  • Enforcing stricter handling of Git submodules by disabling unintended SSH transport:
block
git config --global protocol.ssh.allow user
  • Limiting URL handlers that pass unfiltered SSH usernames further reduces exposure.
  • Awareness of this flaw is crucial for any infrastructure using SSH proxies, including cloud gateway services.

Instantly Fix Risks with Saner Patch Management

Saner patch management is a continuous, automated, and integrated software that instantly fixes risks exploited in the wild. The software supports major operating systems like Windows, Linux, and macOS, as well as 550+ third-party applications.

It also allows you to set up a safe testing area to test patches before deploying them in a primary production environment. Saner patch management additionally supports a patch rollback feature in case of patch failure or a system malfunction.

Experience the fastest and most accurate patching software here.

Featured Posts

Open November 2026 Linux Security Updates for Debian, Fedora, Red Hat and Ubuntu: Critical Browser, .NET and Enterprise Infrastructure Vulnerabilities
November 2026 Linux Security Updates for Debian, Fedora, Red Hat and Ubuntu: Critical Browser, .NET and Enterprise Infrastructure Vulnerabilities

CVE Research

November 2026 Linux Security Updates for Debian, Fedora, Red Hat and Ubuntu: Critical Browser, .NET and Enterprise Infrastructure Vulnerabilities

Nov 27, 2026

Open Drupal Installer Flaw Under Attack: Site Takeover Risk Persists
vulnerability researchDrupal Installer Flaw Under Attack: Site Takeover Risk Persists

CVE Research

Drupal Installer Flaw Under Attack: Site Takeover Risk Persists

CVE-2026-136716 is a highly critical Drupal core installer access-bypass vulnerability that is under active exploitation. An unauthenticated attacker can take over sites left in unusual or incomplete installation states, including some production sites. The earlier fix for CVE-2026-132165 does not cover every affected state. Fixed releases are Drupal Core 11.4.14, 11.3.23, and 10.6.23. This article covers how the flaw works, its relationship to the prior installer issue, impact, and remediation steps.

Nov 27, 2026

Open GT13 Campaign Targets 22 Organizations Through Check Point Security Management Server Exploitation
GT13 Campaign Targets 22 Organizations Through Check Point Security Management Server Exploitation

CVE Research

GT13 Campaign Targets 22 Organizations Through Check Point Security Management Server Exploitation

The GT13 campaign targeted at least 22 organizations worldwide by exploiting vulnerabilities in exposed services and Check Point Security Management Servers. The attackers used forged authentication sessions, SSH-based persistence, internal reconnaissance, lateral movement, and data exfiltration techniques to compromise systems and access sensitive information.

Nov 26, 2026

Open GeoServer Flaws Under Attack: Inside the Exploit Chain to Remote Code Execution
vulnerability researchGeoServer Flaws Under Attack: Inside the Exploit Chain to Remote Code Execution

CVE Research

GeoServer Flaws Under Attack: Inside the Exploit Chain to Remote Code Execution

Six vulnerabilities in GeoServer’s November 2026 security update can expose sensitive files, bypass service authorization, and enable administrator impersonation. Several of these flaws can be chained for unauthenticated remote code execution with the permissions of the GeoServer process. CVE-2026-120705 and CVE-2026-129243 have been reported as exploited. Fixed releases include GeoServer 3.0.2, 2.28.6, and 2.27.7. This article covers the flaws, the public five-CVE chain, impact, affected versions, and remediation guidance.

Nov 26, 2026