CVE-2023-51385
NixOS vulnerability analysis and mitigation

Overview

CVE-2023-51385 affects OpenSSH versions before 9.6, where OS command injection might occur if a user name or host name contains shell metacharacters and is referenced by an expansion token in certain situations. The vulnerability was discovered and disclosed in December 2023. The issue affects various systems and software that use OpenSSH, including major Linux distributions and enterprise systems (OpenSSH Release, Debian Advisory).

Technical details

The vulnerability occurs when an invalid user or hostname containing shell metacharacters is passed to ssh, and a ProxyCommand, LocalCommand directive, or 'match exec' predicate references the user or hostname via expansion tokens like %u, %h. This could lead to command injection depending on the quoting present in the user-supplied ssh_config directive. The vulnerability has been assigned a CVSS 3.1 base score of 6.5 (Medium) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:N (NVD).

Impact

If successfully exploited, this vulnerability could allow an attacker who can supply arbitrary user/hostnames to ssh to potentially perform command injection. A practical example of this vulnerability can occur in git repositories with submodules, where the repository could contain a submodule with shell metacharacters in its user or hostname (OpenSSH Release, Security Blog).

Mitigation and workarounds

The primary mitigation is to upgrade to OpenSSH version 9.6 or later, which implements countermeasures by banning most shell metacharacters from user and hostnames supplied via the command-line. However, user/hostnames provided via ssh_config are not subject to these restrictions. The fix is available through various distribution channels including Debian, Ubuntu, Red Hat, and other major Linux distributions (OpenSSH Release, Debian Advisory).

Additional resources


SourceThis report was generated using AI

Free Vulnerability Assessment

Benchmark your Cloud Security Posture

Evaluate your cloud security practices across 9 security domains to benchmark your risk level and identify gaps in your defenses.

Request assessment

Get a personalized demo

Ready to see Wiz in action?

“Best User Experience I have ever seen, provides full visibility to cloud workloads.”
David EstlickCISO
“Wiz provides a single pane of glass to see what is going on in our cloud environments.”
Adam FletcherChief Security Officer
“We know that if Wiz identifies something as critical, it actually is.”
Greg PoniatowskiHead of Threat and Vulnerability Management