CVE-2024-6387 - Signal Handler Race Condition

Severity

81%

Complexity

22%

Confidentiality

98%

A signal handler race condition was found in OpenSSH's server (sshd), where a client does not authenticate within LoginGraceTime seconds (120 by default, 600 in old OpenSSH versions), then sshd's SIGALRM handler is called asynchronously. However, this signal handler calls various functions that are not async-signal-safe, for example, syslog().

A security regression (CVE-2006-5051) was discovered in OpenSSH's server (sshd). There is a race condition which can lead to sshd to handle some signals in an unsafe manner. An unauthenticated, remote attacker may be able to trigger it by failing to authenticate within a set time period.

A security regression (CVE-2006-5051) was discovered in OpenSSH's server (sshd). There is a race condition which can lead sshd to handle some signals in an unsafe manner. An unauthenticated, remote attacker may be able to trigger it by failing to authenticate within a set time period.

CVSS 3.1 Base Score 8.1. CVSS Attack Vector: network. CVSS Attack Complexity: high. CVSS Vector: (CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H).

Demo Examples

Signal Handler Race Condition

CWE-364

Signal Handler Race Condition

CWE-364

Demo Examples

Concurrent Execution using Shared Resource with Improper Synchronization ('Race Condition')

CWE-362

This code could be used in an e-commerce application that supports transfers between accounts. It takes the total amount of the transfer, sends it to the new account, and deducts the amount from the original account.


               
NotifyUser("New balance: $newbalance");
FatalError("Bad Transfer Amount");
FatalError("Insufficient Funds");

A race condition could occur between the calls to GetBalanceFromDatabase() and SendNewBalanceToDatabase().

Suppose the balance is initially 100.00. An attack could be constructed as follows:


               
PROGRAM-2 sends a request to update the database, setting the balance to 99.00

At this stage, the attacker should have a balance of 19.00 (due to 81.00 worth of transfers), but the balance is 99.00, as recorded in the database.

To prevent this weakness, the programmer has several options, including using a lock to prevent multiple simultaneous requests to the web application, or using a synchronization mechanism that includes all the code between GetBalanceFromDatabase() and SendNewBalanceToDatabase().

Concurrent Execution using Shared Resource with Improper Synchronization ('Race Condition')

CWE-362

The following function attempts to acquire a lock in order to perform operations on a shared resource.


               
}
pthread_mutex_unlock(mutex);/* access shared resource */

However, the code does not check the value returned by pthread_mutex_lock() for errors. If pthread_mutex_lock() cannot acquire the mutex for any reason, the function may introduce a race condition into the program and result in undefined behavior.

In order to avoid data races, correctly written programs must check the result of thread synchronization functions and appropriately handle all errors, either by attempting to recover from them or reporting it to higher levels.


               
}
return pthread_mutex_unlock(mutex);
return result;
/* access shared resource */

Concurrent Execution using Shared Resource with Improper Synchronization ('Race Condition')

CWE-362

Suppose a processor's Memory Management Unit (MMU) has 5 other shadow MMUs to distribute its workload for its various cores. Each MMU has the start address and end address of "accessible" memory. Any time this accessible range changes (as per the processor's boot status), the main MMU sends an update message to all the shadow MMUs.

Suppose the interconnect fabric does not prioritize such "update" packets over other general traffic packets. This introduces a race condition. If an attacker can flood the target with enough messages so that some of those attack packets reach the target before the new access ranges gets updated, then the attacker can leverage this scenario.

Overview

First reported 7 months ago

2024-07-01 13:15:00

Last updated 3 months ago

2024-11-21 09:49:00

Affected Software

OpenBSD OpenSSH

OpenBSD OpenSSH 4.4 -

4.4

Red Hat Openshift Container Platform 4.0

4.0

NetApp ONTAP Select Deploy Administration Utility

NetApp E-Series SANtricity OS Controller

NetBSD

References

https://access.redhat.com/security/cve/CVE-2024-6387

RHBZ#2294604

https://www.qualys.com/2024/07/01/cve-2024-6387/regresshion.txt

http://www.openwall.com/lists/oss-security/2024/07/01/12

https://github.com/zgzhang/cve-2024-6387-poc

https://ubuntu.com/security/CVE-2024-6387

https://ubuntu.com/security/notices/USN-6859-1

https://www.suse.com/security/cve/CVE-2024-6387.html

https://explore.alas.aws.amazon.com/CVE-2024-6387.html

https://archlinux.org/news/the-sshd-service-needs-to-be-restarted-after-upgrading-to-openssh-98p1/

