---
title: "CWE-368: Context Switching Race Condition"
url: https://radicalnotion.ai/cwe/cwe-368
type: cwe
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."
updated: 2026-11-10
source: RadicalNotion.AI
license: CC BY-NC 4.0 (https://creativecommons.org/licenses/by-nc/4.0/)
---

# CWE-368: Context Switching Race Condition

- **Abstraction:** Base
- **Structure:** Simple
- **Status:** Draft
- **CVEs with this as primary weakness:** 12
- **Of those, in CISA KEV:** 0
- **New in 2026:** 2
- **CWE catalog version:** 4.21

## 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.

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.

## Modes of introduction

| Phase | Note |
| --- | --- |
| Architecture and Design | - |
| Implementation | - |

## Common consequences

| Scope | Impact | Note |
| --- | --- | --- |
| 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 | Description |
| --- | --- |
| 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. |

## Real CVEs with this weakness

| CVE | Title | Severity | CVSS | EPSS | CISA KEV | Published |
| --- | --- | --- | --- | --- | --- | --- |
| CVE-2022-48985 | net: mana: Fix race on per-CQ variable napi work\_done | critical | 9.8 | - | No | 2024-10-21 |
| CVE-2022-21806 | Anker Eufy Homebase 2 mips\_collector appsrv\_server use-after-free vulnerability | critical | 9.8 | - | No | 2022-06-17 |
| CVE-2026-23025 | mm/page\_alloc: prevent pcp corruption with SMP=n | critical | 9.2 | - | No | 2026-01-31 |
| CVE-2021-21941 | Anker Eufy Homebase 2 pushMuxer CreatePushThread use-after-free vulnerability | critical | 9.0 | - | No | 2021-10-12 |
| CVE-2021-32025 | - | high | 8.1 | - | No | 2022-03-09 |
| CVE-2023-54206 | net/sched: flower: fix filter idr initialization | high | 7.8 | - | No | 2025-12-30 |
| CVE-2025-38169 | arm64/fpsimd: Avoid clobbering kernel FPSIMD state with SMSTOP | high | 7.8 | - | No | 2025-07-03 |
| CVE-2022-39189 | Elevation of privilege in Kernel (KVM) | high | 7.8 | - | No | 2022-09-02 |
| CVE-2024-34731 | Elevation of privilege in Framework | high | 7.7 | - | No | 2024-08-15 |
| CVE-2020-8834 | Linux kernel KVM Power8 conflicting use of HSTATE\_HOST\_R1 | medium | 6.5 | - | No | 2020-04-09 |
| CVE-2026-43482 | sched\_ext: Disable preemption between scx\_claim\_exit() and kicking helper work | medium | 5.5 | - | No | 2026-05-13 |
| CVE-2023-53799 | crypto: api - Use work queue in crypto\_destroy\_instance | medium | 4.7 | - | No | 2025-12-09 |

## Related attack patterns (CAPEC)

- [CAPEC-26](https://radicalnotion.ai/capec/capec-26): Leveraging Race Conditions
- [CAPEC-29](https://radicalnotion.ai/capec/capec-29): Leveraging Time-of-Check and Time-of-Use (TOCTOU) Race Conditions

## Related weaknesses

| Relationship | CWE | Name |
| --- | --- | --- |
| Parent | [CWE-362](https://radicalnotion.ai/cwe/cwe-362) | Concurrent Execution using Shared Resource with Improper Synchronization |
| Can also be | [CWE-364](https://radicalnotion.ai/cwe/cwe-364) | Signal Handler Race Condition |

## Taxonomy mappings

| Taxonomy | Entry | Id | Fit |
| --- | --- | --- | --- |
| PLOVER | Context Switching Race Condition | - | - |

## Frequently asked questions

### What is CWE-368?

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.

### What CVEs are caused by CWE-368?

12 recorded CVEs are attributed to CWE-368, including CVE-2022-48985, CVE-2022-21806 and CVE-2026-23025.

### How is CWE-368 detected?

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.)

### What are the consequences of CWE-368?

Exploiting CWE-368 can lead to: Modify Application Data, Read Application Data.

### Is CWE-368 actively exploited?

12 recorded CVEs are caused by CWE-368; none are currently in CISA's KEV catalog of actively exploited flaws.

Primary source: [MITRE CWE](https://cwe.mitre.org/data/definitions/368.html)

---

Source: [RadicalNotion.AI](https://radicalnotion.ai/cwe/cwe-368). Licensed CC BY-NC 4.0; attribute RadicalNotion.AI and link the source page when you reuse this data.
