Security Advisory

CVE-2023-38408: OpenSSH ssh-agent PKCS#11 RCE

Last updated:
  • CVE-2023-38408

CVE-2023-38408 is a remote code execution flaw in the PKCS#11 support of OpenSSH's ssh-agent, versions 5.5 to 9.3p1. If a user forwards their agent to a host an attacker controls, the attacker can make the agent load system libraries in a way Qualys turned into code execution on the user's machine. NVD scores it 9.8. Fixed in OpenSSH 9.3p2.

Vulnerability summary

CVSS base score

9.8

Critical severity

EPSS score (FIRST)

79.7%

Probability of exploitation in the wild in the next 30 days

CISA KEV catalog

No

Not listed

Published

Vulnerability ID: CVE-2023-38408 · Source: NVD

Affected components

ComponentCPEVersion range
OpenSSH (ssh-agent)cpe:2.3:a:openbsd:openssh:*:*:*:*:*:*:*:*5.5 to 9.3p1 inclusive (OpenSSH security page); before 9.3, 9.3 and 9.3p1 (NVD); fixed in 9.3p2
Debian openssh packagepkg:deb/debian/opensshFixed in 1:7.9p1-10+deb10u3 (buster, DLA-3532-1), 1:8.4p1-5+deb11u2 (bullseye), 1:9.2p1-2+deb12u1 (bookworm), 1:9.3p2-1 (unstable) (Debian security tracker)
Buildroot package/openssh—Bumped to 9.3p2 on 2023-07-21 (commit 7ccdeeb2); fixed in Buildroot 2023.08 and 2023.02.4; 2023.02.3 and earlier carry 9.3p1 or older
OpenWrt packages feed: openssh (openssh-client-utils ships ssh-agent)—openwrt-21.02 carries 8.4p1 (affected); openwrt-22.03 and openwrt-23.05 carry 9.8p1 (OpenWrt packages repository, as of 2026-11-19)
Siemens SIMATIC S7-1500 CPU 1518(F)-4 PN/DP MFP and SIPLUS S7-1500 CPU 1518-4 PN/DP MFP (GNU/Linux subsystem)—V3.1.0 to before V3.1.5; update to V3.1.5 or later (Siemens SSA-398330)

What does this mean for affected devices?

CVE-2023-38408 is a remote code execution flaw in the PKCS#11 support of ssh-agent, the OpenSSH program that holds private keys for public key authentication. The CVE record describes it as an "insufficiently trustworthy search path" in OpenSSH before 9.3p2, "leading to remote code execution if an agent is forwarded to an attacker-controlled system", and notes that it exists because of an incomplete fix for CVE-2016-10009. NVD's Primary score is 9.8, CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H, with CWE-428 (unquoted search path or element). MITRE, the CNA, published the record on 2023-07-20 without a score; CISA's ADP entry gives the same 9.8 vector. Siemens, scoring it for its own product, gives 7.7, CVSS:3.1/AV:L/AC:L/PR:H/UI:R/S:C/C:H/I:H/A:H, with CWE-20 (NVD, CVE record).

What has to be true for an attack to work?

The vulnerable side is the machine that runs ssh-agent, not the SSH server it connects to. The OpenSSH 9.3p2 release notes give two conditions: "Exploitation requires the presence of specific libraries on the victim system" and "Remote exploitation requires that the agent was forwarded to an attacker-controlled system." Agent forwarding is what ssh -A or ForwardAgent yes turns on: the remote host gets a socket that talks back to the user's local agent. The Qualys advisory, also posted to oss-security, explains that an attacker with access to that remote host can make the agent dlopen() and dlclose() any shared library under /usr/lib* in its ssh-pkcs11-helper process when the agent is built with PKCS#11 support, which is the default. By chaining side effects of ordinary distribution libraries, Qualys reached one-shot code execution on Ubuntu Desktop 22.04 and 21.10 with three extra packages installed. If you never forward an agent to a host someone else could control, this path is closed.

Which OpenSSH versions and devices are affected?

