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.
CVE-2024–6387, also known as RegreSSHion, has recently taken the cybersecurity world by storm affecting the famous software — OpenSSH.
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
- Prepare the heap by sending packets that allocate and free specific memory chunks.
- Send a crafted public key packet, withholding the last byte.
- Wait until just before the server's login grace time expires.
- Send the final byte to trigger the race condition.
- 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.