{"id":7473,"date":"2025-10-07T10:04:28","date_gmt":"2025-10-07T10:04:28","guid":{"rendered":"https:\/\/serisec.com\/index.php\/2025\/10\/07\/openssh-vulnerability-exploited-via-proxycommand-to-execute-remote-code-poc-released\/"},"modified":"2025-10-07T10:04:28","modified_gmt":"2025-10-07T10:04:28","slug":"openssh-vulnerability-exploited-via-proxycommand-to-execute-remote-code-poc-released","status":"publish","type":"post","link":"https:\/\/serisec.com\/index.php\/2025\/10\/07\/openssh-vulnerability-exploited-via-proxycommand-to-execute-remote-code-poc-released\/","title":{"rendered":"OpenSSH Vulnerability Exploited Via ProxyCommand to Execute Remote Code \u2013 PoC Released"},"content":{"rendered":"<p>    OpenSSH Vulnerability Exploited Via ProxyCommand to Execute Remote Code \u2013 PoC Released<br \/>\n \t<BR><br \/>\n<BR><\/BR><br \/>\n    <!-- no image --><br \/>\n \t<BR><br \/>\n<BR><\/BR><\/p>\n<div>\n<p>A new command injection vulnerability in OpenSSH, tracked as CVE-2025-61984, has been disclosed, which could allow an attacker to achieve remote code execution on a victim\u2019s machine.<\/p>\n<p>The vulnerability is a bypass of a previous fix for a similar issue (<a href=\"https:\/\/nvd.nist.gov\/vuln\/detail\/cve-2023-51385\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">CVE-2023-51385<\/a>) and exploits how the <code>ProxyCommand<\/code> feature interacts with the underlying system shell when handling specially crafted usernames.<\/p>\n<p>The core of the vulnerability lies in OpenSSH\u2019s failure to properly sanitize control characters, such as newlines, within usernames. An attacker can create a username that includes a newline character followed by a malicious command.<\/p>\n<p>This username is then passed to the shell via SSH\u2019s <code>ProxyCommand<\/code>. While <a href=\"https:\/\/cybersecuritynews.com\/tag\/openssh-vulnerability\/\" target=\"_blank\" rel=\"noreferrer noopener\">OpenSSH<\/a> filters many dangerous shell metacharacters, it does not filter characters that could force a syntax error in certain shells. <\/p>\n<p>When a shell like Bash, Fish, or csh processes the <code>ProxyCommand<\/code>, the crafted syntax error on the first line, the command fails, but the shell does not exit.<\/p>\n<p>Instead, it proceeds to execute the command on the next line, which is the malicious payload supplied by the attacker. This behavior effectively bypasses security measures intended to prevent command execution, opening the door for an RCE.<\/p>\n<h2 class=\"wp-block-heading\" id=\"h-the-git-submodule-attack-vector\"><strong>The Git Submodule Attack Vector<\/strong><\/h2>\n<p>The most practical exploitation scenario for <a href=\"https:\/\/nvd.nist.gov\/vuln\/detail\/CVE-2025-61984\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">CVE-2025-61984<\/a> involves a malicious Git repository. An attacker can configure a submodule within their repository to use a URL containing the malicious, multi-line username.<\/p>\n<p>If a victim clones this repository recursively (<code>git clone --recursive<\/code>), Git will attempt to connect via SSH to fetch the submodule. This triggers the vulnerability <code>ProxyCommand<\/code> if the user has a specific configuration.<\/p>\n<p>The exploit requires two conditions on the victim\u2019s machine: a shell that continues execution after a syntax error (like Bash) and an SSH configuration file (<code>~\/.ssh\/config<\/code>) with a <code>ProxyCommand<\/code> that uses the <code>%r<\/code> token to include the remote username.<\/p>\n<p>Notably, the secure shell Zsh is not vulnerable to this technique as it terminates upon encountering such errors. Tools like Teleport have been found to generate SSH configurations that use this vulnerable pattern, potentially increasing the attack surface.<\/p>\n<h2 class=\"wp-block-heading\" id=\"h-mitigations\"><strong>Mitigations<\/strong><\/h2>\n<p>The OpenSSH project has <a href=\"https:\/\/www.openwall.com\/lists\/oss-security\/2025\/10\/06\/1\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">released a patch<\/a> in version 10.1 that fully addresses this <a href=\"https:\/\/cybersecuritynews.com\/10-year-old-roundcube-rce-vulnerability\/\" target=\"_blank\" rel=\"noreferrer noopener\">vulnerability<\/a> by disallowing control characters in usernames. All users are strongly urged to upgrade to this version or newer.<\/p>\n<p>For systems that cannot be immediately updated, several mitigations can be implemented.<\/p>\n<p>Users can edit their SSH configurations to enclose the <code>%r<\/code> token in single quotes (<code>'%r'<\/code>) within any <code>ProxyCommand<\/code> directive, which prevents the shell from interpreting the special characters.<\/p>\n<p>Another effective defense-in-depth measure is to configure Git to restrict the automatic use of SSH for submodules.<\/p>\n<p>This vulnerability serves as a critical reminder of the complex security risks that can emerge from the interactions between trusted developer tools.<\/p>\n<p class=\"has-text-align-center has-background\" style=\"background:linear-gradient(180deg,rgb(238,238,238) 94%,rgb(169,184,195) 100%)\"><strong>Follow us on <a href=\"https:\/\/news.google.com\/publications\/CAAqMggKIixDQklTR3dnTWFoY0tGV041WW1WeWMyVmpkWEpwZEhsdVpYZHpMbU52YlNnQVAB?hl=en-IN&amp;gl=IN&amp;ceid=IN:en\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">Google News<\/a>, <a href=\"https:\/\/www.linkedin.com\/company\/cybersecurity-news\/\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">LinkedIn<\/a>, and <a href=\"https:\/\/x.com\/cyber_press_org\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">X<\/a> for daily cybersecurity updates. <a href=\"https:\/\/cybersecuritynews.com\/contact-us\/\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">Contact us<\/a> to feature your stories.<\/strong><\/p>\n<p>The post <a href=\"https:\/\/cybersecuritynews.com\/openssh-vulnerability-proxycommand\/\">OpenSSH Vulnerability Exploited Via ProxyCommand to Execute Remote Code \u2013 PoC Released<\/a> appeared first on <a href=\"https:\/\/cybersecuritynews.com\/\">Cyber Security News<\/a>.<\/p>\n<\/div>\n<p> \t<BR><br \/>\n <BR><\/BR><br \/>\n    Guru Baran<br \/>\n \t<BR><br \/>\n<BR><\/BR><br \/>\n<a href=\"https:\/\/cybersecuritynews.com\/openssh-vulnerability-proxycommand\/\">Go to cyber-security-news<\/a><br \/>\n \t<BR><br \/>\n <BR><\/BR><\/p>\n","protected":false},"excerpt":{"rendered":"<p>OpenSSH Vulnerability Exploited Via ProxyCommand to Execute Remote Code \u2013 PoC Released A new command injection vulnerability in OpenSSH, tracked as CVE-2025-61984, has been disclosed, which could allow an attacker to achieve remote code execution on a victim\u2019s machine. The vulnerability is a bypass of a previous fix for a similar issue (CVE-2023-51385) and exploits [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[129,63,131,648],"tags":[130],"class_list":["post-7473","post","type-post","status-publish","format-standard","hentry","category-cyber-security","category-cyber-security-news","category-vulnerability","category-vulnerability-news","tag-cyber-security-news"],"_links":{"self":[{"href":"https:\/\/serisec.com\/index.php\/wp-json\/wp\/v2\/posts\/7473"}],"collection":[{"href":"https:\/\/serisec.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/serisec.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/serisec.com\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/serisec.com\/index.php\/wp-json\/wp\/v2\/comments?post=7473"}],"version-history":[{"count":0,"href":"https:\/\/serisec.com\/index.php\/wp-json\/wp\/v2\/posts\/7473\/revisions"}],"wp:attachment":[{"href":"https:\/\/serisec.com\/index.php\/wp-json\/wp\/v2\/media?parent=7473"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/serisec.com\/index.php\/wp-json\/wp\/v2\/categories?post=7473"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/serisec.com\/index.php\/wp-json\/wp\/v2\/tags?post=7473"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}