OpenSSH Command Injection Vulnerability (CVE-2023-51385) Alert

OpenSSH Command Injection Vulnerability (CVE-2023-51385) Alert

dezembro 27, 2023 | NSFOCUS


Recently, NSFOCUS CERT detected that OpenSSH released a security update and fixed a command injection vulnerability caused by malicious shell characters (CVE-2023-51385), with a CVSS score of 9.8; Since there is no security filtering of username and hostname input represented by %h,%u in OpenSSH’s ProxyCommand command, command injection may occur if the username or hostname contains shell metacharacters (e.g. | ‘ “) and the user or hostname is referenced by a ProxyCommand, LocalCommand directive, or “match exec” in ssh_config with extension tags such as %h,%u.

Common attack scenario: An untrusted Git repository contains shell metacharacters in the user or hostname, which triggers vulnerability execution when a user updates the repository recursively.

At present, PoC has been made public. Affected users should take measures as soon as possible.

Reference link:

Scope of Impact

Affected version

OpenSSH < 9.6

Unaffected version

OpenSSH >=9.6/9.6p1


Manual inspection

To ensure the accuracy of version detection, you can use the following commands to view the current OpenSSH version and determine whether it is within the impact range:

ssh -V


At present, the vulnerability has been officially fixed in the latest version. Please upgrade the affected version as soon as possible for protection. Official download link:


This advisory is only used to describe a potential risk. NSFOCUS does not provide any commitment or promise on this advisory. NSFOCUS and the author will not bear any liability for any direct and/or indirect consequences and losses caused by transmitting and/or using this advisory. NSFOCUS reserves all the rights to modify and interpret this advisory. Please include this statement paragraph when reproducing or transferring this advisory. Do not modify this advisory, add/delete any information to/from it, or use this advisory for commercial purposes without permission from NSFOCUS.


NSFOCUS, Inc., a global network and cyber security leader, protects enterprises and carriers from advanced cyber attacks. The company’s Intelligent Hybrid Security strategy utilizes both cloud and on-premises security platforms, built on a foundation of real-time global threat intelligence, to provide multi-layered, unified and dynamic protection against advanced cyber attacks.

NSFOCUS works with Fortune Global 500 companies, including four of the world’s five largest financial institutions, organizations in insurance, retail, healthcare, critical infrastructure industries as well as government agencies. NSFOCUS has technology and channel partners in more than 60 countries, is a member of both the Microsoft Active Protections Program (MAPP), and the Cloud Security Alliance (CSA).

A wholly owned subsidiary of NSFOCUS Technologies Group Co., Ltd., the company has operations in the Americas, Europe, the Middle East and Asia Pacific.