The OpenSSH security page lists ssh-agent in OpenSSH 5.5 to 9.3p1 inclusive; NVD's CPE configuration covers openbsd:openssh before 9.3 plus 9.3 and 9.3:p1. Embedded builds take OpenSSH from a distribution or build system:

  • Debian fixed buster in 1:7.9p1-10+deb10u3 (DLA-3532-1), bullseye in 1:8.4p1-5+deb11u2 and bookworm in 1:9.2p1-2+deb12u1, and lists four upstream fix commits (Debian security tracker).
  • Buildroot moved to 9.3p2 on 2023-07-21 with the commit "security bump version to 9.3p2" (Buildroot commit 7ccdeeb2); releases 2023.08 and 2023.02.4 ship 9.3p2.
  • The OpenWrt packages feed ships ssh-agent in openssh-client-utils. As of 2026-11-19 the openwrt-21.02 branch still carries 8.4p1 with no patches directory, which is in the affected range; openwrt-22.03 and openwrt-23.05 carry 9.8p1 (OpenWrt packages).

Siemens ProductCERT SSA-398330 lists CVE-2023-38408 among the vulnerabilities in the additional GNU/Linux subsystem of the SIMATIC S7-1500 CPU 1518-4 PN/DP MFP and 1518F-4 PN/DP MFP (including the SIPLUS S7-1500 CPU 1518-4 PN/DP MFP), firmware V3.1.0 to before V3.1.5, and recommends updating to V3.1.5 or later.

How do you fix CVE-2023-38408?

Update to OpenSSH 9.3p2 or later, or to a patched distribution package. Besides the fix, 9.3p2 makes ssh-agent refuse PKCS#11 load requests from remote clients by default; the release notes add that the agent relies on an OpenSSH 8.9 or later ssh client to mark requests as remote. If you cannot update, start the agent with an empty allowlist (ssh-agent -P '') or one that names only the provider libraries you use, and stop forwarding agents to hosts you do not fully trust; the ssh(1) manual quoted by Qualys suggests a jump host (-J) instead. On device fleets, also set AllowAgentForwarding no in sshd_config where operators have no need for it. Our OpenSSH vulnerabilities in embedded firmware guide explains how to decide whether a device runs the affected parts of OpenSSH and how to confirm a backport. The same builds usually also need the fixes for regreSSHion, CVE-2024-6387, and Terrapin, CVE-2023-48795.

Is CVE-2023-38408 exploited?

It is not in the CISA KEV catalog as of 2026-11-19 (catalog version 2026.11.18, 1,786 entries). CISA's SSVC entry, dated 2024-10-15, records exploitation as "none", automatable as "yes" and technical impact as "total". Qualys published a working proof of concept with its advisory. FIRST EPSS gives it 0.797, the 99.6th percentile, in the 2026-11-18 dataset (CISA KEV, FIRST EPSS).

How to fix this class of issueNo dedicated SoftWSP guide covers this weakness class; the fix is usually the vendor patch or firmware update referenced above. Our related guide explains how to plan and verify it: NIST SP 800-40 Rev. 4: enterprise patch management planning, explained.

Evidence

  • NVD: PKCS#11 feature in ssh-agent in OpenSSH before 9.3p2 has an insufficiently trustworthy search path, leading to RCE if an agent is forwarded to an attacker-controlled system; incomplete fix for CVE-2016-10009. NVD Primary CVSS v3.1 9.8 AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H; CWE-428; CPE openbsd:openssh before 9.3, 9.3:-, 9.3:p1; published 2023-07-20. — NVD
  • CVE.org: state PUBLISHED, CNA MITRE, published 2023-07-20, no CNA score; CISA-ADP CVSS 3.1 9.8 same vector; SSVC (2024-10-15) exploitation none, automatable yes, technical impact total; Siemens supplier ADP lists SIMATIC S7-1500 CPU 1518(F)-4 PN/DP MFP V3.1.0 to before V3.1.5. — CVE.org
  • OpenSSH 9.3p2 released 2023-07-19 fixes CVE-2023-38408; requires specific libraries on the victim and an agent forwarded to an attacker-controlled system; mitigation ssh-agent -P '' or a specific allowlist; agent now refuses remote PKCS#11 load requests by default (-Oallow-remote-pkcs11 restores), relying on ssh client >= 8.9 to identify remote requests. — OpenSSH
  • OpenSSH security page (2023-07-19): ssh-agent in OpenSSH between 5.5 and 9.3p1 (inclusive), remote code execution relating to PKCS#11 providers; corrected in 9.3p2. — OpenSSH
  • Qualys advisory: an attacker with access to the server the agent is forwarded to can dlopen()/dlclose() any shared library in /usr/lib* via ssh-pkcs11-helper if built with ENABLE_PKCS11 (default); chaining side effects gave reliable one-shot RCE on Ubuntu Desktop 22.04 and 21.10 plus three universe packages; coordinated release 2023-07-19. — Qualys / oss-security
  • Debian: fixed buster 1:7.9p1-10+deb10u3 (DLA-3532-1), bullseye 1:8.4p1-5+deb11u2, bookworm 1:9.2p1-2+deb12u1, unstable 1:9.3p2-1; four openssh-portable fix commits listed. — Debian security tracker
  • Buildroot commit 7ccdeeb2 (2023-07-21) 'package/openssh: security bump version to 9.3p2', fixes CVE-2023-38408; contained in tag 2023.08; 2023.02.4 openssh.mk carries 9.3p2, 2023.02.3 carries 9.3p1. — Buildroot
  • OpenWrt packages net/openssh: openwrt-21.02 PKG_VERSION 8.4p1, no patches directory, ssh-agent installed by openssh-client-utils; openwrt-22.03 and openwrt-23.05 PKG_VERSION 9.8p1 (read 2026-11-19). — OpenWrt packages
  • Siemens SSA-398330 (V2.8, last update 2026-10-13): CVE-2023-38408 affects the additional GNU/Linux subsystem of SIMATIC S7-1500 CPU 1518-4 PN/DP MFP and 1518F-4 PN/DP MFP and SIPLUS S7-1500 CPU 1518-4 PN/DP MFP, V3.1.0 to before V3.1.5; update to V3.1.5 or later; Siemens CVSS v3.1 7.7 AV:L/AC:L/PR:H/UI:R/S:C/C:H/I:H/A:H, CWE-20. — Siemens ProductCERT
  • Not in CISA KEV catalog version 2026.11.18; EPSS 0.797, percentile 0.99614, dataset 2026-11-18. — CISA KEV / FIRST EPSS

