CWE-362
Allowed-with-ReviewConcurrent Execution using Shared Resource with Improper Synchronization ('Race Condition')
Abstraction: Class · Status: Draft
The product contains a concurrent code sequence that requires temporary, exclusive access to a shared resource, but a timing window exists in which the shared resource can be modified by another code sequence operating concurrently.
2926 vulnerabilities reference this CWE, most recent first.
GHSA-F4JQ-V948-J29C
Vulnerability from github – Published: 2022-11-02 12:00 – Updated: 2022-11-03 12:00A race condition was addressed with improved locking. This issue is fixed in iOS 16.1 and iPadOS 16, macOS Ventura 13. An app may be able to execute arbitrary code with kernel privileges.
{
"affected": [],
"aliases": [
"CVE-2022-42806"
],
"database_specific": {
"cwe_ids": [
"CWE-362"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2022-11-01T20:15:00Z",
"severity": "HIGH"
},
"details": "A race condition was addressed with improved locking. This issue is fixed in iOS 16.1 and iPadOS 16, macOS Ventura 13. An app may be able to execute arbitrary code with kernel privileges.",
"id": "GHSA-f4jq-v948-j29c",
"modified": "2022-11-03T12:00:26Z",
"published": "2022-11-02T12:00:43Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2022-42806"
},
{
"type": "WEB",
"url": "https://support.apple.com/en-us/HT213488"
},
{
"type": "WEB",
"url": "https://support.apple.com/en-us/HT213489"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:L/AC:H/PR:N/UI:R/S:U/C:H/I:H/A:H",
"type": "CVSS_V3"
}
]
}
GHSA-F5P9-J34Q-PWCC
Vulnerability from github – Published: 2026-02-17 21:27 – Updated: 2026-02-19 21:56Summary
Multiple shared maps are accessed without consistent synchronization across goroutines. Under concurrent activity, Go runtime can trigger fatal error: concurrent map read and map write, causing C2 process crash (availability loss).
Vulnerable Component(with code examples)
Operator relay map had mixed access patterns (iteration and mutation without a single lock policy):
// vulnerable pattern (operator session map)
for sessionID, op := range OPERATORS { // iteration path
...
}
// concurrent mutation path elsewhere
OPERATORS[operatorSession] = &operator_t{...}
delete(OPERATORS, operatorSession)
Port-forwarding session map had read/write paths guarded inconsistently:
// vulnerable pattern (port forward map)
if sess, ok := PortFwds[id]; ok { // read path
...
}
PortFwds[id] = newSession // write path
delete(PortFwds, id) // delete path
FTP stream map similarly mixed concurrent iteration with mutation:
// vulnerable pattern (FTP stream map)
for token, stream := range FTPStreams { // iteration path
...
}
FTPStreams[token] = stream // write path
delete(FTPStreams, token) // delete path
Attack Vector
- Attacker (or stress traffic in authenticated flows) triggers high concurrency in normal control paths.
- Operator sessions connect/disconnect while message forwarding and file-transfer workflows are active.
- Concurrent read/write hits shared maps.
- Go runtime panics with concurrent map read/write error.
- C2 component exits, producing denial of service.
Proof of Concept
- Start C2 server with active operator session(s) in a lab environment.
- Generate rapid operator session churn (connect/disconnect loops).
- Simultaneously drive agent message tunnel traffic and/or file transfer activity.
- Observe crash signature in logs:
fatal error: concurrent map read and map write. - Optional: run with race detector in dev build to confirm race locations.
Impact
- C2 service interruption due to process panic/crash.
- Operational instability under load or deliberate churn.
- Repeated crash-restart cycles can degrade command reliability and incident response workflows.
{
"affected": [
{
"package": {
"ecosystem": "Go",
"name": "github.com/jm33-m0/emp3r0r/core"
},
"ranges": [
{
"events": [
{
"introduced": "0"
},
{
"fixed": "0.0.0-20260212232424-ea4d074f081d"
}
],
"type": "ECOSYSTEM"
}
]
}
],
"aliases": [
"CVE-2026-26201"
],
"database_specific": {
"cwe_ids": [
"CWE-362",
"CWE-663"
],
"github_reviewed": true,
"github_reviewed_at": "2026-02-17T21:27:58Z",
"nvd_published_at": "2026-02-19T20:25:42Z",
"severity": "HIGH"
},
"details": "## Summary\n\nMultiple shared maps are accessed without consistent synchronization across goroutines. Under concurrent activity, Go runtime can trigger `fatal error: concurrent map read and map write`, causing C2 process crash (availability loss).\n\n## Vulnerable Component(with code examples)\n\nOperator relay map had mixed access patterns (iteration and mutation without a single lock policy):\n\n```go\n// vulnerable pattern (operator session map)\nfor sessionID, op := range OPERATORS { // iteration path\n ...\n}\n\n// concurrent mutation path elsewhere\nOPERATORS[operatorSession] = \u0026operator_t{...}\ndelete(OPERATORS, operatorSession)\n```\n\nPort-forwarding session map had read/write paths guarded inconsistently:\n\n```go\n// vulnerable pattern (port forward map)\nif sess, ok := PortFwds[id]; ok { // read path\n ...\n}\n\nPortFwds[id] = newSession // write path\ndelete(PortFwds, id) // delete path\n```\n\nFTP stream map similarly mixed concurrent iteration with mutation:\n\n```go\n// vulnerable pattern (FTP stream map)\nfor token, stream := range FTPStreams { // iteration path\n ...\n}\n\nFTPStreams[token] = stream // write path\ndelete(FTPStreams, token) // delete path\n```\n\n## Attack Vector\n\n1. Attacker (or stress traffic in authenticated flows) triggers high concurrency in normal control paths.\n2. Operator sessions connect/disconnect while message forwarding and file-transfer workflows are active.\n3. Concurrent read/write hits shared maps.\n4. Go runtime panics with concurrent map read/write error.\n5. C2 component exits, producing denial of service.\n\n## Proof of Concept\n\n1. Start C2 server with active operator session(s) in a lab environment.\n2. Generate rapid operator session churn (connect/disconnect loops).\n3. Simultaneously drive agent message tunnel traffic and/or file transfer activity.\n4. Observe crash signature in logs: `fatal error: concurrent map read and map write`.\n5. Optional: run with race detector in dev build to confirm race locations.\n\n## Impact\n\n- C2 service interruption due to process panic/crash.\n- Operational instability under load or deliberate churn.\n- Repeated crash-restart cycles can degrade command reliability and incident response workflows.",
"id": "GHSA-f5p9-j34q-pwcc",
"modified": "2026-02-19T21:56:27Z",
"published": "2026-02-17T21:27:58Z",
"references": [
{
"type": "WEB",
"url": "https://github.com/jm33-m0/emp3r0r/security/advisories/GHSA-f5p9-j34q-pwcc"
},
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2026-26201"
},
{
"type": "WEB",
"url": "https://github.com/jm33-m0/emp3r0r/commit/ea4d074f081dac6293f3aec38f01def5f08d5af5"
},
{
"type": "PACKAGE",
"url": "https://github.com/jm33-m0/emp3r0r"
},
{
"type": "WEB",
"url": "https://github.com/jm33-m0/emp3r0r/releases/tag/v3.21.2"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:4.0/AV:N/AC:H/AT:P/PR:L/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:H",
"type": "CVSS_V4"
}
],
"summary": "emp3r0r Affected by Concurrent Map Access DoS (panic/crash)"
}
GHSA-F5RG-254C-X94V
Vulnerability from github – Published: 2024-02-07 00:30 – Updated: 2024-02-15 21:31PX4 Autopilot 1.14 and earlier, due to the lack of synchronization mechanism for loading geofence data, has a Race Condition vulnerability in the geofence.cpp and mission_feasibility_checker.cpp. This will result in the drone uploading overlapping geofences and mission routes.
{
"affected": [],
"aliases": [
"CVE-2024-24254"
],
"database_specific": {
"cwe_ids": [
"CWE-362"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2024-02-06T22:16:15Z",
"severity": "MODERATE"
},
"details": "PX4 Autopilot 1.14 and earlier, due to the lack of synchronization mechanism for loading geofence data, has a Race Condition vulnerability in the geofence.cpp and mission_feasibility_checker.cpp. This will result in the drone uploading overlapping geofences and mission routes.",
"id": "GHSA-f5rg-254c-x94v",
"modified": "2024-02-15T21:31:26Z",
"published": "2024-02-07T00:30:25Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2024-24254"
},
{
"type": "WEB",
"url": "https://github.com/Drone-Lab/PX4-Autopilot/blob/report-can-not-pause-vulnerability/Multi-Threaded%20Race%20Condition%20bug%20found%20in%20PX4%20cause%20drone%20can%20not%20PAUSE.md"
},
{
"type": "WEB",
"url": "https://github.com/PX4/PX4-Autopilot"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:N/I:L/A:L",
"type": "CVSS_V3"
}
]
}
GHSA-F5VW-W9V8-6HJH
Vulnerability from github – Published: 2024-12-12 12:31 – Updated: 2024-12-12 12:31Race condition vulnerability in the DDR module Impact: Successful exploitation of this vulnerability may affect service confidentiality.
{
"affected": [],
"aliases": [
"CVE-2024-54102"
],
"database_specific": {
"cwe_ids": [
"CWE-362"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2024-12-12T12:15:23Z",
"severity": "MODERATE"
},
"details": "Race condition vulnerability in the DDR module\nImpact: Successful exploitation of this vulnerability may affect service confidentiality.",
"id": "GHSA-f5vw-w9v8-6hjh",
"modified": "2024-12-12T12:31:15Z",
"published": "2024-12-12T12:31:15Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2024-54102"
},
{
"type": "WEB",
"url": "https://consumer.huawei.com/en/support/bulletin/2024/12"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:L/AC:L/PR:L/UI:R/S:U/C:L/I:H/A:L",
"type": "CVSS_V3"
}
]
}
GHSA-F5W3-Q53F-47JW
Vulnerability from github – Published: 2025-03-10 21:31 – Updated: 2025-03-10 21:31In the Linux kernel, the following vulnerability has been resolved:
tcp: Fix data-races around sysctl_tcp_mtu_probing.
While reading sysctl_tcp_mtu_probing, it can be changed concurrently. Thus, we need to add READ_ONCE() to its readers.
{
"affected": [],
"aliases": [
"CVE-2022-49598"
],
"database_specific": {
"cwe_ids": [
"CWE-362"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2025-02-26T07:01:35Z",
"severity": "MODERATE"
},
"details": "In the Linux kernel, the following vulnerability has been resolved:\n\ntcp: Fix data-races around sysctl_tcp_mtu_probing.\n\nWhile reading sysctl_tcp_mtu_probing, it can be changed concurrently.\nThus, we need to add READ_ONCE() to its readers.",
"id": "GHSA-f5w3-q53f-47jw",
"modified": "2025-03-10T21:31:11Z",
"published": "2025-03-10T21:31:11Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2022-49598"
},
{
"type": "WEB",
"url": "https://git.kernel.org/stable/c/77a04845f0d28a3561494a5f3121488470a968a4"
},
{
"type": "WEB",
"url": "https://git.kernel.org/stable/c/7e8fc428a7f680f1c4994a40e52d7f95a9a93038"
},
{
"type": "WEB",
"url": "https://git.kernel.org/stable/c/aabe9438fdfe004e021d5a206227ec105dbe2416"
},
{
"type": "WEB",
"url": "https://git.kernel.org/stable/c/b0920ca09d9ce19980c8391b9002455baa9c1417"
},
{
"type": "WEB",
"url": "https://git.kernel.org/stable/c/f47d00e077e7d61baf69e46dde3210c886360207"
},
{
"type": "WEB",
"url": "https://git.kernel.org/stable/c/f966773e13cdd3f12baa90071b7b660f6c633ccb"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:N/I:N/A:H",
"type": "CVSS_V3"
}
]
}
GHSA-F5X9-8JWC-25RW
Vulnerability from github – Published: 2022-06-02 20:37 – Updated: 2024-11-19 16:18Impact
Waitress may terminate early due to a thread closing a socket while the main thread is about to call select(). This will lead to the main thread raising an exception that is not handled and then causing the entire application to be killed.
Patches
This issue has been fixed in Waitress 2.1.2 by no longer allowing the WSGI thread to close the socket, instead it is always delegated to the main thread.
Workarounds
There is no work-around, however users using waitress behind a reverse proxy server are less likely to have issues if the reverse proxy always reads the full response.
For more information
If you have any questions or comments about this advisory: * Open an issue in https://github.com/Pylons/waitress/issues (if not sensitive or security related) * email the Pylons Security mailing list: pylons-project-security@googlegroups.com (if security related)
{
"affected": [
{
"package": {
"ecosystem": "PyPI",
"name": "waitress"
},
"ranges": [
{
"events": [
{
"introduced": "2.1.0"
},
{
"fixed": "2.1.2"
}
],
"type": "ECOSYSTEM"
}
]
}
],
"aliases": [
"CVE-2022-31015"
],
"database_specific": {
"cwe_ids": [
"CWE-248",
"CWE-362"
],
"github_reviewed": true,
"github_reviewed_at": "2022-06-02T20:37:48Z",
"nvd_published_at": "2022-05-31T23:15:00Z",
"severity": "HIGH"
},
"details": "### Impact\n\nWaitress may terminate early due to a thread closing a socket while the main thread is about to call select(). This will lead to the main thread raising an exception that is not handled and then causing the entire application to be killed.\n\n### Patches\n\nThis issue has been fixed in Waitress 2.1.2 by no longer allowing the WSGI thread to close the socket, instead it is always delegated to the main thread.\n\n### Workarounds\n\nThere is no work-around, however users using waitress behind a reverse proxy server are less likely to have issues if the reverse proxy always reads the full response.\n\n### For more information\n\nIf you have any questions or comments about this advisory:\n* Open an issue in https://github.com/Pylons/waitress/issues (if not sensitive or security related)\n* email the Pylons Security mailing list: [pylons-project-security@googlegroups.com](mailto:pylons-project-security@googlegroups.com) (if security related)\n",
"id": "GHSA-f5x9-8jwc-25rw",
"modified": "2024-11-19T16:18:32Z",
"published": "2022-06-02T20:37:48Z",
"references": [
{
"type": "WEB",
"url": "https://github.com/Pylons/waitress/security/advisories/GHSA-f5x9-8jwc-25rw"
},
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2022-31015"
},
{
"type": "WEB",
"url": "https://github.com/Pylons/waitress/issues/374"
},
{
"type": "WEB",
"url": "https://github.com/Pylons/waitress/pull/377"
},
{
"type": "WEB",
"url": "https://github.com/Pylons/waitress/commit/4f6789b035610e0552738cdc4b35ca809a592d48"
},
{
"type": "PACKAGE",
"url": "https://github.com/Pylons/waitress"
},
{
"type": "WEB",
"url": "https://github.com/pypa/advisory-database/tree/main/vulns/waitress/PYSEC-2022-205.yaml"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H",
"type": "CVSS_V3"
},
{
"score": "CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N",
"type": "CVSS_V4"
}
],
"summary": "Uncaught Exception (due to a data race) leads to process termination in Waitress"
}
GHSA-F62W-WRRF-X26F
Vulnerability from github – Published: 2026-04-13 06:30 – Updated: 2026-04-13 06:30Race condition vulnerability in the thermal management module. Impact: Successful exploitation of this vulnerability may affect availability.
{
"affected": [],
"aliases": [
"CVE-2026-34861"
],
"database_specific": {
"cwe_ids": [
"CWE-362"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2026-04-13T05:16:03Z",
"severity": "MODERATE"
},
"details": "Race condition vulnerability in the thermal management module.\nImpact: Successful exploitation of this vulnerability may affect availability.",
"id": "GHSA-f62w-wrrf-x26f",
"modified": "2026-04-13T06:30:31Z",
"published": "2026-04-13T06:30:30Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2026-34861"
},
{
"type": "WEB",
"url": "https://consumer.huawei.com/en/support/bulletin/2026/4"
},
{
"type": "WEB",
"url": "https://consumer.huawei.com/en/support/bulletinwearables/2026/4"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:L/AC:L/PR:H/UI:N/S:U/C:L/I:H/A:H",
"type": "CVSS_V3"
}
]
}
GHSA-F66W-R64G-CG46
Vulnerability from github – Published: 2022-05-13 01:27 – Updated: 2022-05-13 01:27Race condition in the Inter-process Communication (IPC) implementation in Google Chrome before 18.0.1025.168 allows attackers to bypass intended sandbox restrictions via unspecified vectors.
{
"affected": [],
"aliases": [
"CVE-2011-3080"
],
"database_specific": {
"cwe_ids": [
"CWE-362"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2012-05-01T10:12:00Z",
"severity": "HIGH"
},
"details": "Race condition in the Inter-process Communication (IPC) implementation in Google Chrome before 18.0.1025.168 allows attackers to bypass intended sandbox restrictions via unspecified vectors.",
"id": "GHSA-f66w-r64g-cg46",
"modified": "2022-05-13T01:27:23Z",
"published": "2022-05-13T01:27:23Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2011-3080"
},
{
"type": "WEB",
"url": "https://exchange.xforce.ibmcloud.com/vulnerabilities/75272"
},
{
"type": "WEB",
"url": "https://oval.cisecurity.org/repository/search/definition/oval%3Aorg.mitre.oval%3Adef%3A15623"
},
{
"type": "WEB",
"url": "http://code.google.com/p/chromium/issues/detail?id=121726"
},
{
"type": "WEB",
"url": "http://googlechromereleases.blogspot.com/2012/04/stable-channel-update_30.html"
},
{
"type": "WEB",
"url": "http://osvdb.org/81646"
},
{
"type": "WEB",
"url": "http://secunia.com/advisories/48992"
},
{
"type": "WEB",
"url": "http://www.securityfocus.com/bid/53309"
},
{
"type": "WEB",
"url": "http://www.securitytracker.com/id?1027001"
}
],
"schema_version": "1.4.0",
"severity": []
}
GHSA-F6G6-54HM-FHXV
Vulnerability from github – Published: 2021-08-25 20:59 – Updated: 2021-08-18 19:58Affected versions of this crate implements Send for Decoder<R> for any R: Read. This allows Decoder<R> to contain R: !Send and carry (move) it to another thread.
This can result in undefined behavior such as memory corruption from data race on R, or dropping R = MutexGuard<_> from a thread that didn't lock the mutex.
The flaw was corrected in commit a34d6e1 by adding trait bound R: Send to the Send impl for Decoder<R>.
{
"affected": [
{
"package": {
"ecosystem": "crates.io",
"name": "libsbc"
},
"ranges": [
{
"events": [
{
"introduced": "0"
},
{
"fixed": "0.1.5"
}
],
"type": "ECOSYSTEM"
}
]
}
],
"aliases": [
"CVE-2020-36440"
],
"database_specific": {
"cwe_ids": [
"CWE-119",
"CWE-362"
],
"github_reviewed": true,
"github_reviewed_at": "2021-08-09T22:36:23Z",
"nvd_published_at": "2021-08-08T06:15:00Z",
"severity": "HIGH"
},
"details": "Affected versions of this crate implements `Send` for `Decoder\u003cR\u003e` for any `R: Read`. This allows `Decoder\u003cR\u003e` to contain `R: !Send` and carry (move) it to another thread.\n\nThis can result in undefined behavior such as memory corruption from data race on `R`, or dropping `R = MutexGuard\u003c_\u003e` from a thread that didn\u0027t lock the mutex.\n\nThe flaw was corrected in commit a34d6e1 by adding trait bound `R: Send` to the `Send` impl for `Decoder\u003cR\u003e`.",
"id": "GHSA-f6g6-54hm-fhxv",
"modified": "2021-08-18T19:58:56Z",
"published": "2021-08-25T20:59:02Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2020-36440"
},
{
"type": "WEB",
"url": "https://github.com/mvertescher/libsbc-rs/commit/a34d6e1"
},
{
"type": "PACKAGE",
"url": "https://github.com/mvertescher/libsbc-rs"
},
{
"type": "WEB",
"url": "https://raw.githubusercontent.com/rustsec/advisory-db/main/crates/libsbc/RUSTSEC-2020-0120.md"
},
{
"type": "WEB",
"url": "https://rustsec.org/advisories/RUSTSEC-2020-0120.html"
}
],
"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"
}
],
"summary": "Data races in libsbc"
}
GHSA-F6PX-W8RH-7R89
Vulnerability from github – Published: 2021-08-02 17:15 – Updated: 2023-09-15 17:59The File Session Manager in Beego 1.10.0 allows local users to read session files because there is a race condition involving file creation within a directory with weak permissions.
{
"affected": [
{
"package": {
"ecosystem": "Go",
"name": "github.com/beego/beego"
},
"ranges": [
{
"events": [
{
"introduced": "0"
},
{
"fixed": "1.12.2"
}
],
"type": "ECOSYSTEM"
}
]
},
{
"package": {
"ecosystem": "Go",
"name": "github.com/astaxie/beego"
},
"ranges": [
{
"events": [
{
"introduced": "0"
},
{
"fixed": "1.12.2"
}
],
"type": "ECOSYSTEM"
}
]
}
],
"aliases": [
"CVE-2019-16354"
],
"database_specific": {
"cwe_ids": [
"CWE-362",
"CWE-732"
],
"github_reviewed": true,
"github_reviewed_at": "2021-07-22T21:51:41Z",
"nvd_published_at": "2019-09-16T15:15:00Z",
"severity": "MODERATE"
},
"details": "The File Session Manager in Beego 1.10.0 allows local users to read session files because there is a race condition involving file creation within a directory with weak permissions.",
"id": "GHSA-f6px-w8rh-7r89",
"modified": "2023-09-15T17:59:24Z",
"published": "2021-08-02T17:15:05Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2019-16354"
},
{
"type": "WEB",
"url": "https://github.com/astaxie/beego/issues/3763"
},
{
"type": "WEB",
"url": "https://github.com/beego/beego/issues/3763"
},
{
"type": "WEB",
"url": "https://github.com/beego/beego/pull/3975"
},
{
"type": "WEB",
"url": "https://github.com/beego/beego/pull/3975/commits/f99cbe0fa40936f2f8dd28e70620c559b6e5e2fd"
},
{
"type": "WEB",
"url": "https://github.com/astaxie/beego/commit/f99cbe0fa40936f2f8dd28e70620c559b6e5e2fd"
},
{
"type": "WEB",
"url": "https://github.com/beego/beego/commit/bac2b31afecc65d9a89f9e473b8006c5edc0c8d1"
},
{
"type": "PACKAGE",
"url": "https://github.com/astaxie/beego"
},
{
"type": "WEB",
"url": "https://github.com/astaxie/beego/blob/v1.12.2/session/sess_file.go#L142"
},
{
"type": "WEB",
"url": "https://pkg.go.dev/vuln/GO-2021-0084"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:H/I:N/A:N",
"type": "CVSS_V3"
}
],
"summary": "Beego has a file creation race condition"
}
Mitigation
In languages that support it, use synchronization primitives. Only wrap these around critical code to minimize the impact on performance.
Mitigation
Use thread-safe capabilities such as the data access abstraction in Spring.
Mitigation
- Minimize the usage of shared resources in order to remove as much complexity as possible from the control flow and to reduce the likelihood of unexpected conditions occurring.
- Additionally, this will minimize the amount of synchronization necessary and may even help to reduce the likelihood of a denial of service where an attacker may be able to repeatedly trigger a critical section (CWE-400).
Mitigation
When using multithreading and operating on shared variables, only use thread-safe functions.
Mitigation
Use atomic operations on shared variables. Be wary of innocent-looking constructs such as "x++". This may appear atomic at the code layer, but it is actually non-atomic at the instruction layer, since it involves a read, followed by a computation, followed by a write.
Mitigation
Use a mutex if available, but be sure to avoid related weaknesses such as CWE-412.
Mitigation
Avoid double-checked locking (CWE-609) and other implementation errors that arise when trying to avoid the overhead of synchronization.
Mitigation
Disable interrupts or signals over critical parts of the code, but also make sure that the code does not go into a large or infinite loop.
Mitigation
Use the volatile type modifier for critical variables to avoid unexpected compiler optimization or reordering. This does not necessarily solve the synchronization problem, but it can help.
Mitigation MIT-17
Strategy: Environment Hardening
Run your code using the lowest privileges that are required to accomplish the necessary tasks [REF-76]. If possible, create isolated accounts with limited privileges that are only used for a single task. That way, a successful attack will not immediately give the attacker access to the rest of the software or its environment. For example, database applications rarely need to run as the database administrator, especially in day-to-day operations.
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.