Summary
CVE-2024-6387 lives in the SIGALRM handler that OpenSSH uses to enforce its authentication timeout. The handler calls functions that are not safe to use in a signal context; with the right timing that corrupts memory structures and can lead to code execution as root.
The bug was originally fixed in 2006 and reintroduced by a 2020 code change — hence the “regression” in its name. Exploitation is slow and difficult (hours under lab conditions), but given how many SSH servers face the internet, the scale of exposure is enormous.
Advisory details
Root cause: an unsafe call in signal context
If a client does not finish authentication within LoginGraceTime, sshd raises SIGALRM to tear the connection down. When the handler calls functions that are not async-signal-safe, it can corrupt data structures another code path left half-written.
An attacker who disconnects at exactly the timeout boundary can retry that condition again and again; the odds are low per attempt but the attempts are trivially automated.
Exposure check
analyst@ubuntu:~$ ssh -V 2>&1 && dpkg -l openssh-server | tail -n 1 OpenSSH_9.6p1 Ubuntu-3ubuntu13.4, OpenSSL 3.0.13 ii openssh-server 1:9.6p1-3ubuntu13.4 amd64 # within 8.5p1 - 9.7p1 — affected range
Figure 1 — Identifying the installed OpenSSH version
The second check is the timeout setting. The default of 120 seconds gives an attacker a comfortable race window.
analyst@ubuntu:~$ sudo sshd -T | grep -E 'logingracetime|permitrootlogin|maxstartups' logingracetime 120 permitrootlogin prohibit-password maxstartups 10:30:100 # default value — mitigation suggests 0 or a much lower setting
Figure 2 — Reading the effective configuration
Remediation
The primary fix is a package update. If that has to wait, LoginGraceTime 0 closes the race window — but it raises the risk of connection-exhaustion denial of service, so it should be paired with a sensible MaxStartups.
analyst@ubuntu:~$ sudo apt install --only-upgrade openssh-server && sudo systemctl restart ssh && ssh -V Setting up openssh-server (1:9.6p1-3ubuntu13.5) ... OpenSSH_9.6p1 Ubuntu-3ubuntu13.5, OpenSSL 3.0.13 # distribution patch applied (the package revision moves, not the upstream version)
Figure 3 — Applying and verifying the distribution patch
Do not trust the version number alone
Distributions backport the fix without changing the upstream version string. Verify through the package revision in ssh -V or through apt changelog.
Log hunting
Exploitation attempts generate a large number of connections that close before authentication completes. Heavy “Timeout before authentication” logging from a single source is a strong indicator.
analyst@ubuntu:/var/log$ grep -c 'Timeout before authentication' auth.log && grep -oE 'Timeout before authentication for [0-9.]+' auth.log | awk '{print $NF}' | sort | uniq -c | sort -rn | head -n 3 8341 8102 193.142.1xx.57 214 45.61.1xx.8 12 10.0.0.31 # 8102 half-finished sessions from a single IP — automated attempts
Figure 4 — Distribution of incomplete authentication attempts
Conclusion
regreSSHion reminded the industry that old fixes can come back undone, and that even the most trusted service is not exempt. The practical conclusion: putting SSH behind a bastion or zero-trust access layer is a far more durable defence than winning every patch race.
Sources
Test it in your own environment
We continuously scan your server fleet for critical services, patch status and exposure.