Related advisories

Sources

  1. NVD
  2. OpenSSH 9.3p2 release notes (2023-07-19)
  3. OpenSSH security page
  4. Qualys Security Advisory: CVE-2023-38408, RCE in OpenSSH's forwarded ssh-agent
  5. oss-security: Qualys advisory post (2023-07-19)
  6. Debian security tracker: CVE-2023-38408
  7. Buildroot commit 7ccdeeb2: openssh security bump to 9.3p2
  8. OpenWrt packages: net/openssh Makefile (openwrt-21.02)
  9. Siemens ProductCERT SSA-398330
  10. CVE.org record CVE-2023-38408 (CNA: MITRE)
  11. CISA KEV
  12. FIRST EPSS

Frequently asked questions

Can CVE-2023-38408 be exploited against an SSH server that never runs ssh-agent?

The vulnerable component is ssh-agent on the machine whose agent is forwarded; remote exploitation requires that the agent was forwarded to an attacker-controlled system and that specific libraries are present on the victim. A device that only runs sshd and never runs or forwards an agent is not the target, though a compromised server receiving forwarded agents is where an attacker would sit (per the OpenSSH 9.3p2 release notes and the Qualys advisory).

Which OpenSSH version fixes CVE-2023-38408?

OpenSSH 9.3p2, released on 2023-07-19; ssh-agent in 5.5 to 9.3p1 is affected. Debian ships the fix as 1:7.9p1-10+deb10u3 for buster, 1:8.4p1-5+deb11u2 for bullseye and 1:9.2p1-2+deb12u1 for bookworm (per the OpenSSH security page and the Debian security tracker).

How can I block CVE-2023-38408 without upgrading?

Start ssh-agent with an empty PKCS#11/FIDO allowlist (ssh-agent -P '') or an allowlist that names only the provider libraries you need, and do not forward your agent to hosts you do not trust; a jump host with -J avoids forwarding the agent (per the OpenSSH 9.3p2 release notes and the ssh(1) manual quoted by Qualys).

Which industrial products list CVE-2023-38408?

Siemens lists it for the additional GNU/Linux subsystem of the SIMATIC S7-1500 CPU 1518-4 PN/DP MFP and 1518F-4 PN/DP MFP, including the SIPLUS variant, from V3.1.0 to before V3.1.5, and recommends updating to V3.1.5 or later. Siemens scores it 7.7 for this product (per Siemens ProductCERT SSA-398330).

Is CVE-2023-38408 exploited in the wild?

It is not in the CISA KEV catalog as of 2026-11-19 (catalog version 2026.11.18), and CISA's SSVC entry records exploitation as none. Qualys released a working proof of concept, and FIRST EPSS gives it 0.797, the 99.6th percentile, in the 2026-11-18 dataset (per CISA KEV, CVE.org and FIRST EPSS).