https://www.openssh.com/txt/release-9.8

https://lists.mindrot.org/pipermail/openssh-unix-announce/2024-July/000158.html

https://lists.mindrot.org/pipermail/openssh-unix-dev/2024-July/041431.html

https://blog.qualys.com/vulnerabilities-threat-research/2024/07/01/regresshion-remote-unauthenticated-code-execution-vulnerability-in-openssh-server

https://www.theregister.com/2024/07/01/regresshion_openssh/

https://news.ycombinator.com/item?id=40843778

https://security-tracker.debian.org/tracker/CVE-2024-6387

https://github.com/oracle/oracle-linux/issues/149

https://github.com/rapier1/hpn-ssh/issues/87

https://stackdiary.com/openssh-race-condition-in-sshd-allows-remote-code-execution/

https://psirt.global.sonicwall.com/vuln-detail/SNWLID-2024-0010

http://www.openwall.com/lists/oss-security/2024/07/01/13

https://security.netapp.com/advisory/ntap-20240701-0001/

http://www.openwall.com/lists/oss-security/2024/07/02/1

https://ftp.netbsd.org/pub/NetBSD/security/advisories/NetBSD-SA2024-002.txt.asc

https://www.freebsd.org/security/advisories/FreeBSD-SA-24:04.openssh.asc

http://www.openwall.com/lists/oss-security/2024/07/03/2

http://www.openwall.com/lists/oss-security/2024/07/03/1

http://www.openwall.com/lists/oss-security/2024/07/03/3

http://www.openwall.com/lists/oss-security/2024/07/03/4

http://www.openwall.com/lists/oss-security/2024/07/03/5

RHSA-2024:4312

https://arstechnica.com/security/2024/07/regresshion-vulnerability-in-openssh-gives-attackers-root-on-linux/

https://github.com/microsoft/azurelinux/issues/9555

https://github.com/Azure/AKS/issues/4379

https://github.com/PowerShell/Win32-OpenSSH/issues/2249

https://github.com/AlmaLinux/updates/issues/629

https://github.com/PowerShell/Win32-OpenSSH/discussions/2248

http://www.openwall.com/lists/oss-security/2024/07/03/11

http://www.openwall.com/lists/oss-security/2024/07/04/1

http://www.openwall.com/lists/oss-security/2024/07/04/2

https://access.redhat.com/security/cve/CVE-2024-6387

Third Party Advisory

RHBZ#2294604

Issue Tracking

https://www.qualys.com/2024/07/01/cve-2024-6387/regresshion.txt

Exploit, Third Party Advisory

http://www.openwall.com/lists/oss-security/2024/07/01/12

Mailing List

https://github.com/zgzhang/cve-2024-6387-poc

Third Party Advisory

https://ubuntu.com/security/CVE-2024-6387

Third Party Advisory

https://ubuntu.com/security/notices/USN-6859-1

Third Party Advisory

https://www.suse.com/security/cve/CVE-2024-6387.html

Third Party Advisory

https://explore.alas.aws.amazon.com/CVE-2024-6387.html

Third Party Advisory

https://archlinux.org/news/the-sshd-service-needs-to-be-restarted-after-upgrading-to-openssh-98p1/

Third Party Advisory

https://www.openssh.com/txt/release-9.8

Release Notes

https://lists.mindrot.org/pipermail/openssh-unix-announce/2024-July/000158.html

Mailing List, Third Party Advisory

https://lists.mindrot.org/pipermail/openssh-unix-dev/2024-July/041431.html

Mailing List, Patch

https://blog.qualys.com/vulnerabilities-threat-research/2024/07/01/regresshion-remote-unauthenticated-code-execution-vulnerability-in-openssh-server

Exploit, Third Party Advisory

https://www.theregister.com/2024/07/01/regresshion_openssh/

Third Party Advisory

https://news.ycombinator.com/item?id=40843778

Issue Tracking, Patch

https://security-tracker.debian.org/tracker/CVE-2024-6387

Third Party Advisory

https://github.com/oracle/oracle-linux/issues/149

Issue Tracking

https://github.com/rapier1/hpn-ssh/issues/87

Issue Tracking

https://stackdiary.com/openssh-race-condition-in-sshd-allows-remote-code-execution/

Third Party Advisory

https://psirt.global.sonicwall.com/vuln-detail/SNWLID-2024-0010

Third Party Advisory

http://www.openwall.com/lists/oss-security/2024/07/01/13

Mailing List

https://security.netapp.com/advisory/ntap-20240701-0001/

Third Party Advisory

