CWE-366
AllowedRace Condition within a Thread
Abstraction: Base · Status: Draft
If two threads of execution use a resource simultaneously, there exists the possibility that resources may be used while invalid, in turn making the state of execution undefined.
36 vulnerabilities reference this CWE, most recent first.
GHSA-MC8H-8Q98-G5HR
Vulnerability from github – Published: 2023-02-24 16:23 – Updated: 2023-02-24 16:23The remove_dir_all crate is a Rust library that offers additional features over the Rust standard library fs::remove_dir_all function. It suffers the same class of failure as the code it was layering over: TOCTOU race conditions, with the ability to cause arbitrary paths to be deleted by substituting a symlink for a path after the type of the path was checked.
Thanks to the Rust security team for identifying the problem and alerting us to it.
{
"affected": [
{
"package": {
"ecosystem": "crates.io",
"name": "remove_dir_all"
},
"ranges": [
{
"events": [
{
"introduced": "0"
},
{
"fixed": "0.8.0"
}
],
"type": "ECOSYSTEM"
}
]
}
],
"aliases": [],
"database_specific": {
"cwe_ids": [
"CWE-366",
"CWE-367"
],
"github_reviewed": true,
"github_reviewed_at": "2023-02-24T16:23:59Z",
"nvd_published_at": null,
"severity": "LOW"
},
"details": "The `remove_dir_all` crate is a Rust library that offers additional features over the Rust standard library `fs::remove_dir_all` function. It suffers the same class of failure as the code it was layering over: TOCTOU race conditions, with the ability to cause arbitrary paths to be deleted by substituting a symlink for a path after the type of the path was checked.\n\nThanks to the Rust security team for identifying the problem and alerting us to it.",
"id": "GHSA-mc8h-8q98-g5hr",
"modified": "2023-02-24T16:23:59Z",
"published": "2023-02-24T16:23:59Z",
"references": [
{
"type": "WEB",
"url": "https://github.com/XAMPPRocky/remove_dir_all/security/advisories/GHSA-mc8h-8q98-g5hr"
},
{
"type": "WEB",
"url": "https://github.com/XAMPPRocky/remove_dir_all/commit/7247a8b6ee59fc99bbb69ca6b3ca4bfd8c809ead"
},
{
"type": "PACKAGE",
"url": "https://github.com/XAMPPRocky/remove_dir_all"
},
{
"type": "WEB",
"url": "https://rustsec.org/advisories/RUSTSEC-2023-0018.html"
}
],
"schema_version": "1.4.0",
"severity": [],
"summary": "Race Condition Enabling Link Following and Time-of-check Time-of-use (TOCTOU) Race Condition in remove_dir_all"
}
GHSA-PW2F-XMGC-F22M
Vulnerability from github – Published: 2026-05-28 12:30 – Updated: 2026-07-20 12:33In the Linux kernel, the following vulnerability has been resolved:
RDMA/mlx4: Fix mis-use of RCU in mlx4_srq_event()
Sashiko points out the radix_tree itself is RCU safe, but nothing ever frees the mlx4_srq struct with RCU, and it isn't even accessed within the RCU critical section. It also will crash if an event is delivered before the srq object is finished initializing.
Use the spinlock since it isn't easy to make RCU work, use refcount_inc_not_zero() to protect against partially initialized objects, and order the refcount_set() to be after the srq is fully initialized.
{
"affected": [],
"aliases": [
"CVE-2026-46181"
],
"database_specific": {
"cwe_ids": [
"CWE-366"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2026-05-28T10:16:33Z",
"severity": "HIGH"
},
"details": "In the Linux kernel, the following vulnerability has been resolved:\n\nRDMA/mlx4: Fix mis-use of RCU in mlx4_srq_event()\n\nSashiko points out the radix_tree itself is RCU safe, but nothing ever\nfrees the mlx4_srq struct with RCU, and it isn\u0027t even accessed within the\nRCU critical section. It also will crash if an event is delivered before\nthe srq object is finished initializing.\n\nUse the spinlock since it isn\u0027t easy to make RCU work, use\nrefcount_inc_not_zero() to protect against partially initialized objects,\nand order the refcount_set() to be after the srq is fully initialized.",
"id": "GHSA-pw2f-xmgc-f22m",
"modified": "2026-07-20T12:33:00Z",
"published": "2026-05-28T12:30:32Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2026-46181"
},
{
"type": "WEB",
"url": "https://security.access.redhat.com/data/csaf/v2/vex/2026/cve-2026-46181.json"
},
{
"type": "WEB",
"url": "https://git.kernel.org/stable/c/c9341307ea16b9395c2e4c9c94d8499d91fe31d0"
},
{
"type": "WEB",
"url": "https://git.kernel.org/stable/c/8b7833f3bce35cb0d01c1503781523c099c675f0"
},
{
"type": "WEB",
"url": "https://git.kernel.org/stable/c/1e2a44875b6afb4add1115f7f3351dcbeb6f273d"
},
{
"type": "WEB",
"url": "https://bugzilla.redhat.com/show_bug.cgi?id=2482532"
},
{
"type": "WEB",
"url": "https://access.redhat.com/security/cve/CVE-2026-46181"
},
{
"type": "WEB",
"url": "https://access.redhat.com/errata/RHSA-2026:41236"
},
{
"type": "WEB",
"url": "https://access.redhat.com/errata/RHSA-2026:36216"
},
{
"type": "WEB",
"url": "https://access.redhat.com/errata/RHSA-2026:35896"
},
{
"type": "WEB",
"url": "https://access.redhat.com/errata/RHSA-2026:35894"
},
{
"type": "WEB",
"url": "https://access.redhat.com/errata/RHSA-2026:35863"
},
{
"type": "WEB",
"url": "https://access.redhat.com/errata/RHSA-2026:34443"
},
{
"type": "WEB",
"url": "https://access.redhat.com/errata/RHSA-2026:34095"
},
{
"type": "WEB",
"url": "https://access.redhat.com/errata/RHSA-2026:34094"
},
{
"type": "WEB",
"url": "https://access.redhat.com/errata/RHSA-2026:33900"
},
{
"type": "WEB",
"url": "https://access.redhat.com/errata/RHSA-2026:25217"
},
{
"type": "WEB",
"url": "https://access.redhat.com/errata/RHSA-2026:25121"
},
{
"type": "WEB",
"url": "https://access.redhat.com/errata/RHSA-2026:25120"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H",
"type": "CVSS_V3"
}
]
}
GHSA-QHP7-446P-XQ88
Vulnerability from github – Published: 2023-11-09 21:30 – Updated: 2024-06-25 21:31A race condition was found in the QXL driver in the Linux kernel. The qxl_mode_dumb_create() function dereferences the qobj returned by the qxl_gem_object_create_with_handle(), but the handle is the only one holding a reference to it. This flaw allows an attacker to guess the returned handle value and trigger a use-after-free issue, potentially leading to a denial of service or privilege escalation.
{
"affected": [],
"aliases": [
"CVE-2023-39198"
],
"database_specific": {
"cwe_ids": [
"CWE-366",
"CWE-416"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2023-11-09T20:15:08Z",
"severity": "HIGH"
},
"details": "A race condition was found in the QXL driver in the Linux kernel. The qxl_mode_dumb_create() function dereferences the qobj returned by the qxl_gem_object_create_with_handle(), but the handle is the only one holding a reference to it. This flaw allows an attacker to guess the returned handle value and trigger a use-after-free issue, potentially leading to a denial of service or privilege escalation.",
"id": "GHSA-qhp7-446p-xq88",
"modified": "2024-06-25T21:31:10Z",
"published": "2023-11-09T21:30:38Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2023-39198"
},
{
"type": "WEB",
"url": "https://access.redhat.com/errata/RHSA-2024:2394"
},
{
"type": "WEB",
"url": "https://access.redhat.com/errata/RHSA-2024:2950"
},
{
"type": "WEB",
"url": "https://access.redhat.com/errata/RHSA-2024:3138"
},
{
"type": "WEB",
"url": "https://access.redhat.com/security/cve/CVE-2023-39198"
},
{
"type": "WEB",
"url": "https://bugzilla.redhat.com/show_bug.cgi?id=2218332"
},
{
"type": "WEB",
"url": "https://lists.debian.org/debian-lts-announce/2024/06/msg00016.html"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:L/AC:H/PR:H/UI:N/S:C/C:H/I:H/A:H",
"type": "CVSS_V3"
}
]
}
GHSA-V727-F437-6CXX
Vulnerability from github – Published: 2023-12-21 21:30 – Updated: 2024-08-02 15:31A race condition was found in the GSM 0710 tty multiplexor in the Linux kernel. This issue occurs when two threads execute the GSMIOC_SETCONF ioctl on the same tty file descriptor with the gsm line discipline enabled, and can lead to a use-after-free problem on a struct gsm_dlci while restarting the gsm mux. This could allow a local unprivileged user to escalate their privileges on the system.
{
"affected": [],
"aliases": [
"CVE-2023-6546"
],
"database_specific": {
"cwe_ids": [
"CWE-362",
"CWE-366",
"CWE-416"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2023-12-21T20:15:08Z",
"severity": "HIGH"
},
"details": "A race condition was found in the GSM 0710 tty multiplexor in the Linux kernel. This issue occurs when two threads execute the GSMIOC_SETCONF ioctl on the same tty file descriptor with the gsm line discipline enabled, and can lead to a use-after-free problem on a struct gsm_dlci while restarting the gsm mux. This could allow a local unprivileged user to escalate their privileges on the system.",
"id": "GHSA-v727-f437-6cxx",
"modified": "2024-08-02T15:31:16Z",
"published": "2023-12-21T21:30:31Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2023-6546"
},
{
"type": "WEB",
"url": "https://github.com/torvalds/linux/commit/3c4f8333b582487a2d1e02171f1465531cde53e3"
},
{
"type": "WEB",
"url": "https://www.zerodayinitiative.com/advisories/ZDI-CAN-20527"
},
{
"type": "WEB",
"url": "https://bugzilla.redhat.com/show_bug.cgi?id=2255498"
},
{
"type": "WEB",
"url": "https://access.redhat.com/security/cve/CVE-2023-6546"
},
{
"type": "WEB",
"url": "https://access.redhat.com/errata/RHSA-2024:4970"
},
{
"type": "WEB",
"url": "https://access.redhat.com/errata/RHSA-2024:4731"
},
{
"type": "WEB",
"url": "https://access.redhat.com/errata/RHSA-2024:4729"
},
{
"type": "WEB",
"url": "https://access.redhat.com/errata/RHSA-2024:4577"
},
{
"type": "WEB",
"url": "https://access.redhat.com/errata/RHSA-2024:2697"
},
{
"type": "WEB",
"url": "https://access.redhat.com/errata/RHSA-2024:2621"
},
{
"type": "WEB",
"url": "https://access.redhat.com/errata/RHSA-2024:2394"
},
{
"type": "WEB",
"url": "https://access.redhat.com/errata/RHSA-2024:2093"
},
{
"type": "WEB",
"url": "https://access.redhat.com/errata/RHSA-2024:1614"
},
{
"type": "WEB",
"url": "https://access.redhat.com/errata/RHSA-2024:1612"
},
{
"type": "WEB",
"url": "https://access.redhat.com/errata/RHSA-2024:1607"
},
{
"type": "WEB",
"url": "https://access.redhat.com/errata/RHSA-2024:1306"
},
{
"type": "WEB",
"url": "https://access.redhat.com/errata/RHSA-2024:1253"
},
{
"type": "WEB",
"url": "https://access.redhat.com/errata/RHSA-2024:1250"
},
{
"type": "WEB",
"url": "https://access.redhat.com/errata/RHSA-2024:1055"
},
{
"type": "WEB",
"url": "https://access.redhat.com/errata/RHSA-2024:1019"
},
{
"type": "WEB",
"url": "https://access.redhat.com/errata/RHSA-2024:1018"
},
{
"type": "WEB",
"url": "https://access.redhat.com/errata/RHSA-2024:0937"
},
{
"type": "WEB",
"url": "https://access.redhat.com/errata/RHSA-2024:0930"
},
{
"type": "WEB",
"url": "http://www.openwall.com/lists/oss-security/2024/04/10/18"
},
{
"type": "WEB",
"url": "http://www.openwall.com/lists/oss-security/2024/04/10/21"
},
{
"type": "WEB",
"url": "http://www.openwall.com/lists/oss-security/2024/04/11/7"
},
{
"type": "WEB",
"url": "http://www.openwall.com/lists/oss-security/2024/04/11/9"
},
{
"type": "WEB",
"url": "http://www.openwall.com/lists/oss-security/2024/04/12/1"
},
{
"type": "WEB",
"url": "http://www.openwall.com/lists/oss-security/2024/04/12/2"
},
{
"type": "WEB",
"url": "http://www.openwall.com/lists/oss-security/2024/04/16/2"
},
{
"type": "WEB",
"url": "http://www.openwall.com/lists/oss-security/2024/04/17/1"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H",
"type": "CVSS_V3"
}
]
}
GHSA-VJVQ-RCQJ-PWVP
Vulnerability from github – Published: 2023-06-13 12:30 – Updated: 2023-06-13 12:30Race Condition within a Thread in GitHub repository it-novum/openitcockpit prior to 4.6.5.
{
"affected": [],
"aliases": [
"CVE-2023-3218"
],
"database_specific": {
"cwe_ids": [
"CWE-366"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2023-06-13T11:15:08Z",
"severity": "MODERATE"
},
"details": "Race Condition within a Thread in GitHub repository it-novum/openitcockpit prior to 4.6.5.",
"id": "GHSA-vjvq-rcqj-pwvp",
"modified": "2023-06-13T12:30:18Z",
"published": "2023-06-13T12:30:18Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2023-3218"
},
{
"type": "WEB",
"url": "https://github.com/it-novum/openitcockpit/commit/2c2c243964dda97a82eddb3804e39f9665c574bb"
},
{
"type": "WEB",
"url": "https://huntr.dev/bounties/94d50b11-20ca-46e3-9086-dd6836421675"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.0/AV:N/AC:L/PR:H/UI:N/S:U/C:N/I:H/A:H",
"type": "CVSS_V3"
}
]
}
GHSA-XC56-V745-V4G3
Vulnerability from github – Published: 2022-05-24 17:44 – Updated: 2025-01-14 21:31Race Condition within a Thread vulnerability in iscsi_snapshot_comm_core in Synology DiskStation Manager (DSM) before 6.2.3-25426-3 allows remote attackers to execute arbitrary code via crafted web requests.
{
"affected": [],
"aliases": [
"CVE-2021-26569"
],
"database_specific": {
"cwe_ids": [
"CWE-362",
"CWE-366"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2021-03-12T07:15:00Z",
"severity": "HIGH"
},
"details": "Race Condition within a Thread vulnerability in iscsi_snapshot_comm_core in Synology DiskStation Manager (DSM) before 6.2.3-25426-3 allows remote attackers to execute arbitrary code via crafted web requests.",
"id": "GHSA-xc56-v745-v4g3",
"modified": "2025-01-14T21:31:41Z",
"published": "2022-05-24T17:44:30Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2021-26569"
},
{
"type": "WEB",
"url": "https://www.synology.com/security/advisory/Synology_SA_20_26"
},
{
"type": "WEB",
"url": "https://www.zerodayinitiative.com/advisories/ZDI-21-338"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H",
"type": "CVSS_V3"
}
]
}
Mitigation
Use locking functionality. This is the recommended solution. Implement some form of locking mechanism around code which alters or reads persistent data in a multithreaded environment.
Mitigation
Create resource-locking validation checks. If no inherent locking mechanisms exist, use flags and signals to enforce your own blocking scheme when resources are being used by other threads of execution.
CAPEC-26: Leveraging Race Conditions
The adversary targets a race condition occurring when multiple processes access and manipulate the same resource concurrently, and the outcome of the execution depends on the particular order in which the access takes place. The adversary can leverage a race condition by "running the race", modifying the resource and modifying the normal execution flow. For instance, a race condition can occur while accessing a file: the adversary can trick the system by replacing the original file with their version and cause the system to read the malicious file.
CAPEC-29: Leveraging Time-of-Check and Time-of-Use (TOCTOU) Race Conditions
This attack targets a race condition occurring between the time of check (state) for a resource and the time of use of a resource. A typical example is file access. The adversary can leverage a file access race condition by "running the race", meaning that they would modify the resource between the first time the target program accesses the file and the time the target program uses the file. During that period of time, the adversary could replace or modify the file, causing the application to behave unexpectedly.