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 Silent Lynx Hits CIS Governments With WinRAR Flaw
threat intelligenceSilent Lynx Hits CIS Governments With WinRAR Flaw

CVE Research

Silent Lynx Hits CIS Governments With WinRAR Flaw

Silent Lynx (UAT-6275 / TAG-193) is a cyber-espionage actor targeting government organizations across the Commonwealth of Independent States. From June 2025 through August 2026, the group used four infection chains, including macro-enabled documents, PS2EXE downloaders, LNK-based PowerShell loaders, and WinRAR archives that exploit CVE-2025-8088, to deploy custom reverse shells such as FoalShell, Chvost, Laplas, and PickleShell. Activity spans nine countries and focuses on diplomacy, economic development, environmental management, water resources, and energy. This article summarizes the campaign’s delivery methods, infrastructure exposure, indicators of compromise, and practical mitigations for defenders.

Oct 16, 2026

Open Drupal Fixes Critical Field UI Flaw Linked to Remote Code Execution
Drupal Fixes Critical Field UI Flaw Linked to Remote Code Execution

CVE Research

Drupal Fixes Critical Field UI Flaw Linked to Remote Code Execution

A critical vulnerability in Drupal core's Field UI module could allow attackers to execute arbitrary code on vulnerable websites through exposed contributed modules or custom code. Tracked as CVE-2026-108097, the flaw stems from improper validation of PHP callbacks during table rendering. At least one known exploitation path does not require authentication, potentially putting affected websites at risk of server compromise.

Oct 16, 2026

Open Palo Alto PAN-OS Vulnerability CVE-2026-0322 Could Allow Root-Level Code Execution
vulnerability researchPalo Alto PAN-OS Vulnerability CVE-2026-0322 Could Allow Root-Level Code Execution

CVE Research

Palo Alto PAN-OS Vulnerability CVE-2026-0322 Could Allow Root-Level Code Execution

Oct 15, 2026

Open Cisco Secure Email Gateway Under Attack: Critical CVE-2026-76519 Enables Arbitrary File Write
vulnerability researchCisco Secure Email Gateway Under Attack: Critical CVE-2026-76519 Enables Arbitrary File Write

CVE Research

Cisco Secure Email Gateway Under Attack: Critical CVE-2026-76519 Enables Arbitrary File Write

Oct 15, 2026