Cyber Security News

OpenSSH ProxyCommand Flaw Allows Remote Code Execution – PoC Released

Security researchers have uncovered a critical flaw in OpenSSH’s ProxyCommand feature that can be leveraged to achieve remote code execution on client systems.

Tracked as CVE-2025-61984, the vulnerability arises from inadequate filtering of control characters in usernames when expanding the ProxyCommand string.

A proof-of-concept exploit demonstrating the flaw in Bash and other shells has now been published, raising urgent concerns for administrators who employ complex SSH proxy configurations.

Vulnerability Details

The issue stems from how ssh(1) processes the ProxyCommand directive in ~/.ssh/config.

When using the %r token to include the remote username, control characters such as newline are not stripped, allowing an attacker to inject line breaks that interrupt the exec invocation and execute arbitrary commands on the client side.

By triggering a syntax error in the shell built-in, the malformed exec line aborts and execution resumes on the next line, where malicious payloads can run.

Affected ProductsImpactExploit PrerequisitesCVSS 3.1 Score
OpenSSH ≤ 10.0p1 (client)Remote code executionUser SSH config with ProxyCommand using %r8.1 (High)

Proof of Concept and Exploit

The released proof of concept demonstrates exploitation in Bash, fish, and csh shells.

In Bash, injecting $[*] within an exec invocation generates a syntax error that stops the exec but allows subsequent commands to run. For example:

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

This prints “compromised” after the initial error. Similar behaviors in fish (exec cat \$p[0]) and csh (exec $[) enable execution of attacker-controlled scripts.

Zsh is not affected by this specific technique, since non-interactive shells abort on parse errors by default.

A common attack vector is a malicious Git submodule URL leveraging the %r expansion.

When a user clones a repository with a crafted .gitmodules entry and a matching SSH proxy configuration, the injected control characters cause the proxy command to execute arbitrary code before connecting.

Mitigation and Recommendations

The primary remediation is to upgrade OpenSSH to version 10.1p1 or later, where control characters in usernames are explicitly disallowed.

Administrators unable to upgrade immediately can mitigate risk by quoting the %r token in SSH client configurations:

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

This prevents newline injection. Additional defense-in-depth measures include restricting SSH transport for Git submodules via:

git config --global protocol.ssh.allow user

and avoiding URL handlers that pass unfiltered SSH usernames.

Awareness of this flaw is particularly important for environments using SSH proxies, including cloud gateway solutions like Teleport, which generate proxy commands containing %r.

Proper filtering and version updates will safeguard against this insidious method of remote code execution.

Cyber Awareness Month Offer: Upskill With 100+ Premium Cybersecurity Courses From EHA's Diamond Membership: Join Today

Divya

Divya is a Senior Journalist at GBhackers covering Cyber Attacks, Threats, Breaches, Vulnerabilities and other happenings in the cyber world.

Recent Posts

Hackers Use ConnectWise SkyKick Credentials to Access Microsoft 365, Halting Cloud Backups

Attackers abused compromised ConnectWise Cloud Backup credentials to access Microsoft 365 customer environments, prompting ConnectWise…

1 day ago

Anthropic’s Claude AI Uncovers Origins of NSA-Provided Cryptographic Keys After 25 Years

Anthropic says an internal Claude research model reconstructed how the National Security Agency generated seeds…

2 days ago

Critical WordPress Flaws Allow Attackers to Execute Remote Code Without Authentication

Two WordPress Core vulnerabilities can be chained to execute remote code without authentication, according to…

2 days ago

OpenBSD Kernel Flaw Dating Back 37 Years Enables Local Privilege Escalation to Root

A newly disclosed OpenBSD kernel exploitation chain combines a shared memory accounting flaw with a…

2 days ago

GhostAction Hackers Hide Credential-Stealing Malware in Fake Font Files Across 94 GitHub Repositories

GhostAction attackers have expanded their GitHub credential theft campaign with a second stage that disguises…

2 days ago

SideCopy Hackers Target Indian Organizations With ReverseRAT Malware to Steal Data

Indian authorities have warned that SideCopy hackers are targeting Indian organizations, including academic institutions, with…

2 days ago