FreeBSD Project maintainers addressed a high-severity flaw in OpenSSH that could allow remote code execution with elevated privileges.
The maintainers of the FreeBSD Project have released urgent security updates to address a high-severity flaw, tracked as CVE-2024-7589, (CVSS score of 7.4) in OpenSSH. A remote attacker could exploit the vulnerability to execute arbitrary code with elevated privileges.
OpenSSH is an implementation of the SSH protocol suite that offers encrypted and authenticated transport for various services, including remote shell access.
“A signal handler in sshd(8) may call a logging function that is not async- signal-safe. The signal handler is invoked when a client does not authenticate within the LoginGraceTime seconds (120 by default). This signal handler executes in the context of the sshd(8)’s privileged code, which is not sandboxed and runs with full root privileges.” reads the advisory. “This issue is another instance of the problem in CVE-2024-6387 addressed by FreeBSD-SA-24:04.openssh. The faulty code in this case is from the integration of blacklistd in OpenSSH in FreeBSD.”
A race condition in the privileged sshd
context, caused by calling functions that are not async-signal-safe, could allow an attacker to exploit the flaw for unauthenticated remote code execution as root.
CVE-2024-7589 stems from CVE-2024-6387 (aka regreSSHion), which was disclosed in July that can lead to unauthenticated remote code execution with root privileges in glibc-based Linux systems.
In the case of CVE-2024-7589, the faulty code is added to integrate blacklistd in OpenSSH in FreeBSD.
The maintainers explained that to mitigate the signal handler race condition in sshd
, it is possible to set LoginGraceTime
to 0 in /etc/ssh/sshd_config
and restart sshd
. This will prevent remote code execution but may lead to a denial of service due to the exhaustion of all MaxStartups
connections.
FreeBSD users are recommended to upgrade their system to a supported FreeBSD stable version and
restart sshd.
Follow me on Twitter: @securityaffairs and Facebook and Mastodon
Pierluigi Paganini
(SecurityAffairs – hacking, OpenSSH)