CVEReports
Reports
CVEReports

Automated vulnerability intelligence platform. Comprehensive reports for high-severity CVEs generated by AI.

Product

  • Home
  • Reports
  • Sitemap

Company

  • About
  • Privacy Policy
  • Terms of Service

© 2026 CVEReports. All rights reserved.

Powered by Google Gemini & CVE Feed

|
•

CVE-2024-6387
CVSS 8.1|EPSS 4.25%

regreSSHion: The Ghost of 2006 Returns to Haunt OpenSSH

Alon Barad
Alon Barad
Software Engineer•December 30, 2025•6 min read
PoC Available
CISA KEV Listed

Executive Summary (TL;DR)

OpenSSH's sshd accidentally made an unsafe function call inside a signal handler. If a remote attacker disconnects at the exact nanosecond the server handles a login timeout, they can corrupt the heap and potentially gain root access. It takes a few hours of trying, but the door is definitely unlocked.

A signal handler race condition in OpenSSH's server (sshd) allows unauthenticated remote code execution (RCE) as root on glibc-based Linux systems. This is a regression of a vulnerability originally patched in 2006.

The Hook: Blast from the Past

In the world of cybersecurity, we love to talk about 'novel' attacks. We fantasize about AI-driven polymorphic malware or quantum-breaking crypto attacks. But sometimes, the industry just trips over its own shoelaces. Enter regreSSHion (CVE-2024-6387).

This isn't just a vulnerability; it's a history lesson. Back in 2006, Mark Dowd discovered a signal handler race condition in OpenSSH (CVE-2006-5051). It was patched, we all clapped, and we moved on. Fast forward to October 2020, OpenSSH version 8.5p1 was released, and somewhere in the refactoring chaos, a developer accidentally removed the guardrails preventing this exact bug.

So, for the last four years, the internet's most critical remote administration tool has been vulnerable to a bug we thought we killed almost two decades ago. It affects sshd in its default configuration on glibc-based Linux systems. If you're running OpenSSH versions 8.5p1 through 9.7p1, you are effectively driving a car that you thought had airbags, but the mechanic replaced them with whoopee cushions.

The Flaw: Async-Signal-Unsafe Madness

Here is the golden rule of systems programming: Do not do complex things inside a signal handler. A signal handler is like an emergency brake; when it's pulled (e.g., when a timer expires), the CPU stops whatever it's doing immediately—even if it's in the middle of updating a critical data structure—and jumps to the handler code.

In sshd, there is a LoginGraceTime (usually 120 seconds). If you don't log in within that time, sshd raises a SIGALRM signal to kill the connection. The handler for this signal, sigdie(), is supposed to clean up and exit.

However, in the vulnerable versions, sigdie() eventually calls syslog() to log the error. Here is the problem: syslog() is not async-signal-safe. Internally, syslog() calls malloc() or free() to manage memory.

If the signal interrupts sshd while it is already inside malloc() (processing public keys, for example), and then the signal handler calls syslog() which calls malloc() again, you corrupt the heap's internal state (metadata). It’s like trying to reorganize a library, getting interrupted, and having someone else start reorganizing the same shelf before you put the books back.

The Code: The Smoking Gun

Let's look at the logic that doomed us. The vulnerability relies on the SIGALRM handler invoking logging functions that aren't safe.

In the vulnerable code path, when the grace period expires:

// The signal handler eventually reaches this logic
void
sigdie(const char *fmt, ...)
{
    // ... argument processing ...
    syslog(LOG_INFO, "Timeout before authentication for %s", ip);
    _exit(1);
}

The call to syslog() is the fatal error. In the patched versions (and the original 2006 fix), the code was structured to avoid complex operations in the handler, or #ifdef guards prevented the unsafe code execution.

To fix this in 9.8p1, the OpenSSH team split the logic. Instead of logging directly in the handler, they set a flag or use truly safe primitives:

// The mitigation strategy
static volatile sig_atomic_t alarm_triggered = 0;
 
void
sig_alarm(int sig)
{
    alarm_triggered = 1;
    // Don't touch the heap! Just set the flag and get out.
}

This is basic C programming safety, but in large codebases like OpenSSH, a single #ifdef removal during a refactor can undo years of security posture.

The Exploit: Winning the Race

