Race Condition Affecting openssh-portable package, versions [8.5p1,9.8p1)


Severity

Recommended
0.0
critical
0
10

CVSS assessment made by Snyk's Security Team. Learn more

Threat Intelligence

Exploit Maturity
Proof of concept
EPSS
0.26% (66th percentile)

Do your applications use this vulnerable package?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications

Snyk Learn

Learn about Race Condition vulnerabilities in an interactive lesson.

Start learning
  • Snyk IDSNYK-UNMANAGED-OPENSSHPORTABLE-7413663
  • published1 Jul 2024
  • disclosed30 Jun 2024
  • creditQualys Security Advisory Team, Jacky Wei En Kung, Daniel Hugenroth, Alastair Beresford

Introduced: 30 Jun 2024

CVE-2024-6387  (opens in a new tab)
CWE-362  (opens in a new tab)

How to fix?

Upgrade openssh-portable to version 9.8p1 or higher.

Overview

Affected versions of this package are vulnerable to Race Condition in OpenSSH's server (sshd) due to a signal handler race condition when a client does not authenticate within LoginGraceTime seconds (120 by default, 600 in old OpenSSH versions).

An attacker can execute arbitrary code as root by exploiting the asynchronous call of the SIGALRM handler, which invokes functions that are not async-signal-safe, such as syslog(). This vulnerability can be exploited by repeated connection attempts that exploit the inconsistent state caused by the interrupted signal handler.

This vulnerability mainly derives from the accidental removal of the #ifdef DO_LOG_SAFE_IN_SIGHAND from sigdie()

Note:

  1. Under lab conditions, the attack requires, on average, 6-8 hours of continuous connections up to the maximum the server will accept.

  2. OpenBSD is notably not vulnerable.

  3. This vulnerability is exploitable remotely on glibc-based Linux systems, where syslog() itself calls async-signal-unsafe functions (for example, malloc() and free())

  4. Successful exploitation has been demonstrated on 32-bit Linux/glibc systems with ASLR.

  5. Exploitation on 64-bit systems is believed to be possible but has not been demonstrated at this time.

  6. Systems that lack ASLR or users of downstream Linux distributions that have modified OpenSSH to disable per-connection ASLR re-randomization may potentially have an easier path to exploitation.

CVSS Scores

version 4.0
version 3.1