Executive brief
OpenSSH is a widely used suite of secure networking utilities for remote login and file transfer. A vulnerability in its credential management component, ssh-agent, could allow security restrictions to be bypassed when using hardware security tokens (PKCS#11). If a token contains multiple keys, security constraints intended to limit where those keys can be used may only be applied to the first key, potentially allowing unauthorized use of subsequent keys on restricted systems.
Technical details
A logic error exists in the ssh-agent component of OpenSSH before version 9.6. When adding PKCS#11-hosted private keys with destination constraints (introduced in OpenSSH 8.9), the agent only applies these constraints to the first key returned by the PKCS#11 token. If a token hosts multiple keys, the subsequent keys are added to the agent without the specified constraints. A local attacker or a compromised environment could exploit this to use these unconstrained keys for authentication to destinations that should have been restricted by the user's policy. The fix ensures that constraints are iteratively applied to all keys retrieved from the provider.
Affected products
- OpenBSD OpenSSH before 9.6
- Apple macOS Sonoma before 14.4
- Debian Debian Linux 11.0, 12.0
Timeline
- 2023-12-18: disclosed: Initial disclosure and NVD publication
- 2023-12-18: patched: OpenSSH 9.6 released with fix
- 2024-03-07: advisory: Apple released macOS Sonoma 14.4 addressing the issue
References
- http://seclists.org/fulldisclosure/2024/Mar/21
- https://github.com/openssh/openssh-portable/commit/881d9c6af9da4257c69c327c4e2f1508b2fa754b
- https://security.netapp.com/advisory/ntap-20240105-0005/
- https://support.apple.com/kb/HT214084
- https://www.debian.org/security/2023/dsa-5586
- https://www.openssh.com/txt/release-9.6
- https://www.openwall.com/lists/oss-security/2023/12/18/2