CVE-2025-67419

regreSSHion: The Zombie Bug That Just Won't Die

Amit Schendel
Amit Schendel
Senior Security Researcher

Jan 6, 2026·5 min read

Executive Summary (TL;DR)

OpenSSH server (sshd) contains a critical race condition. By manipulating the `LoginGraceTime` timeout, an attacker can interrupt the server's execution flow in a way that corrupts the heap, leading to unauthenticated remote code execution as root. If you are running OpenSSH versions 8.5p1 to 9.7p1 on Linux, patch immediately.

A signal handler race condition in OpenSSH's sshd allows unauthenticated remote code execution (RCE) as root on glibc-based Linux systems. This is a regression of CVE-2006-5051, proving that history doesn't just repeat itself—it recompiles.

The Ghost of Vulnerabilities Past

In the world of cybersecurity, we like to think we're making progress. We build better walls, smarter heuristic scanners, and memory-safe languages. But sometimes, the universe likes to humble us. Enter regreSSHion (CVE-2024-6387), a vulnerability that is effectively a resurrected zombie of a bug we thought we killed in 2006 (CVE-2006-5051).

OpenSSH is the backbone of the internet. It is the "God Mode" protocol used by sysadmins, developers, and automated scripts everywhere. We implicitly trust it. But between versions 8.5p1 and 9.7p1, the developers accidentally reintroduced a race condition in the signal handling logic. It's like locking your front door with a titanium bolt, but leaving the key under the mat because you forgot you moved it there 18 years ago.

The flaw allows an unauthenticated attacker to execute arbitrary code with root privileges. Yes, root. The keys to the kingdom. While the exploit is complex and noisy (taking hours of attempts to win the race), the payoff is total system compromise.

The Cardinal Sin: Async-Signal-Safety

To understand this bug, you need to understand one of the golden rules of C programming: Never do complex work inside a signal handler.

When a program receives a signal (like SIGALRM, which fires when a timer expires), the OS pauses the program's main execution thread abruptly to run the signal handler function. If the main thread was in the middle of a critical operation—say, allocating memory using malloc()—and the signal handler also tries to use malloc() (or free(), or syslog()), you get chaos. The internal structures of the heap (the memory manager) can be left in an inconsistent state.

Here is the logic flow that kills the daemon:

OpenSSH's SIGALRM handler calls syslog() to log that the login grace period expired. syslog() is NOT async-signal-safe because it internally allocates memory. If the signal hits exactly while the main thread is manipulating the heap, the signal handler corrupts the heap metadata. It’s a classic reentrancy bug.

The Code: A History of Violence

Let's look at the offending logic. The vulnerability resides in sshd.c. When a client connects, sshd sets an alarm (usually 120 seconds) defined by LoginGraceTime. If the user doesn't authenticate in time, SIGALRM fires.

The vulnerable handler looked something like this:

// The perilous signal handler
void grace_alarm_handler(int sig) {
    // THIS is the problem. syslog() is not safe here.
    syslog(LOG_CRIT, "Timeout before authentication for %s", ip);
    _exit(1);
}

The fix involves removing the complexity from the signal handler. Instead of logging during the interrupt, we just set a flag and let the main loop handle the shutdown gracefully, or use safe primitive logging.

The Fix (simplified):

// The safe handler
void grace_alarm_handler(int sig) {
    // Just set a volatile flag. No allocations. No locking.
    sig_term_flag = 1;
}

It’s a subtle change. In the vulnerable version, the code blindly assumes it's safe to talk to the logging daemon while interrupting the memory allocator. It wasn't.

Exploitation: Winning the Lottery

Exploiting this is not like a simple buffer overflow where you send a long string and pop a shell. This is a statistical attack. The attacker needs to interrupt sshd at an exact microsecond—specifically, when the public key parsing code is manipulating the heap.

The Attack Strategy:

  1. Connection Flooding: Open a connection to the target sshd.
  2. Timing Manipulation: Send a specific sequence of packets (like public keys) to trigger memory allocations in the main thread.
  3. The Wait: Wait for the LoginGraceTime (default 120s) to expire, causing SIGALRM to fire.
  4. The Collision: Hope that the signal fires exactly when malloc/free is in a critical section.
  5. Heap Feng Shui: If successful, the heap corruption allows overwriting specific structures (like tcache chunks in glibc) to hijack the instruction pointer.

[!NOTE] Reality Check: On average, it takes about ~10,000 attempts to succeed. With default settings, that's roughly 6-8 hours of continuous attack traffic. It’s noisy. Your IDS should be screaming. But if you have no monitoring? You're toast.

Mitigation: Stop the Bleeding

If you can't patch immediately (and let's be honest, updating OpenSSH on 5,000 production servers on a Friday is a nightmare), you have a configuration workaround.

Option 1: The Nuclear Option (Patch) Upgrade to OpenSSH 9.8p1 immediately. This version removes the unsafe code from the signal handler.

Option 2: The Config Workaround Set LoginGraceTime to 0 in your sshd_config.

# /etc/ssh/sshd_config
LoginGraceTime 0

Then restart sshd. This disables the timer entirely, so the signal never fires, and the race condition cannot be triggered.

[!WARNING] Side Effect: Setting LoginGraceTime 0 means connections that hang during authentication will stay open forever. An attacker could simply open thousands of connections and starve your server of resources (Denial of Service). It is a temporary fix, not a solution.

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
0.23%
Top 35% most exploited
14,000,000
via Shodan

Affected Systems

Linux (glibc based)DebianUbuntuFedoraRed Hat Enterprise Linux

Affected Versions Detail

Product
Affected Versions
Fixed Version
OpenSSH
OpenBSD
>= 8.5p1, < 9.8p19.8p1
AttributeDetail
CWE IDCWE-364 (Signal Handler Race Condition)
Attack VectorNetwork (AV:N)
CVSS Score8.1 (High)
Privileges RequiredNone (PR:N)
User InteractionNone (UI:N)
Exploit StatusProof of Concept (High Complexity)
CWE-364
Signal Handler Race Condition

The software handles a signal in a way that causes the application to enter an inconsistent state, specifically by invoking functions that are not async-signal-safe.

Vulnerability Timeline

Original bug CVE-2006-5051 fixed
2006-09-28
Vulnerability reintroduced in OpenSSH 8.5p1
2020-10-01
Qualys discloses regreSSHion (CVE-2024-6387)
2024-07-01
OpenSSH 9.8p1 released with fix
2024-07-01

Subscribe to updates

Get the latest CVE analysis reports delivered to your inbox.