A new OpenSSH unauthenticated remote code execution (RCE) vulnerability dubbed "regreSSHion" gives root privileges on glibc-based Linux systems.
OpenSSH is a suite of networking utilities based on the Secure Shell (SSH) protocol. It is extensively used for secure remote login, remote server management and administration, and file transfers via SCP and SFTP.
The flaw, discovered by researchers at Qualys in May 2024, and assigned the identifier CVE-2024-6387, is due to a signal handler race condition in sshd that allows unauthenticated remote attackers to execute arbitrary code as root.
"If a client does not authenticate within LoginGraceTime seconds (120 by default), then sshd's SIGALRM handler is called asynchronously and calls various functions that are not async-signal-safe," explains a Debian security bulletin.
"A remote unauthenticated attacker can take advantage of this flaw to execute arbitrary code with root privileges."
Exploitation of regreSSHion can have severe consequences for the targeted servers, potentially leading to complete system takeover.
"This vulnerability, if exploited, could lead to full system compromise where an attacker can execute arbitrary code with the highest privileges, resulting in a complete system takeover, installation of malware, data manipulation, and the creation of backdoors for persistent access. It could facilitate network propagation, allowing attackers to use a compromised system as a foothold to traverse and exploit other vulnerable systems within the organization."
❖ QualysDespite the flaw's severity, Qualys says regreSSHion is hard to exploit and requires multiple attempts to achieve the necessary memory corruption.
However, it's noted that AI tools may be used to overcome the practical difficulties and increase the successful exploitation rate.
Qualys has also published a more technical write-up that delves deeper into the exploitation process and potential mitigation strategies.
Mitigating regreSSHion
The regreSSHion flaw impacts OpenSSH servers on Linux from version 8.5p1 up to, but not including 9.8p1.
Versions 4.4p1 up to, but not including 8.5p1 are not vulnerable to CVE-2024-6387 thanks to a patch for CVE-2006-5051, which secured a previously unsafe function.
Versions older than 4.4p1 are vulnerable to regreSSHion unless they are patched for CVE-2006-5051 and CVE-2008-4109.
Qualys also notes that OpenBSD systems are not impacted by this flaw thanks to a secure mechanism introduced back in 2001.
The security researchers also note that while regreSSHion likely also exists on macOS and Windows, its exploitability on these systems hasn't been confirmed. A separate analysis is required to determine if those operating systems are vulnerable.
To address or mitigate the regreSSHion vulnerability in OpenSSH, the following actions are recommended:
- Apply the latest available update for the OpenSSH server (version 9.8p1), which fixes the vulnerability.
- Restrict SSH access using network-based controls such as firewalls and implement network segmentation to prevent lateral movement.
- If the OpenSSH server cannot be updated immediately, set the 'LoginGraceTime' to 0 in the sshd configuration file, but note that this can expose the server to denial-of-service attacks.
Scans from Shodan and Censys reveal over 14 million internet-exposed OpenSSH servers, but Qualys confirmed a vulnerable status for 700,000 instances based on its CSAM 3.0 data.
Comments
Sloth - 3 days ago
I get that the Qualys guy is a fan of The Interrupters, but do we really need a quote at the beginning of each damn paragraph?
GT500 - 3 days ago
I just realized that the CentOS 8 Stream repository mirror list is offline, so I can't check for updates. That probably means my automated update script hasn't been running either, since DNF just errors out. I guess I should have migrated to AlmaLinux or Rocky Linux some time ago, but I never expected the CentOS project to pull the plug like that. Usually enterprise OS lifespans are a lot longer. I guess CentOS truly is dead.
GT500 - 3 days ago
Well, that was the easiest migration I've ever done. Wish I'd done when CentOS 8 was EOL rather than migrating to CentOS 8 Stream...
edmoncu - 3 days ago
My ubuntu server that's fully patched shows: OpenSSH_8.9p1 Ubuntu-3ubuntu0.10, OpenSSL 3.0.2 15 Mar 2022
My debian 12 server that's fully patched shows: OpenSSH_9.2p1 Debian-2+deb12u3, OpenSSL 3.0.13 30 Jan 2024
Quoting "The regreSSHion flaw impacts OpenSSH servers on Linux from version 8.5p1 up to, but not including 9.8p1.", does it mean my servers are impacted?
GT500 - 3 days ago
Package maintainers will usually merge security patches into older versions of software. You may need to check if the distributions you are using have released patches for OpenSSH to address this issue.
edmoncu - 3 days ago
Thanks. Got it! Both seemed to have patched the vulnerability with older versions of their existing packages.
Debian : https://lists.debian.org/debian-security-announce/2024/msg00135.html
Ubuntu : https://launchpad.net/ubuntu/+source/openssh/1:8.9p1-3ubuntu0.10