How to fix CVE-2024-6387 – Step-by-Step Guide
CVE-2024-6387 (OpenSSH regreSSHion – Unauthenticated RCE) is a <strong>CRITICAL severity</strong> vulnerability with a CVSS score of 8.1/10. A signal handler race condition in OpenSSH's server (sshd) allows unauthenticated remote code execution as root on glibc-based Linux systems. Affects OpenSSH 8.5p1–9.7p1. Follow the step-by-step guide below to remediate this vulnerability in your infrastructure.
What is OpenSSH regreSSHion – Unauthenticated RCE?
OpenSSH regreSSHion – Unauthenticated RCE (CVE-2024-6387) affects <strong>OpenSSH</strong>. A signal handler race condition in OpenSSH's server (sshd) allows unauthenticated remote code execution as root on glibc-based Linux systems. Affects OpenSSH 8.5p1–9.7p1. It was published on 2024-07-01 and affects <strong>OpenSSH 8.5p1 – 9.7p1 (glibc Linux)</strong>. The fixed version is <strong>OpenSSH 9.8p1+</strong>.
Impact and Risks for your Infrastructure
Full root compromise of the affected SSH server. An attacker can execute arbitrary code without any authentication, gaining complete control of the system.
Step-by-Step Mitigation Guide
To remediate CVE-2024-6387, follow the prioritized mitigation steps: Upgrade OpenSSH to 9.8p1 or later immediately. → Restrict SSH access via firewall: allow only trusted IPs on port 22. → Enable fail2ban or equivalent rate-limiting to slow exploitation attempts. → Set LoginGraceTime 0 in sshd_config as a temporary workaround (disables grace period). → Audit SSH server logs for exploitation attempts (look for connection floods). → Consider moving SSH to a non-standard port or VPN-only access (Tailscale, WireGuard).. Verify the fix using the verification commands below and confirm the patched version is deployed across all affected systems.
- 1Upgrade OpenSSH to 9.8p1 or later immediately.
- 2Restrict SSH access via firewall: allow only trusted IPs on port 22.
- 3Enable fail2ban or equivalent rate-limiting to slow exploitation attempts.
- 4Set LoginGraceTime 0 in sshd_config as a temporary workaround (disables grace period).
- 5Audit SSH server logs for exploitation attempts (look for connection floods).
- 6Consider moving SSH to a non-standard port or VPN-only access (Tailscale, WireGuard).