regreSSHion: OpenSSH CVE-2024-6387 Puts 14 Million Servers at Risk of Unauthenticated Root RCE

Proactive Security for the AI Era
NodeZero continuously and autonomously pentests infrastructure, identity, cloud, and now web applications, chaining weaknesses across every domain the way real attackers do. Every finding ships with replayable proof showing exploitable business impact, not theoretical risk.
A signal-handler race condition that was patched in 2006 silently regressed into OpenSSH in 2021, and for three years nobody noticed. CVE-2024-6387, named regreSSHion by Qualys, allows any unauthenticated attacker on the internet to execute code as root on vulnerable sshd instances. With more than 14 million internet-exposed servers running affected versions at time of disclosure, this is one of the most broadly impactful remote code execution vulnerabilities in recent memory. Patch to OpenSSH 9.8p1 or set LoginGraceTime 0 before the end of day.
Vulnerability Overview
OpenSSH's sshd daemon allows clients a configurable grace period (LoginGraceTime, default 120 seconds) to complete authentication after connecting. When that period expires without successful authentication, sshd sends itself a SIGALRM signal to terminate the session. The SIGALRM handler calls syslog(), malloc(), and free(), which are not async-signal-safe. If a signal arrives while sshd is inside one of these functions on the main thread, the program state is undefined. An attacker who sends thousands of connections per hour can statistically win this race condition repeatedly, using the resulting heap corruption to achieve code execution as the sshd process user, which on most Linux distributions is root.
The vulnerability exists in versions 8.5p1 through 9.7p1 on glibc-based Linux systems. The glibc heap allocator's behavior under corruption is a critical dependency for exploitation; systems using musl libc (Alpine Linux) or BSD malloc (OpenBSD) are unexploitable or unaffected. On 32-bit systems without ASLR, Qualys demonstrated exploitation in their lab with a few thousand connections. On 64-bit systems with ASLR, exploitation requires brute-forcing address randomization across tens of thousands of attempts over several hours.
Connect without authenticating
Attacker opens TCP connection to port 22 on the target. No credentials required at any stage of the attack.
Wait for LoginGraceTime to expire
Attacker allows the connection to sit idle until the grace period (default 120 seconds) expires, triggering SIGALRM in sshd.
Race the signal handler
If SIGALRM fires while sshd is inside malloc/free/syslog, heap state becomes inconsistent. Attacker repeats this thousands of times to corrupt the allocator metadata in a controlled way.
Control heap layout
Through repeated connections and carefully timed signals, the attacker shapes the heap to place attacker-controlled data at a predictable location relative to a vulnerable object.
Achieve code execution as root
Once heap layout is controlled, the attacker overwrites a function pointer or return address and redirects execution. sshd runs as root on most Linux distributions, giving full system access.
Subscribe to unlock Indicators of Compromise
Free subscribers unlock full IOC lists, Sigma detection rules, remediation steps, and every daily briefing.
Remediation
The definitive fix is upgrading to OpenSSH 9.8p1 or later. Major distributions shipped patches within 48 hours of the July 1, 2024 disclosure: Debian backported the fix to OpenSSH 9.2p1-2+deb12u3, Ubuntu 22.04 LTS to 1:8.9p1-3ubuntu0.10, RHEL 9 to openssh-8.7p1-38.el9, and Alpine Linux to 9.7_p1-r2 with the race condition patched at the source level.
If immediate upgrade is not possible: set LoginGraceTime 0 in /etc/ssh/sshd_config and run 'systemctl reload sshd'. This disables the timeout mechanism entirely, which eliminates the SIGALRM trigger but also removes a built-in protection against unauthenticated connection floods. Compensate by enforcing per-IP rate limits at the firewall level (allow a maximum of 10 new SSH connections per IP per minute) and enabling fail2ban or equivalent.
Additional hardening: disable password authentication in favor of public key only (PasswordAuthentication no), restrict SSH access by source IP using AllowFrom in sshd_config or firewall rules, and consider moving sshd to a non-standard port to reduce automated scanning noise.
Upgrade OpenSSH to 9.8p1 or later
Run 'apt upgrade openssh-server', 'yum update openssh-server', or equivalent for your distribution. Verify with 'ssh -V' after upgrade. Restart sshd after patching.
Apply interim mitigation if upgrade is not immediate
Add 'LoginGraceTime 0' to /etc/ssh/sshd_config. Run 'systemctl reload sshd'. Confirm with 'sshd -T | grep logingracetime'. Pair with firewall-level rate limiting to compensate for removed DoS protection.
Restrict SSH access by source IP
Configure firewall rules (iptables, ufw, firewalld, or cloud security groups) to allow port 22 only from known management networks. This eliminates the attack surface entirely for unauthenticated internet-based exploitation attempts.
Enable public key authentication and disable passwords
Set 'PasswordAuthentication no' and 'ChallengeResponseAuthentication no' in sshd_config. Public key auth paths are not affected by the SIGALRM race condition.
Audit exposed instances with Shodan or internal scanner
Run Qualys' free scanner script or use Shodan dorks to identify vulnerable versions across your external attack surface. Prioritize internet-facing servers, bastion hosts, and jump servers.
Briefings like this, every morning before 9am.
Threat intel, active CVEs, and campaign alerts, distilled for practitioners. 50,000+ subscribers. No noise.
Detection
Exploitation leaves a distinctive network and log signature: thousands of short-lived connections to port 22 from a single IP, each lasting approximately 120 seconds before disconnect. The authentication log will show repeated 'Connection closed by [IP] port [N] [preauth]' entries at 120-second intervals from the attacking IP.
At the host level, monitor for sshd worker process crashes using journalctl or /var/log/auth.log. A successful race condition win may cause sshd to log a segfault or abnormal termination before the attacker gains code execution. The sshd parent process respawns workers automatically, so brief crash loops visible in system logs are a key indicator.
Netflow or firewall logs will show an unusually high connection rate to port 22 from a single external IP over several hours, well above the expected authentication retry patterns of automated scanners.
Subscribe to unlock Sigma Detection Rules
Free subscribers unlock full IOC lists, Sigma detection rules, remediation steps, and every daily briefing.
Subscribe to unlock Sigma Hunt Queries
Free subscribers unlock full IOC lists, Sigma detection rules, remediation steps, and every daily briefing.
Subscribe to unlock WAF Detection Rules
Free subscribers unlock full IOC lists, Sigma detection rules, remediation steps, and every daily briefing.
The bottom line
regreSSHion (CVE-2024-6387) is a 2006 vulnerability that came back to haunt 14 million servers after silently regressing in 2021. The signal-handler race condition gives unauthenticated attackers root-level code execution if they can sustain thousands of connections to port 22 over several hours. Patch to OpenSSH 9.8p1 now. If that is not possible today, set LoginGraceTime 0 and restrict SSH to known management IPs at the firewall level. Do both.
This analysis is generic. create a free account to score threats like this against your own stack.
Frequently asked questions
What is CVE-2024-6387 regreSSHion?
CVE-2024-6387, named regreSSHion by Qualys, is a signal-handler race condition in sshd (the OpenSSH server daemon). When an SSH client connects but does not complete authentication within the LoginGraceTime window (default 120 seconds), sshd sends itself a SIGALRM signal to clean up. The SIGALRM handler calls async-signal-unsafe functions including syslog() and malloc()/free(), which are not safe to call from a signal handler. An attacker who sends a high volume of connections can win this race condition repeatedly, corrupting the glibc heap in a way that eventually allows arbitrary code execution as root. The vulnerability is a regression of CVE-2006-5051, which was originally patched in OpenSSH 4.4p1 in 2006.
Which OpenSSH versions are affected?
Versions 8.5p1 through 9.7p1 are affected on glibc-based Linux systems. OpenSSH versions older than 4.4p1 are also affected unless they were explicitly patched for CVE-2006-5051 or CVE-2008-4109. OpenSSH 9.8p1 and later are fixed. OpenBSD is not affected regardless of version because it uses a different signal-handling mechanism. macOS and Windows OpenSSH implementations are considered unexploitable due to differences in their memory allocators.
How hard is this to exploit?
Exploitation requires winning a race condition under real-world conditions, which is difficult but achievable. Qualys demonstrated successful exploitation in a controlled lab environment against a 32-bit Linux system. On 64-bit systems with ASLR enabled, exploitation requires brute-forcing address space layout randomization, which increases the required connection count to tens of thousands and extends the attack window to six to eight hours. The exploitation window is real enough that CISA added this to the Known Exploited Vulnerabilities catalog on July 3, 2024.
What is the fix for CVE-2024-6387?
Upgrade to OpenSSH 9.8p1 or later, which fixes the race condition by restructuring the signal handler to use only async-signal-safe functions. If an immediate upgrade is not possible, set LoginGraceTime 0 in /etc/ssh/sshd_config and reload sshd. This disables the grace-period timeout entirely, eliminating the vulnerable code path. Note that setting LoginGraceTime 0 removes a denial-of-service protection; monitor for connection floods if you apply this interim mitigation. Most major Linux distributions released patched packages within 24 to 48 hours of disclosure.
Why is this called regreSSHion?
The name regreSSHion, coined by Qualys, is a portmanteau of regression and SSH. The vulnerability is called a regression because the exact same signal-handler race condition was first discovered and fixed in 2006 as CVE-2006-5051. The fix was included in OpenSSH 4.4p1. When OpenSSH 8.5p1 was released in March 2021, the protective code introduced in 2006 was inadvertently removed during a refactor, silently reintroducing the vulnerability. It remained undetected for over three years, present in every OpenSSH release from 8.5p1 through 9.7p1.
How do I detect exploitation attempts?
Monitor sshd logs for a high volume of authentication failures from a single IP within a short window, particularly where sessions are dropped at the grace period boundary (LoginGraceTime expiry). Look for repeated sshd child process crashes or respawns in system logs (journalctl -u ssh or /var/log/auth.log). Network-level indicators include thousands of TCP SYN packets to port 22 from a single source IP over a short timeframe. Shodan exposure can be checked with the query 'product:OpenSSH version:8.5p1,8.6p1,8.7p1,8.8p1,8.9p1,9.0p1,9.1p1,9.2p1,9.3p1,9.4p1,9.5p1,9.6p1,9.7p1'.
Sources & references
Free resources
Critical CVE Reference Card 2025–2026
25 actively exploited vulnerabilities with CVSS scores, exploit status, and patch availability. Print it, pin it, share it with your SOC team.
Ransomware Incident Response Playbook
Step-by-step 24-hour IR checklist covering detection, containment, eradication, and recovery. Built for SOC teams, IR leads, and CISOs.
Get threat intel before your inbox does.
50,000+ security professionals read Decryption Digest for early warnings on zero-days, ransomware, and nation-state campaigns. Free, daily, no spam.
Unsubscribe anytime. We never sell your data.

Founder & Cybersecurity Evangelist, Decryption Digest
Cybersecurity professional with expertise in threat intelligence, vulnerability research, and enterprise security. Covers zero-days, ransomware, and nation-state operations for 50,000+ security professionals every morning.