http://www.openwall.com/lists/oss-security/2024/07/02/1

Mailing List

https://ftp.netbsd.org/pub/NetBSD/security/advisories/NetBSD-SA2024-002.txt.asc

Third Party Advisory

https://www.freebsd.org/security/advisories/FreeBSD-SA-24:04.openssh.asc

Third Party Advisory

http://www.openwall.com/lists/oss-security/2024/07/03/2

Mailing List

http://www.openwall.com/lists/oss-security/2024/07/03/1

Mailing List

http://www.openwall.com/lists/oss-security/2024/07/03/3

Mailing List

http://www.openwall.com/lists/oss-security/2024/07/03/4

Mailing List

http://www.openwall.com/lists/oss-security/2024/07/03/5

Mailing List

RHSA-2024:4312

Third Party Advisory

https://arstechnica.com/security/2024/07/regresshion-vulnerability-in-openssh-gives-attackers-root-on-linux/

Press/Media Coverage, Third Party Advisory

https://github.com/microsoft/azurelinux/issues/9555

Issue Tracking

https://github.com/Azure/AKS/issues/4379

Issue Tracking

https://github.com/PowerShell/Win32-OpenSSH/issues/2249

Issue Tracking

https://github.com/AlmaLinux/updates/issues/629

Issue Tracking

https://github.com/PowerShell/Win32-OpenSSH/discussions/2248

Issue Tracking

http://www.openwall.com/lists/oss-security/2024/07/03/11

Mailing List

http://www.openwall.com/lists/oss-security/2024/07/04/1

Mailing List

http://www.openwall.com/lists/oss-security/2024/07/04/2

Mailing List

https://sig-security.rocky.page/issues/CVE-2024-6387/

Third Party Advisory

RHSA-2024:4340

https://www.splunk.com/en_us/blog/security/cve-2024-6387-regresshion-vulnerability.html

https://forum.vmssoftware.com/viewtopic.php?f=8&t=9132

http://www.openwall.com/lists/oss-security/2024/07/08/2

http://www.openwall.com/lists/oss-security/2024/07/08/3

RHSA-2024:4389

https://www.akamai.com/blog/security-research/2024-openssh-vulnerability-regression-what-to-know-and-do

https://lists.almalinux.org/archives/list/[email protected]/thread/23BF5BMGFVEVUI2WNVAGMLKT557EU7VY/

http://www.openwall.com/lists/oss-security/2024/07/09/2

http://www.openwall.com/lists/oss-security/2024/07/09/5

http://www.openwall.com/lists/oss-security/2024/07/10/1

http://www.openwall.com/lists/oss-security/2024/07/10/2

http://www.openwall.com/lists/oss-security/2024/07/10/3

http://www.openwall.com/lists/oss-security/2024/07/10/4

http://www.openwall.com/lists/oss-security/2024/07/10/6

https://github.com/openela-main/openssh/commit/e1f438970e5a337a17070a637c1b9e19697cad09

http://www.openwall.com/lists/oss-security/2024/07/11/1

http://www.openwall.com/lists/oss-security/2024/07/11/3

https://www.arista.com/en/support/advisories-notices/security-advisory/19904-security-advisory-0100

RHSA-2024:4469

RHSA-2024:4479

RHSA-2024:4484

RHSA-2024:4474

http://www.openwall.com/lists/oss-security/2024/07/23/4

http://www.openwall.com/lists/oss-security/2024/07/23/6

RHBZ#2294604

Issue Tracking, Third Party Advisory

http://www.openwall.com/lists/oss-security/2024/07/01/12

Mailing List, Third Party Advisory

https://www.openssh.com/txt/release-9.8

Release Notes, Third Party Advisory

https://lists.mindrot.org/pipermail/openssh-unix-dev/2024-July/041431.html

Mailing List, Patch, Third Party Advisory

https://news.ycombinator.com/item?id=40843778

Issue Tracking, Patch, Third Party Advisory

https://github.com/oracle/oracle-linux/issues/149

Issue Tracking, Third Party Advisory

https://github.com/rapier1/hpn-ssh/issues/87

Issue Tracking, Third Party Advisory

http://www.openwall.com/lists/oss-security/2024/07/01/13

Mailing List, Third Party Advisory

http://www.openwall.com/lists/oss-security/2024/07/02/1

Mailing List, Third Party Advisory

http://www.openwall.com/lists/oss-security/2024/07/03/2

Mailing List, Third Party Advisory

http://www.openwall.com/lists/oss-security/2024/07/03/1

Mailing List, Third Party Advisory

