Skip to content
Race condition Write-up Advanced

RegreSSHion (CVE-2024–6387): Dive into the Latest OpenSSH Server Threat

A signal handler race condition in OpenSSH's server allows remote unauthenticated attackers to execute arbitrary code with root privileges on glibc-based Linux systems. The flaw was reintroduced in OpenSSH 8.5p1 when a safety check was accidentally removed.

elniak Follow

Published on infosecwriteups.com

CVE-2024–6387, also known as RegreSSHion, has recently taken the cybersecurity world by storm affecting the famous software — OpenSSH.

ElNiak, on infosecwriteups.com

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely a signal handler race condition: the SIGALRM handler calls syslog(), which calls malloc(), an async-unsafe operation, allowing heap corruption when timed precisely.

What the attacker needed

Target runs glibc-based Linux; OpenSSH version 8.5p1 to 9.8p1; Network access to SSH port; Many connection attempts

The fix

The vulnerability was fixed in OpenSSH 9.8p1; if updating is not possible, disable the async-signal-unsafe code in sshsigdie or set LoginGraceTime to 0 (which may expose to DoS).

How it was found

  1. Prepare the heap by sending packets that allocate and free specific memory chunks.
  2. Send a crafted public key packet, withholding the last byte.
  3. Wait until just before the server's login grace time expires.
  4. Send the final byte to trigger the race condition.
  5. Check the server's response to see if exploitation succeeded.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

OpenSSH is software that lets you log into other computers securely. A race condition is a bug where the timing of actions matters: if two things happen at almost the same moment, the program can get confused. Here, an attacker can send special network messages at just the right time to trick the server into running the attacker's code as the all-powerful root user.

What is Race condition?

Parallel requests reach a state the code assumed could not happen: a coupon used twice, a limit overrun, a check skipped.

More by elniak

View all

28 more disclosed reports, best first.

Similar reports

View all

Same bug class and techniques, clearest first.

Race conditions

The lesson behind this report.

Parallel requests reach a state the code assumed could not happen: a coupon used twice, a limit overrun, a check skipped.