# CVE-2023-38408: Code injection in n/a

> Attackers can execute arbitrary code by exploiting an untrusted search path in OpenSSH ssh-agent when agent forwarding is enabled.

- **Severity:** Critical 9.8 (`CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 20 Jul 2023
- **Updated:** 14 Oct 2026
- **Also known as:** ALPINE-CVE-2023-38408, ALSA-2023:4412, ALSA-2023:4419, AZL-27651, CLSA-2023-1691576279, CLSA-2023-1691576392, CLSA-2023-1691576488, CLSA-2023-1691576690, CLSA-2023-1691576785, CLSA-2023-1691576939, CLSA-2023-1691606104, CLSA-2023-1691606742, DEBIAN-CVE-2023-38408, DLA-3532-1, GHSA-px36-p9hv-7h2v, JLSEC-2026-68, OESA-2023-1480, RHSA-2023:4329, RHSA-2023:4381, RHSA-2023:4382, RHSA-2023:4383, RHSA-2023:4384, RHSA-2023:4412, RHSA-2023:4413, RHSA-2023:4419, RHSA-2023:4428, RLSA-2023:4419, SUSE-SU-2023:2940-1, SUSE-SU-2023:2945-1, SUSE-SU-2023:2946-1, SUSE-SU-2023:2947-1, SUSE-SU-2023:2950-1, UBUNTU-CVE-2023-38408, USN-6242-1, USN-6242-2, openSUSE-SU-2024:13063-1

## What is CVE-2023-38408?

CVE-2023-38408 is a critical code injection vulnerability in Fedoraproject Fedora, published on 20 Jul 2023. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

The PKCS#11 feature in ssh-agent in OpenSSH before 9.3p2 has an insufficiently trustworthy search path, leading to remote code execution if an agent is forwarded to an attacker-controlled system. (Code in /usr/lib is not necessarily safe for loading into ssh-agent.) NOTE: this issue exists because of an incomplete fix for CVE-2016-10009.

Weakness: CWE-428 (Unquoted Search Path or Element)

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

It affects 2 products.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `openssh` | AlmaLinux:8 | All versions | 8.0p1-19.el8_8 |
| `openssh-askpass` | AlmaLinux:8 | All versions | 8.0p1-19.el8_8 |
| `openssh-cavs` | AlmaLinux:8 | All versions | 8.0p1-19.el8_8 |
| `openssh-clients` | AlmaLinux:8 | All versions | 8.0p1-19.el8_8 |
| `openssh-keycat` | AlmaLinux:8 | All versions | 8.0p1-19.el8_8 |
| `openssh-ldap` | AlmaLinux:8 | All versions | 8.0p1-19.el8_8 |
| `openssh-server` | AlmaLinux:8 | All versions | 8.0p1-19.el8_8 |
| `pam_ssh_agent_auth` | AlmaLinux:8 | All versions | 0.10.3-7.19.el8_8 |
| `openssh` | AlmaLinux:9 | All versions | 8.7p1-30.el9_2 |
| `openssh-askpass` | AlmaLinux:9 | All versions | 8.7p1-30.el9_2 |
| `openssh-clients` | AlmaLinux:9 | All versions | 8.7p1-30.el9_2 |
| `openssh-keycat` | AlmaLinux:9 | All versions | 8.7p1-30.el9_2 |
| `openssh-server` | AlmaLinux:9 | All versions | 8.7p1-30.el9_2 |
| `pam_ssh_agent_auth` | AlmaLinux:9 | All versions | 0.10.4-5.30.el9_2 |
| `openssh` | Red Hat:enterprise_linux:7::client | All versions | 0:7.4p1-23.el7_9 |
| `openssh-askpass` | Red Hat:enterprise_linux:7::client | All versions | 0:7.4p1-23.el7_9 |
| `openssh-cavs` | Red Hat:enterprise_linux:7::client | All versions | 0:7.4p1-23.el7_9 |
| `openssh-clients` | Red Hat:enterprise_linux:7::client | All versions | 0:7.4p1-23.el7_9 |
| `openssh-debuginfo` | Red Hat:enterprise_linux:7::client | All versions | 0:7.4p1-23.el7_9 |
| `openssh-keycat` | Red Hat:enterprise_linux:7::client | All versions | 0:7.4p1-23.el7_9 |
| `openssh-ldap` | Red Hat:enterprise_linux:7::client | All versions | 0:7.4p1-23.el7_9 |
| `openssh-server` | Red Hat:enterprise_linux:7::client | All versions | 0:7.4p1-23.el7_9 |
| `openssh-server-sysvinit` | Red Hat:enterprise_linux:7::client | All versions | 0:7.4p1-23.el7_9 |
| `pam_ssh_agent_auth` | Red Hat:enterprise_linux:7::client | All versions | 0:0.10.3-2.23.el7_9 |
| `openssh-askpass` | Red Hat:enterprise_linux:7::computenode | All versions | 0:7.4p1-23.el7_9 |
| `openssh-cavs` | Red Hat:enterprise_linux:7::computenode | All versions | 0:7.4p1-23.el7_9 |
| `openssh-debuginfo` | Red Hat:enterprise_linux:7::computenode | All versions | 0:7.4p1-23.el7_9 |
| `openssh-ldap` | Red Hat:enterprise_linux:7::computenode | All versions | 0:7.4p1-23.el7_9 |
| `openssh-server-sysvinit` | Red Hat:enterprise_linux:7::computenode | All versions | 0:7.4p1-23.el7_9 |
| `pam_ssh_agent_auth` | Red Hat:enterprise_linux:7::computenode | All versions | 0:0.10.3-2.23.el7_9 |
| `openssh` | Red Hat:enterprise_linux:7::server | All versions | 0:7.4p1-23.el7_9 |
| `openssh-askpass` | Red Hat:enterprise_linux:7::server | All versions | 0:7.4p1-23.el7_9 |
| `openssh-cavs` | Red Hat:enterprise_linux:7::server | All versions | 0:7.4p1-23.el7_9 |
| `openssh-clients` | Red Hat:enterprise_linux:7::server | All versions | 0:7.4p1-23.el7_9 |
| `openssh-debuginfo` | Red Hat:enterprise_linux:7::server | All versions | 0:7.4p1-23.el7_9 |
| `openssh-keycat` | Red Hat:enterprise_linux:7::server | All versions | 0:7.4p1-23.el7_9 |
| `openssh-ldap` | Red Hat:enterprise_linux:7::server | All versions | 0:7.4p1-23.el7_9 |
| `openssh-server` | Red Hat:enterprise_linux:7::server | All versions | 0:7.4p1-23.el7_9 |
| `openssh-server-sysvinit` | Red Hat:enterprise_linux:7::server | All versions | 0:7.4p1-23.el7_9 |
| `pam_ssh_agent_auth` | Red Hat:enterprise_linux:7::server | All versions | 0:0.10.3-2.23.el7_9 |

Products: Fedoraproject Fedora, OpenSSH.

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

Upgrade to a fixed version.

## Is CVE-2023-38408 being exploited?

There is no known exploitation of CVE-2023-38408 in the wild and no public exploit code.

Public exploit code:

- PoC for the recent critical vuln affecting OpenSSH versions < 9.3p2 (github_poc): https://github.com/kali-mx/CVE-2023-38408
- Takeover Account OpenSSH (github_poc): https://github.com/LucasPDiniz/CVE-2023-38408
- CVE-2023-38408 SSH Vulnerability Scanner & PoC (github_poc): https://github.com/TX-One/CVE-2023-38408
- An in-depth analysis of CVE 2023 38408, a critical OpenSSH vulnerability, including technical background, exploitation in controlled environments, and mitigation strategies. (github_poc): https://github.com/Adel2411/cve-2023-38408
- CVE-2023-38408 Remote Code Execution in OpenSSH's forwarded ssh-agent (github_poc): https://github.com/classic130/CVE-2023-38408
- Script para eliminar vulnerabilidad de openssh de ubuntu 22.04 LTS  (github_poc): https://github.com/mrtacojr/CVE-2023-38408

## Other vulnerabilities in Fedoraproject Fedora

- [CVE-2024-4577](https://insights.sbomify.com/CVE-2024-4577/): PHP-CGI OS Command Injection (critical 9.8, exploited in the wild)
- [CVE-2021-39226](https://insights.sbomify.com/CVE-2021-39226/): Grafana Authentication Bypass (critical 9.8, exploited in the wild)
- [CVE-2019-5544](https://insights.sbomify.com/CVE-2019-5544/): VMware ESXi and Horizon DaaS OpenSLP Heap-Based Buffer Overflow (critical 9.8, exploited in the wild)
- [CVE-2024-4947](https://insights.sbomify.com/CVE-2024-4947/): Google Chromium V8 Type Confusion (critical 9.6, exploited in the wild)
- [CVE-2024-4671](https://insights.sbomify.com/CVE-2024-4671/): Google Chromium Visuals Use-After-Free (critical 9.6, exploited in the wild)

## Fix prompt for AI coding agents

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

What it is: CVE-2023-38408 is a critical code injection vulnerability in Fedoraproject Fedora, published on 20 Jul 2023. An attacker can exploit it over the internet without logging in, with no action from the victim.
Exploitation: There is no known exploitation of CVE-2023-38408 in the wild and no public exploit code.

Affected product: Fedoraproject Fedora. 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-38408/ (Markdown: https://insights.sbomify.com/CVE-2023-38408/index.md)
```

## Sources

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

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