CVE-2021-28041
📋 TL;DR
This CVE describes a double-free vulnerability in ssh-agent component of OpenSSH versions before 8.5. It could allow attackers to potentially execute arbitrary code or cause denial of service in specific scenarios where they have access to the agent socket or can forward an agent to a compromised host. Systems running OpenSSH with ssh-agent enabled on affected versions are vulnerable.
💻 Affected Systems
- OpenSSH
📦 What is this software?
Communications Offline Mediation Controller by Oracle
View all CVEs affecting Communications Offline Mediation Controller →
Fedora by Fedoraproject
Fedora by Fedoraproject
Openssh by Openbsd
Solidfire by Netapp
⚠️ Risk & Real-World Impact
Worst Case
Remote code execution leading to complete system compromise if attacker gains access to agent socket or forwards agent to controlled host
Likely Case
Denial of service (ssh-agent crash) or limited memory corruption in constrained environments
If Mitigated
Minimal impact if agent socket access is properly restricted and agent forwarding is disabled
🎯 Exploit Status
Exploitation requires specific conditions: access to agent socket or ability to forward agent to attacker-controlled host. No public exploit code has been documented.
🛠️ Fix & Mitigation
✅ Official Fix
Patch Version: OpenSSH 8.5 and later
Vendor Advisory: https://www.openssh.com/txt/release-8.5
Restart Required: Yes
Instructions:
1. Update OpenSSH to version 8.5 or later using your package manager. 2. For Red Hat/Fedora: 'sudo dnf update openssh'. 3. For Debian/Ubuntu: 'sudo apt update && sudo apt upgrade openssh-client openssh-server'. 4. Restart ssh-agent and sshd services.
🔧 Temporary Workarounds
Restrict ssh-agent socket permissions
linuxLimit access to ssh-agent socket to prevent unauthorized access
chmod 600 ~/.ssh/agent_socket
chown $USER:$USER ~/.ssh/agent_socket
Disable agent forwarding
allPrevent ssh-agent from being forwarded to remote hosts
Add 'ForwardAgent no' to /etc/ssh/ssh_config and ~/.ssh/config
🧯 If You Can't Patch
- Restrict ssh-agent socket permissions to owner-only access
- Disable ssh-agent forwarding in SSH client configurations
🔍 How to Verify
Check if Vulnerable:
Check OpenSSH version with 'ssh -V' or 'sshd -V' and verify it's below 8.5
Check Version:
ssh -V 2>&1 | grep -o 'OpenSSH_[0-9.]*' | cut -d_ -f2
Verify Fix Applied:
Confirm OpenSSH version is 8.5 or higher using 'ssh -V' command
📡 Detection & Monitoring
Log Indicators:
- Unexpected ssh-agent crashes
- Memory corruption errors in system logs
- Failed authentication attempts with agent forwarding
Network Indicators:
- Unusual SSH connections with agent forwarding enabled
- Multiple connection attempts to ssh-agent sockets
SIEM Query:
source="auth.log" AND ("ssh-agent" AND ("crash" OR "segfault" OR "double free"))
🔗 References
- https://github.com/openssh/openssh-portable/commit/e04fd6dde16de1cdc5a4d9946397ff60d96568db
- https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/KQWGII3LQR4AOTPPFXGMTYE7UDEWIUKI/
- https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/TXST2CML2MWY3PNVUXX7FFJE3ATJMNVZ/
- https://security.gentoo.org/glsa/202105-35
- https://security.netapp.com/advisory/ntap-20210416-0002/
- https://www.openssh.com/security.html
- https://www.openssh.com/txt/release-8.5
- https://www.openwall.com/lists/oss-security/2021/03/03/1
- https://www.oracle.com//security-alerts/cpujul2021.html
- https://github.com/openssh/openssh-portable/commit/e04fd6dde16de1cdc5a4d9946397ff60d96568db
- https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/KQWGII3LQR4AOTPPFXGMTYE7UDEWIUKI/
- https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/TXST2CML2MWY3PNVUXX7FFJE3ATJMNVZ/
- https://security.gentoo.org/glsa/202105-35
- https://security.netapp.com/advisory/ntap-20210416-0002/
- https://www.openssh.com/security.html
- https://www.openssh.com/txt/release-8.5
- https://www.openwall.com/lists/oss-security/2021/03/03/1
- https://www.oracle.com//security-alerts/cpujul2021.html