Exploiting this is not as simple as sending a malicious packet. It is a race condition. The attacker needs to disconnect (or force the timeout) at the exact nanosecond that the sshd process is manipulating the heap.

Here is the attack flow:

  1. Connect: The attacker opens a connection to the target sshd.
  2. Groom: They send specific payloads (like large public keys) to force sshd to allocate and free memory chunks in a predictable way.
  3. Wait: They wait for the LoginGraceTime (120s) to tick down.
  4. Interrupt: The goal is to have the SIGALRM fire exactly when the main sshd process is inside a free() or malloc() call handling the attacker's data.

If the timing is perfect, the recursive malloc inside the signal handler corrupts the glibc heap metadata.

[!NOTE] The Odds: Because of Address Space Layout Randomization (ASLR), the attacker has to guess the memory layout. On 32-bit systems, this was easy. On 64-bit systems, it takes about 10,000 attempts on average to win the race. That sounds like a lot, but in computer time, that's just a few hours of blasting a server.

The Impact: Root for Everyone

If the attacker wins the race, they don't just get a user shell; they get root.

The vulnerable process is the pre-authentication sshd worker, which runs with root privileges to handle key exchange and user validation. By corrupting the heap, the attacker can overwrite function pointers or manipulate internal structures to hijack the instruction pointer (RIP).

Once they have control of RIP, they can execute ROP (Return-Oriented Programming) chains to execute arbitrary shellcode.

While the 6-8 hour time requirement limits mass-scanning "spray and pray" attacks, it is absolutely viable for targeted attacks against high-value infrastructure. If you are a nation-state actor and you need into a specific database server, running a script for a day is a small price to pay.

The Fix: Patch or Perish

The remediation is straightforward: Update OpenSSH.

Vendors scrambled to release patches for OpenSSH 9.8p1. If you are on Ubuntu, Debian, RedHat, or Alphine, apt update or dnf update is your best friend right now.

Mitigation Strategy (If you can't patch):

If you are stuck on a legacy system or an embedded device where patching is hard, you can apply a configuration workaround. Set LoginGraceTime to 0 in sshd_config.

# /etc/ssh/sshd_config
LoginGraceTime 0

This disables the timeout entirely. While this prevents the signal handler race (because the signal never fires), it exposes you to a different problem: Denial of Service. An attacker can open thousands of connections and just sit there, exhausting your server's maximum connection slots. It is a "pick your poison" scenario, but a DoS is generally preferable to RCE.

Official Patches

OpenSSHOpenSSH 9.8 Release Notes

Fix Analysis (1)

Technical Appendix

CVSS Score
8.1/ 10
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H
EPSS Probability
4.25%
Top 4% most exploited
14,000,000
Estimated exposed hosts via Shodan

Affected Systems

OpenSSH 8.5p1 through 9.7p1Linux systems using glibc (musl-based systems like Alpine are essentially immune)

Affected Versions Detail

ProductAffected VersionsFixed Version
OpenSSH
OpenBSD
>= 8.5p1, < 9.8p19.8p1
AttributeDetail
CWE IDCWE-364: Signal Handler Race Condition
CVSS Score8.1 (High)
Attack VectorNetwork (Port 22)
Privileges RequiredNone (Unauthenticated)
ImpactComplete Confidentiality, Integrity, and Availability
Exploit DifficultyHigh (Requires winning race condition, approx 10k attempts)

MITRE ATT&CK Mapping

MITRE ATT&CK Mapping

T1190Exploit Public-Facing Application
Initial Access
T1068Exploitation for Privilege Escalation
Privilege Escalation
CWE-364
Signal Handler Race Condition

The software handles a signal in a way that causes a race condition, potentially leading to a crash or code execution.

Exploit Resources

Known Exploits & Detection

QualysOriginal technical advisory and details on the race condition
GitHubProof of Concept exploit script targeting glibc-based Linux

Vulnerability Timeline

Vulnerability Timeline

Original bug (CVE-2006-5051) patched.
2006-09-28
OpenSSH 8.5p1 released, reintroducing the bug.
2020-10-01
Qualys discovers the regression.
2024-05-20
CVE-2024-6387 publicly disclosed and patched.
2024-07-01

References & Sources

  • [1]Qualys Research Blog on regreSSHion
Related Intelligence
CVE-2006-5051

Subscribe to updates

Get the latest CVE analysis reports delivered to your inbox.

Attack Flow Diagram

Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.
Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.