# CVE-2023-51385: Command injection in n/a

> OpenSSH allows OS command injection via shell metacharacters in usernames or hostnames referenced by expansion tokens, enabling remote code execution.

- **Severity:** Medium 6.5 (`CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:N`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 18 Dec 2023
- **Updated:** 15 Oct 2026
- **Also known as:** ALPINE-CVE-2023-51385, AZL-32203, AZL-35082, BELL-CVE-2023-51385, CLSA-2023-1703610859, CLSA-2023-1703611900, CLSA-2023-1703612125, CLSA-2023-1703612727, CLSA-2023-1703612912, CLSA-2023-1703784959, CLSA-2023-1703785060, CLSA-2023-1703785140, DEBIAN-CVE-2023-51385, GHSA-5mq4-x9g5-4vc4, JLSEC-2026-70, OESA-2023-1975, OESA-2023-1976, OESA-2023-1980, ROOT-OS-ALPINE-318-CVE-2023-51385, SUSE-SU-2024:0596-1, SUSE-SU-2024:0603-1, SUSE-SU-2024:0604-1, UBUNTU-CVE-2023-51385, USN-6560-3

## What is CVE-2023-51385?

CVE-2023-51385 is a medium-severity command injection vulnerability in Debian Debian Linux, published on 18 Dec 2023. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

In ssh in OpenSSH before 9.6, OS command injection might occur if a user name or host name has shell metacharacters, and this name is referenced by an expansion token in certain situations. For example, an untrusted Git repository can have a submodule with shell metacharacters in a user name or host name.

Weakness: CWE-78 (Improper Neutralization of Special Elements used in an OS Command)

## Which versions are affected by CVE-2023-51385?

It affects 2 products.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `openssh` | SUSE:Enterprise Storage 7.1 | All versions | 8.4p1-150300.3.30.1 |
| `openssh-askpass-gnome` | SUSE:Enterprise Storage 7.1 | All versions | 8.4p1-150300.3.30.1 |
| `openssh` | SUSE:Linux Enterprise High Performance Computing 15 SP2-LTSS | All versions | 8.1p1-150200.5.46.1 |
| `openssh-askpass-gnome` | SUSE:Linux Enterprise High Performance Computing 15 SP2-LTSS | All versions | 8.1p1-150200.5.46.1 |
| `openssh` | SUSE:Linux Enterprise High Performance Computing 15 SP3-LTSS | All versions | 8.4p1-150300.3.30.1 |
| `openssh-askpass-gnome` | SUSE:Linux Enterprise High Performance Computing 15 SP3-LTSS | All versions | 8.4p1-150300.3.30.1 |
| `openssh` | SUSE:Linux Enterprise High Performance Computing 15 SP4-ESPOS | All versions | 8.4p1-150300.3.30.1 |
| `openssh-askpass-gnome` | SUSE:Linux Enterprise High Performance Computing 15 SP4-ESPOS | All versions | 8.4p1-150300.3.30.1 |
| `openssh` | SUSE:Linux Enterprise High Performance Computing 15 SP4-LTSS | All versions | 8.4p1-150300.3.30.1 |
| `openssh-askpass-gnome` | SUSE:Linux Enterprise High Performance Computing 15 SP4-LTSS | All versions | 8.4p1-150300.3.30.1 |
| `openssh` | SUSE:Linux Enterprise Micro 5.1 | All versions | 8.4p1-150300.3.30.1 |
| `openssh` | SUSE:Linux Enterprise Micro 5.2 | All versions | 8.4p1-150300.3.30.1 |
| `openssh` | SUSE:Linux Enterprise Micro 5.3 | All versions | 8.4p1-150300.3.30.1 |
| `openssh` | SUSE:Linux Enterprise Micro 5.4 | All versions | 8.4p1-150300.3.30.1 |
| `openssh` | SUSE:Linux Enterprise Micro 5.5 | All versions | 8.4p1-150300.3.30.1 |
| `openssh` | SUSE:Linux Enterprise Module for Basesystem 15 SP5 | All versions | 8.4p1-150300.3.30.1 |
| `openssh-askpass-gnome` | SUSE:Linux Enterprise Module for Desktop Applications 15 SP5 | All versions | 8.4p1-150300.3.30.1 |
| `openssh` | SUSE:Linux Enterprise Server 12 SP5 | All versions | 7.2p2-81.12.1 |
| `openssh-askpass-gnome` | SUSE:Linux Enterprise Server 12 SP5 | All versions | 7.2p2-81.12.1 |
| `openssh` | SUSE:Linux Enterprise Server 15 SP2-LTSS | All versions | 8.1p1-150200.5.46.1 |
| `openssh-askpass-gnome` | SUSE:Linux Enterprise Server 15 SP2-LTSS | All versions | 8.1p1-150200.5.46.1 |
| `openssh` | SUSE:Linux Enterprise Server 15 SP3-LTSS | All versions | 8.4p1-150300.3.30.1 |
| `openssh-askpass-gnome` | SUSE:Linux Enterprise Server 15 SP3-LTSS | All versions | 8.4p1-150300.3.30.1 |
| `openssh` | SUSE:Linux Enterprise Server 15 SP4-LTSS | All versions | 8.4p1-150300.3.30.1 |
| `openssh-askpass-gnome` | SUSE:Linux Enterprise Server 15 SP4-LTSS | All versions | 8.4p1-150300.3.30.1 |
| `openssh` | SUSE:Linux Enterprise Server for SAP Applications 12 SP5 | All versions | 7.2p2-81.12.1 |
| `openssh-askpass-gnome` | SUSE:Linux Enterprise Server for SAP Applications 12 SP5 | All versions | 7.2p2-81.12.1 |
| `openssh` | SUSE:Linux Enterprise Server for SAP Applications 15 SP2 | All versions | 8.1p1-150200.5.46.1 |
| `openssh-askpass-gnome` | SUSE:Linux Enterprise Server for SAP Applications 15 SP2 | All versions | 8.1p1-150200.5.46.1 |
| `openssh` | SUSE:Linux Enterprise Server for SAP Applications 15 SP3 | All versions | 8.4p1-150300.3.30.1 |
| `openssh-askpass-gnome` | SUSE:Linux Enterprise Server for SAP Applications 15 SP3 | All versions | 8.4p1-150300.3.30.1 |
| `openssh` | SUSE:Linux Enterprise Server for SAP Applications 15 SP4 | All versions | 8.4p1-150300.3.30.1 |
| `openssh-askpass-gnome` | SUSE:Linux Enterprise Server for SAP Applications 15 SP4 | All versions | 8.4p1-150300.3.30.1 |
| `openssh-testuser` | SUSE:Linux Enterprise Software Development Kit 12 SP5 | All versions | 0-81.12.1 |
| `openssh` | SUSE:Manager Proxy 4.3 | All versions | 8.4p1-150300.3.30.1 |
| `openssh` | SUSE:Manager Server 4.3 | All versions | 8.4p1-150300.3.30.1 |
| `openssh` | openSUSE:Leap 15.5 | All versions | 8.4p1-150300.3.30.1 |
| `openssh-askpass-gnome` | openSUSE:Leap 15.5 | All versions | 8.4p1-150300.3.30.1 |
| `openssh` | openSUSE:Leap Micro 5.3 | All versions | 8.4p1-150300.3.30.1 |
| `openssh` | openSUSE:Leap Micro 5.4 | All versions | 8.4p1-150300.3.30.1 |

Products: Debian Debian Linux, OpenSSH.

## How do I fix CVE-2023-51385?

Upgrade to a fixed version.

## Is CVE-2023-51385 being exploited?

It is not confirmed as exploited in the wild, but public exploit code for CVE-2023-51385 exists.

Public exploit code:

- Proof of conept to exploit vulnerable proxycommand configurations on ssh clients (CVE-2023-51385) (github_poc): https://github.com/vin01/poc-proxycommand-vulnerable
- 一个验证对CVE-2023-51385 (github_poc): https://github.com/LtmThink/CVE-2023-51385_test
- OpenSSH ProxyCommand RCE (github_poc): https://github.com/Le1a/CVE-2023-51385
- CVE-2023-51385 PoC Exploit  (github_poc): https://github.com/WOOOOONG/CVE-2023-51385
- https://github.com/FeatherStark/CVE-2023-51385 (github_poc): https://github.com/FeatherStark/CVE-2023-51385
- https://github.com/watarium/poc-cve-2023-51385 (github_poc): https://github.com/watarium/poc-cve-2023-51385

## Other vulnerabilities in Debian Debian Linux

- [CVE-2015-3306](https://insights.sbomify.com/CVE-2015-3306/): ProFTPD Improper Access Control (critical 10.0, exploited in the wild)
- [CVE-2025-49113](https://insights.sbomify.com/CVE-2025-49113/): RoundCube Webmail Deserialization of Untrusted Data (critical 9.9, exploited in the wild)
- [CVE-2026-24061](https://insights.sbomify.com/CVE-2026-24061/): GNU InetUtils Argument Injection (critical 9.8, exploited in the wild)
- [CVE-2025-39682](https://insights.sbomify.com/CVE-2025-39682/): Linux Kernel Improper Check for Unusual or Exceptional Conditions (critical 9.8, exploited in the wild)
- [CVE-2024-9680](https://insights.sbomify.com/CVE-2024-9680/): Mozilla Firefox Use-After-Free (critical 9.8, exploited in the wild)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2023-51385 and fix it if it is affected.

What it is: CVE-2023-51385 is a medium-severity command injection vulnerability in Debian Debian Linux, published on 18 Dec 2023. An attacker can exploit it over the internet without logging in, with no action from the victim.
Exploitation: It is not confirmed as exploited in the wild, but public exploit code for CVE-2023-51385 exists.

Affected product: Debian Debian Linux. No package-level version data is available, so check the vendor advisory linked from the reference page.

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2023-51385/ (Markdown: https://insights.sbomify.com/CVE-2023-51385/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2023-51385
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2023-51385
- OSV: https://osv.dev/vulnerability/CVE-2023-51385

---
From sbomify Insights: https://insights.sbomify.com/CVE-2023-51385/
Summaries are generated and may contain mistakes; the official description above is the record.
