TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

RegreSSHion: RCE in OpenSSH's server, on glibc-based Linux systems

830 pointsby robinhoodexe11 months ago

43 comments

FiloSottile11 months ago
Interestingly, the RCE fix was &quot;smuggled&quot; in public almost a month ago.<p><pre><code> When PerSourcePenalties are enabled, sshd(8) will monitor the exit status of its child pre-auth session processes. Through the exit status, it can observe situations where the session did not authenticate as expected. These conditions include when the client repeatedly attempted authentication unsucessfully (possibly indicating an attack against one or more accounts, e.g. password guessing), or when client behaviour caused sshd to crash (possibly indicating attempts to exploit sshd). When such a condition is observed, sshd will record a penalty of some duration (e.g. 30 seconds) against the client&#x27;s address. </code></pre> <a href="https:&#x2F;&#x2F;github.com&#x2F;openssh&#x2F;openssh-portable&#x2F;commit&#x2F;81c1099d22b81ebfd20a334ce986c4f753b0db29">https:&#x2F;&#x2F;github.com&#x2F;openssh&#x2F;openssh-portable&#x2F;commit&#x2F;81c1099d2...</a><p>It&#x27;s not really a reversable patch that gives anything away to attackers: it changes the binary architecture in a way that has the side-effect of removing the specific vulnerability <i>and also</i> mitigates the whole exploit class, if I understand it correctly. Very clever.
评论 #40844217 未加载
评论 #40848598 未加载
评论 #40873188 未加载
NelsonMinar11 months ago
One interesting comment in the OpenSSH release notes<p>&gt; Successful exploitation has been demonstrated on 32-bit Linux&#x2F;glibc systems with ASLR. Under lab conditions, the attack requires on average 6-8 hours of continuous connections up to the maximum the server will accept. Exploitation on 64-bit systems is believed to be possible but has not been demonstrated at this time. It&#x27;s likely that these attacks will be improved upon.<p><a href="https:&#x2F;&#x2F;www.openssh.com&#x2F;releasenotes.html" rel="nofollow">https:&#x2F;&#x2F;www.openssh.com&#x2F;releasenotes.html</a>
评论 #40846354 未加载
jamilbk11 months ago
From the diff introducing the bug [1], the issue according to the analysis is that the function was refactored from this:<p><pre><code> void sigdie(const char *fmt,...) { #ifdef DO_LOG_SAFE_IN_SIGHAND va_list args; va_start(args, fmt); do_log(SYSLOG_LEVEL_FATAL, fmt, args); va_end(args); #endif _exit(1); } </code></pre> to this:<p><pre><code> void sshsigdie(const char *file, const char *func, int line, const char *fmt, ...) { va_list args; va_start(args, fmt); sshlogv(file, func, line, 0, SYSLOG_LEVEL_FATAL, fmt, args); va_end(args); _exit(1); } </code></pre> which lacks the #ifdef.<p>What could have prevented this? More eyes on the pull request? It&#x27;s wild that software nearly the entire world relies on for secure access is maintained by seemingly just two people [2].<p>[1] <a href="https:&#x2F;&#x2F;github.com&#x2F;openssh&#x2F;openssh-portable&#x2F;commit&#x2F;752250caabda3dd24635503c4cd689b32a650794">https:&#x2F;&#x2F;github.com&#x2F;openssh&#x2F;openssh-portable&#x2F;commit&#x2F;752250caa...</a><p>[2] <a href="https:&#x2F;&#x2F;github.com&#x2F;openssh&#x2F;openssh-portable&#x2F;graphs&#x2F;contributors">https:&#x2F;&#x2F;github.com&#x2F;openssh&#x2F;openssh-portable&#x2F;graphs&#x2F;contribut...</a>
评论 #40850351 未加载
评论 #40855285 未加载
评论 #40861761 未加载
评论 #40850205 未加载
评论 #40851965 未加载
fanf211 months ago
It’s also worth reading the release notes <a href="https:&#x2F;&#x2F;www.openssh.com&#x2F;releasenotes.html" rel="nofollow">https:&#x2F;&#x2F;www.openssh.com&#x2F;releasenotes.html</a><p>This is actually an interesting variant of a signal race bug. The vulnerability report says, “OpenBSD is notably not vulnerable, because its SIGALRM handler calls syslog_r(), an async-signal-safer version of syslog() that was invented by OpenBSD in 2001.” So a signal-safety mitigation encouraged OpenBSD developers to put non-trivial code inside signal handlers, which becomes unsafe when ported to other systems. They would have avoided this bug if they had done one of their refactoring sweeps to minimize the amount of code in signal handlers, according to the usual wisdom and common unix code guidelines.
评论 #40844257 未加载
评论 #40844265 未加载
qhwudbebd11 months ago
Once I&#x27;d finished upgrading my openssh instances (which are linked against musl not glibc) I thought it&#x27;d be interesting to have a poke at musl&#x27;s syslog(3) and see if it allocates too and so is easily exploitable in the same way. But as far as I can see, it doesn&#x27;t:<p><a href="https:&#x2F;&#x2F;github.com&#x2F;bminor&#x2F;musl&#x2F;blob&#x2F;master&#x2F;src&#x2F;misc&#x2F;syslog.c">https:&#x2F;&#x2F;github.com&#x2F;bminor&#x2F;musl&#x2F;blob&#x2F;master&#x2F;src&#x2F;misc&#x2F;syslog.c</a><p>Everything there is either on stack or in static variables protected from reentrancy by the lock. The {d,sn,vsn}printf() calls there don&#x27;t allocate in musl, although they might in glibc. Have I missed anything here?
评论 #40847984 未加载
评论 #40845526 未加载
cperciva11 months ago
Patch out for FreeBSD. Not clear if affected (it has only known to be exploitable with glibc, which we don&#x27;t use) but best to be safe.<p><a href="https:&#x2F;&#x2F;www.freebsd.org&#x2F;security&#x2F;advisories&#x2F;FreeBSD-SA-24:04.openssh.asc" rel="nofollow">https:&#x2F;&#x2F;www.freebsd.org&#x2F;security&#x2F;advisories&#x2F;FreeBSD-SA-24:04...</a>
rfmoz11 months ago
From the report:<p>&gt; Finally, if sshd cannot be updated or recompiled, this signal handler race condition can be fixed by simply setting LoginGraceTime to 0 in the configuration file. This makes sshd vulnerable to a denial of service (the exhaustion of all MaxStartups connections), but it makes it safe from the remote code execution presented in this advisory.<p>Setting &#x27;LoginGraceTime 0&#x27; in sshd_config file seems to mitigate the issue.
评论 #40845290 未加载
评论 #40852701 未加载
评论 #40859604 未加载
0x011 months ago
Patch out for Debian 12; Debian 11 not affected.<p><a href="https:&#x2F;&#x2F;security-tracker.debian.org&#x2F;tracker&#x2F;CVE-2024-6387" rel="nofollow">https:&#x2F;&#x2F;security-tracker.debian.org&#x2F;tracker&#x2F;CVE-2024-6387</a>
评论 #40844681 未加载
评论 #40844714 未加载
评论 #40844288 未加载
CJefferson11 months ago
This is a really good find.<p>One thing which (as an independant person, who isn&#x27;t doing any of the work!) is it often feels like in order to &#x27;win&#x27;, people are expected to find a full chain which gives them remote access, rather than just finding one issue, and getting it fixed &#x2F; getting paid for it.<p>It feels to me like finding a single hole should be sufficient -- one memory corruption, one sandbox escape. Maybe at the moment there are just too many little issues, that you need a full end-to-end hack to really convince people to take you seriously, or pay out bounties?
评论 #40844233 未加载
评论 #40844467 未加载
评论 #40844243 未加载
评论 #40844351 未加载
评论 #40847769 未加载
评论 #40844919 未加载
djmdjm11 months ago
OpenSSH release notes: <a href="https:&#x2F;&#x2F;www.openssh.com&#x2F;txt&#x2F;release-9.8" rel="nofollow">https:&#x2F;&#x2F;www.openssh.com&#x2F;txt&#x2F;release-9.8</a><p>Minimal patches for those can&#x27;t&#x2F;don&#x27;t want to upgrade: <a href="https:&#x2F;&#x2F;marc.info&#x2F;?l=oss-security&amp;m=171982317624594&amp;w=2" rel="nofollow">https:&#x2F;&#x2F;marc.info&#x2F;?l=oss-security&amp;m=171982317624594&amp;w=2</a>
评论 #40843921 未加载
acatton11 months ago
Yearly reminder to run your ssh server behind spiped.[1] [2] [3]<p>[1] <a href="https:&#x2F;&#x2F;www.tarsnap.com&#x2F;spiped.html" rel="nofollow">https:&#x2F;&#x2F;www.tarsnap.com&#x2F;spiped.html</a><p>[2] <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=29483092">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=29483092</a><p>[3] <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=28538750">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=28538750</a>
评论 #40846142 未加载
评论 #40848274 未加载
jesprenj11 months ago
&gt; Finally, if sshd cannot be updated or recompiled, this signal handler race condition can be fixed by simply setting LoginGraceTime to 0 in the configuration file. This makes sshd vulnerable to a denial of service (the exhaustion of all MaxStartups connections), but it makes it safe from the remote code execution presented in this advisory.
评论 #40846119 未加载
INTPenis11 months ago
Correct me if I&#x27;m wrong but it seems like sshd on RHEL-based systems is safe because they never call syslog.<p>They run sshd with the -D option already, logging everything to stdout and stderr, as their systemd already catches this output and sends it to journal for logging.<p>So I don&#x27;t see anywhere they would be calling syslog, unless sshd does it on its own.<p>At most maybe add OPTIONS=-e into &#x2F;etc&#x2F;sysconfig&#x2F;sshd.
评论 #40849910 未加载
评论 #40854546 未加载
ttul11 months ago
TLDR: this vulnerability does appear to allow an attacker to potentially gain remote root access on vulnerable Linux systems running OpenSSH, with some important caveats:<p>1. It affects OpenSSH versions 8.5p1 to 9.7p1 on glibc-based Linux systems.<p>2. The exploit is not 100% reliable - it requires winning a race condition.<p>3. On a modern system (Debian 12.5.0 from 2024), the researchers estimate it takes: - ~3-4 hours on average to win the race condition - ~6-8 hours on average to obtain a remote root shell (due to ASLR)<p>4. It requires certain conditions: - The system must be using glibc (not other libc implementations) - 100 simultaneous SSH connections must be allowed (MaxStartups setting) - LoginGraceTime must be set to a non-zero value (default is 120 seconds)<p>5. The researchers demonstrated working exploits on i386 systems. They believe it&#x27;s likely exploitable on amd64 systems as well, but hadn&#x27;t completed that work yet.<p>6. It&#x27;s been patched in OpenSSH 9.8p1 released in June 2024.
评论 #40852542 未加载
评论 #40855494 未加载
评论 #40849714 未加载
评论 #40851980 未加载
megous11 months ago
<p><pre><code> In our experiments, it takes ~10,000 tries on average to win this race condition, so ~3-4 hours with 100 connections (MaxStartups) accepted per 120 seconds (LoginGraceTime). Ultimately, it takes ~6-8 hours on average to obtain a remote root shell, because we can only guess the glibc&#x27;s address correctly half of the time (because of ASLR). </code></pre> MaxStartups default is 10
评论 #40843920 未加载
评论 #40846324 未加载
评论 #40843970 未加载
评论 #40844289 未加载
评论 #40847857 未加载
nfriedly11 months ago
I stopped exposing SSH to the internet years ago. Now I connect over WireGuard, and then run SSH through that when I need to remotely admin something.
评论 #40856575 未加载
letters9011 months ago
&gt; In our experiments, it takes ~10,000 tries on average to win this race condition, so ~3-4 hours with 100 connections (MaxStartups) accepted per 120 seconds (LoginGraceTime). Ultimately, it takes ~6-8 hours on average to obtain a remote root shell, because we can only guess the glibc&#x27;s address correctly half of the time (because of ASLR).<p>Mitigate by using fail2ban?<p>Nice to see that Ubuntu isn&#x27;t affected at all
评论 #40844334 未加载
评论 #40844216 未加载
评论 #40845711 未加载
评论 #40844350 未加载
评论 #40844261 未加载
评论 #40844075 未加载
评论 #40860530 未加载
评论 #40844938 未加载
yjftsjthsd-h11 months ago
&gt; Exploitation on non-glibc systems is conceivable but has not been examined.<p>( <a href="https:&#x2F;&#x2F;www.openssh.com&#x2F;txt&#x2F;release-9.8" rel="nofollow">https:&#x2F;&#x2F;www.openssh.com&#x2F;txt&#x2F;release-9.8</a> )<p>Darn - here I was hoping Alpine was properly immune, but it sounds more like &quot;nobody&#x27;s checked if it works on musl&quot; at this point.
评论 #40846802 未加载
lostmsu11 months ago
Out of curiosity, does Windows have anything as disruptive as signals? I assume it is also not vulnerable, because SSH server there do not use glibc.
评论 #40866759 未加载
ransom153811 months ago
If you are on GCP and don&#x27;t have time to patch, GCP recommends turning off your port 22 for now. <a href="https:&#x2F;&#x2F;cloud.google.com&#x2F;compute&#x2F;docs&#x2F;security-bulletins" rel="nofollow">https:&#x2F;&#x2F;cloud.google.com&#x2F;compute&#x2F;docs&#x2F;security-bulletins</a><p>1. Find things that are 0.0.0.0 port 22, example, <a href="https:&#x2F;&#x2F;gist.github.com&#x2F;james-ransom&#x2F;97e1c8596e28b9f759bac79a34dd92ac" rel="nofollow">https:&#x2F;&#x2F;gist.github.com&#x2F;james-ransom&#x2F;97e1c8596e28b9f759bac79...</a><p>2. Force them to the local network, gcloud compute firewall-rules update default-allow-ssh --source-ranges=10.0.0.0&#x2F;8 --project=$i;
gavinhoward11 months ago
As someone who does unspeakable, but safe, things in signal handlers, I can confirm that it is easy to stray off the path of async-signal-safety.
评论 #40846487 未加载
poikroequ11 months ago
After the xz backdoor a few months ago, I decided to turn off SSH everywhere I don&#x27;t need it, either by disabling it or uninstalling it entirely. While SSH is quite secure, it&#x27;s too lucrative a target, so it will always pose a risk.
评论 #40845778 未加载
评论 #40845843 未加载
评论 #40845944 未加载
djernie11 months ago
RedHat put an 8.1 score on it: <a href="https:&#x2F;&#x2F;access.redhat.com&#x2F;security&#x2F;cve&#x2F;cve-2024-6387" rel="nofollow">https:&#x2F;&#x2F;access.redhat.com&#x2F;security&#x2F;cve&#x2F;cve-2024-6387</a>
评论 #40844605 未加载
sharpshadow11 months ago
How refreshing to read a pure txt on the phone. It displays text better than a dozen websites.
nubinetwork11 months ago
I haven&#x27;t seen an increase of ssh traffic yet, but the alert only went out a couple hours ago... hopefully distros will ship the patches quickly.
评论 #40843961 未加载
评论 #40843950 未加载
marcus0x6211 months ago
Patch out for Arch Linux<p><a href="https:&#x2F;&#x2F;archlinux.org&#x2F;packages&#x2F;core&#x2F;x86_64&#x2F;openssh&#x2F;" rel="nofollow">https:&#x2F;&#x2F;archlinux.org&#x2F;packages&#x2F;core&#x2F;x86_64&#x2F;openssh&#x2F;</a><p><i>edit</i> be sure to manually restart sshd after upgrading; my systems fail during key exchange after package upgrade until restarting the sshd service:<p>% ssh -v 192.168.1.254<p>OpenSSH_9.8p1, OpenSSL 3.3.1 4 Jun 2024<p>... output elided ...<p>debug1: Local version string SSH-2.0-OpenSSH_9.8<p>kex_exchange_identification: read: Connection reset by peer<p>Connection reset by 192.168.1.254 port 22
评论 #40845500 未加载
matthewcroughan11 months ago
For my own setup, I&#x27;m looking into Path Aware Networking (PAN) architectures like SCION to avoid exposing paths to my sshd, without having to set up a VPN or port knocking.<p><a href="https:&#x2F;&#x2F;scion-architecture.net" rel="nofollow">https:&#x2F;&#x2F;scion-architecture.net</a>
评论 #40845746 未加载
Wowfunhappy11 months ago
They note that OpenBSD is not vulnerable. Is macOS also (probably?) safe then?
ementally11 months ago
<a href="https:&#x2F;&#x2F;dustri.org&#x2F;b&#x2F;notes-on-regresshion-on-musl.html" rel="nofollow">https:&#x2F;&#x2F;dustri.org&#x2F;b&#x2F;notes-on-regresshion-on-musl.html</a>
madacol11 months ago
TLDR: these are the safe versions 4.4p1 &lt;= OpenSSH &lt; 8.5p1 AND &gt;= 9.8p1<p>---<p>- OpenSSH &lt; 4.4p1 is vulnerable to this signal handler race condition, if not backport-patched against CVE-2006-5051, or not patched against CVE-2008-4109, which was an incorrect fix for CVE-2006-5051;<p>- 4.4p1 &lt;= OpenSSH &lt; 8.5p1 is not vulnerable to this signal handler race condition (because the &quot;#ifdef DO_LOG_SAFE_IN_SIGHAND&quot; that was added to sigdie() by the patch for CVE-2006-5051 transformed this unsafe function into a safe _exit(1) call);<p>- 8.5p1 &lt;= OpenSSH &lt; 9.8p1 is vulnerable again to this signal handler race condition (because the &quot;#ifdef DO_LOG_SAFE_IN_SIGHAND&quot; was accidentally removed from sigdie()).
Uptrenda11 months ago
Anyone else here just totally crap bricks when they see news like this? Like, I wake up and instantly think all my servers are going to be owned and freak out. Though its usually never that bad, sometimes it is. Looks like in this case my debian servers were fine though.<p>edit: maybe i should add an iptable rule to only allow ssh from my IP.
betaby11 months ago
In some setups I decided to have jumphost via HAproxy ssl as described there <a href="https:&#x2F;&#x2F;www.haproxy.com&#x2F;blog&#x2F;route-ssh-connections-with-haproxy" rel="nofollow">https:&#x2F;&#x2F;www.haproxy.com&#x2F;blog&#x2F;route-ssh-connections-with-hapr...</a> so no ssh directly exposed at all.
评论 #40849945 未加载
maxmalkav11 months ago
Quoting some ska tune in a SSH vulnerability report really caught me off ward, but I loved it.
programmer8611 months ago
I have a Ubuntu 22.10 system with ssh using socket activation. Does this bug still have an impact? I&#x27;ve read that Ubuntu 24.4 is safe because of socket activation. Can any expert here comment?
thenickdude11 months ago
There&#x27;s a purported PoC exploit that delivers shellcode available on GitHub, but I saw someone comment the link here, and then their comment disappeared on the next refresh.
rrix211 months ago
So what are the odds we ever see a viable x86_64 exploit?
MaximilianEmel11 months ago
Was this abused in the wild?
drsanthosh199711 months ago
how to install openssh 9.8p1 in ubuntu 22.04.4 LTS
TacticalCoder11 months ago
And who was notoriously <i>not</i> exploitable? The ones hiding sshd behind port knocks. And fail2ban: would work too. And a restrictive firewall: would help too.<p>I don&#x27;t use port-knocking but I really just don&#x27;t get all those saying: <i>&quot;It&#x27;s security theater&quot;</i>.<p>We had not one but two major OpenSSH &quot;near fiasco&quot; (this RCE and the xz lib thing) that were both rendered unusable for attackers by using port knocking.<p>To me port-knocking is not &quot;security theater&quot;: it <i>adds</i> one layer of defense. It&#x27;s defense-in-depth. Not theater.<p>And the port-knocking sequence doesn&#x27;t have to be always the same: it can, say, change every 30 seconds, using TOTP style secret sequence generation.<p>How many exploits rendered cold dead in their tracks by port-knocking shall we need before people stop saying port-knocking is security theater?<p>Other measures do also help... Like restrictive firewalling rules, which many criticize as &quot;it only helps keep the logs smaller&quot;: no, they don&#x27;t just help keep the logs smaller. I&#x27;m whitelisting the three ISP&#x27;s IP blocks anyone can reasonably be needing to SSH from: now the attacker needs not only the zero-day, but it also need to know he needs to be on one of those three ISPs&#x27; IPs.<p>The argument that consists in saying: <i>&quot;sshd is unexploitable, so nothing else must be done to protect the server&quot;</i> is...<p>Dead.
评论 #40846399 未加载
评论 #40845310 未加载
评论 #40844874 未加载
评论 #40845258 未加载
评论 #40845058 未加载
评论 #40844852 未加载
评论 #40845151 未加载
评论 #40846368 未加载
评论 #40844914 未加载
评论 #40845517 未加载
评论 #40845202 未加载
评论 #40845262 未加载
评论 #40845474 未加载
nj5rq11 months ago
<p><pre><code> OpenBSD is notably not vulnerable, because its SIGALRM handler calls syslog_r(), an async-signal-safer version of syslog() that was invented by OpenBSD in 2001. </code></pre> Saving the day once again.
评论 #40844964 未加载
评论 #40844817 未加载
评论 #40845164 未加载
j16sdiz11 months ago
Now, how many remote exploit do we have in openbsd?
评论 #40844563 未加载
评论 #40844836 未加载
Sparkyte11 months ago
People still use SSH these days?<p>I kid, but really you probably shouldn&#x27;t on Production. You should be exporting your logs and everything else. The host or VM bootstrapped golden images with everything as needed.<p>It is okay to start that way and figure out your enternals but that isn&#x27;t for Production. Production is a locked down closed environment.<p>Recomment from another Hacker News post.
评论 #40862526 未加载
sneak11 months ago
Why are we all still running an ssh server written in an unsafe language in 2024?
评论 #40846562 未加载
评论 #40846655 未加载
评论 #40846541 未加载