CWEweakness

CWE-368 Context Switching Race Condition

Official page ↗
Abstraction
Base
Structure
Simple
Status
Draft
Languages
Not Language-Specific
CWE version
5.0

Description

A product performs a series of non-atomic actions to switch between contexts that cross privilege or other security boundaries, but a race condition allows an attacker to modify or misrepresent the product's behavior during the switch.

Extended description

This is commonly seen in web browser vulnerabilities in which the attacker can perform certain actions while the browser is transitioning from a trusted to an untrusted domain, or vice versa, and the browser performs the actions on one domain using the trust level and resources of the other domain.

Common consequences

• Integrity, Confidentiality: Modify Application Data, Read Application Data

Detection methods

• Automated Static Analysis: Automated static analysis, commonly referred to as Static Application Security Testing (SAST), can find some instances of this weakness by analyzing source code (or binary/compiled code) without having to execute it. Typically, this is done by building a model of data flow and control flow, then searching for potentially-vulnerable patterns that connect "sources" (origins of input) with "sinks" (destinations where the data interacts with external components, a lower layer such as the OS, etc.)

Observed examples

• CVE-2009-1837: Chain: race condition (CWE-362) from improper handling of a page transition in web client while an applet is loading (CWE-368) leads to use after free (CWE-416) • CVE-2004-2260: Browser updates address bar as soon as user clicks on a link instead of when the page has loaded, allowing spoofing by redirecting to another page using onUnload method. ** this is one example of the role of "hooks" and context switches, and should be captured somehow - also a race condition of sorts ** • CVE-2004-0191: XSS when web browser executes Javascript events in the context of a new page while it's being loaded, allowing interaction with previous page in different domain. • CVE-2004-2491: Web browser fills in address bar of clicked-on link before page has been loaded, and doesn't update afterward.

Related

Attack pattern · CAPEC (2)

  • CAPEC-26 Leveraging Race Conditions attack pattern
  • CAPEC-29 Leveraging Time-of-Check and Time-of-Use (TOCTOU) Race Conditions attack pattern

Observed example · CVE (4)

  • CVE-2009-1837 Race condition in the NPObjWrapper_NewResolve function in modules/plugin/base/src/nsJSNPRuntime.cpp in xul.dll in Mozilla Firefox 3 before… vulnerability
  • CVE-2004-2260 Opera Browser 7.23, and other versions before 7.50, updates the address bar as soon as the user clicks a link, which allows remote… vulnerability
  • CVE-2004-2491 A race condition in Opera web browser 7.53 Build 3850 causes Opera to fill in the address bar before the page has been loaded, which allows… vulnerability
  • CVE-2004-0191 Mozilla before 1.4.2 executes Javascript events in the context of a new page while it is being loaded, allowing it to interact with the… vulnerability

Can also be · CWE (1)

  • CWE-364 Signal Handler Race Condition weakness

Child of · CWE (1)

  • CWE-362 Concurrent Execution using Shared Resource with Improper Synchronization weakness

Referenced by CAPEC · weakness (2)

  • CAPEC-26 Leveraging Race Conditions attack pattern
  • CAPEC-29 Leveraging Time-of-Check and Time-of-Use (TOCTOU) Race Conditions attack pattern

Referenced by CVE · weakness (6)

  • CVE-2026-3006 Successful exploitation of the race condition vulnerability could allow an attacker to trigger a kernel heap overflow, potentially leading… vulnerability
  • CVE-2024-34731 In multiple functions of TranscodingResourcePolicy.cpp, there is a possible memory corruption due to a race condition. vulnerability
  • CVE-2022-21806 A use-after-free vulnerability exists in the mips_collector appsrv_server functionality of Anker Eufy Homebase 2 2.1.8.5h. vulnerability
  • CVE-2021-32025 An elevation of privilege vulnerability in the QNX Neutrino Kernel of affected versions of QNX Software Development Platform version(s)… vulnerability
  • CVE-2021-21941 A use-after-free vulnerability exists in the pushMuxer CreatePushThread functionality of Anker Eufy Homebase 2 2.1.6.9h. vulnerability
  • CVE-2020-8834 KVM in the Linux kernel on Power8 processors has a conflicting use of HSTATE_HOST_R1 to store r1 state in kvmppc_hv_entry plus in… vulnerability