http://www.openwall.com/lists/oss-security/2024/07/03/3

Mailing List, Third Party Advisory

http://www.openwall.com/lists/oss-security/2024/07/03/4

Mailing List, Third Party Advisory

http://www.openwall.com/lists/oss-security/2024/07/03/5

Mailing List, Third Party Advisory

https://github.com/microsoft/azurelinux/issues/9555

Issue Tracking, Third Party Advisory

https://github.com/Azure/AKS/issues/4379

Issue Tracking, Third Party Advisory

https://github.com/PowerShell/Win32-OpenSSH/issues/2249

Issue Tracking, Third Party Advisory

https://github.com/AlmaLinux/updates/issues/629

Issue Tracking, Third Party Advisory

https://github.com/PowerShell/Win32-OpenSSH/discussions/2248

Issue Tracking, Third Party Advisory

http://www.openwall.com/lists/oss-security/2024/07/03/11

Mailing List, Third Party Advisory

http://www.openwall.com/lists/oss-security/2024/07/04/1

Mailing List, Third Party Advisory

http://www.openwall.com/lists/oss-security/2024/07/04/2

Mailing List, Third Party Advisory

RHSA-2024:4340

Third Party Advisory

https://www.splunk.com/en_us/blog/security/cve-2024-6387-regresshion-vulnerability.html

Third Party Advisory

https://forum.vmssoftware.com/viewtopic.php?f=8&t=9132

Third Party Advisory

http://www.openwall.com/lists/oss-security/2024/07/08/2

Mailing List, Third Party Advisory

http://www.openwall.com/lists/oss-security/2024/07/08/3

Mailing List, Third Party Advisory

RHSA-2024:4389

Third Party Advisory

https://www.akamai.com/blog/security-research/2024-openssh-vulnerability-regression-what-to-know-and-do

Third Party Advisory

https://lists.almalinux.org/archives/list/[email protected]/thread/23BF5BMGFVEVUI2WNVAGMLKT557EU7VY/

Mailing List, Third Party Advisory

http://www.openwall.com/lists/oss-security/2024/07/09/2

Mailing List, Third Party Advisory

http://www.openwall.com/lists/oss-security/2024/07/09/5

Mailing List, Third Party Advisory

http://www.openwall.com/lists/oss-security/2024/07/10/1

Mailing List, Third Party Advisory

http://www.openwall.com/lists/oss-security/2024/07/10/2

Mailing List, Third Party Advisory

http://www.openwall.com/lists/oss-security/2024/07/10/3

Mailing List, Third Party Advisory

http://www.openwall.com/lists/oss-security/2024/07/10/4

Mailing List, Third Party Advisory

http://www.openwall.com/lists/oss-security/2024/07/10/6

Mailing List, Third Party Advisory

https://github.com/openela-main/openssh/commit/e1f438970e5a337a17070a637c1b9e19697cad09

Third Party Advisory

http://www.openwall.com/lists/oss-security/2024/07/11/1

Mailing List, Third Party Advisory

http://www.openwall.com/lists/oss-security/2024/07/11/3

Mailing List, Third Party Advisory

https://www.arista.com/en/support/advisories-notices/security-advisory/19904-security-advisory-0100

Third Party Advisory

RHSA-2024:4469

Third Party Advisory

RHSA-2024:4479

Third Party Advisory

RHSA-2024:4484

Third Party Advisory

RHSA-2024:4474

Third Party Advisory

http://www.openwall.com/lists/oss-security/2024/07/23/4

Mailing List, Third Party Advisory

http://www.openwall.com/lists/oss-security/2024/07/23/6

Mailing List, Third Party Advisory

http://www.openwall.com/lists/oss-security/2024/07/28/2

http://www.openwall.com/lists/oss-security/2024/07/28/3

https://santandersecurityresearch.github.io/blog/sshing_the_masses.html

https://support.apple.com/kb/HT214119

https://support.apple.com/kb/HT214118

https://support.apple.com/kb/HT214120

http://seclists.org/fulldisclosure/2024/Jul/20

http://seclists.org/fulldisclosure/2024/Jul/18

http://seclists.org/fulldisclosure/2024/Jul/19

https://sig-security.rocky.page/issues/CVE-2024-6387/

https://www.vicarius.io/vsociety/posts/regresshion-an-openssh-regression-error-cve-2024-6387

Stay updated

ExploitPedia is constantly evolving. Sign up to receive a notification when we release additional functionality.

Get in touch

If you'd like to report a bug or have any suggestions for improvements then please do get in touch with us using this form. We will get back to you as soon as we can.