---
title: "CAPEC-30: Hijacking a Privileged Thread of Execution"
url: https://radicalnotion.ai/capec/capec-30
type: capec
description: "An adversary hijacks a privileged thread of execution by injecting malicious code into a running process. By using a privleged thread to do their bidding, adversaries can evade process-based detection that would stop an attack that creates a new process. This can lead to an adversary gaining access to the process's memory and can also enable elevated privileges. The most common way to perform this attack is by suspending an existing thread and manipulating its memory."
updated: 2026-06-01
source: RadicalNotion.AI
license: CC BY-NC 4.0 (https://creativecommons.org/licenses/by-nc/4.0/)
---

# CAPEC-30: Hijacking a Privileged Thread of Execution

- **Abstraction:** Standard
- **Status:** Draft
- **Typical severity:** Very High
- **Likelihood of attack:** Low
- **CAPEC catalog version:** 3.9

## Description

An adversary hijacks a privileged thread of execution by injecting malicious code into a running process. By using a privleged thread to do their bidding, adversaries can evade process-based detection that would stop an attack that creates a new process. This can lead to an adversary gaining access to the process's memory and can also enable elevated privileges. The most common way to perform this attack is by suspending an existing thread and manipulating its memory.

## Execution flow

### Step 1: Explore

\[Determine target thread\] The adversary determines the underlying system thread that is subject to user-control

### Step 2: Experiment

\[Gain handle to thread\] The adversary then gains a handle to a process thread.

- Use the "OpenThread" API call in Windows on a known thread.
- Cause an exception in a java privileged block public function and catch it, or catch a normal signal. The thread is then hanging and the adversary can attempt to gain a handle to it.

### Step 3: Experiment

\[Alter process memory\] Once the adversary has a handle to the target thread, they will suspend the thread and alter the memory using native OS calls.

- On Windows, use "SuspendThread" followed by "VirtualAllocEx", "WriteProcessMemory", and "SetThreadContext".

### Step 4: Exploit

\[Resume thread execution\] Once the process memory has been altered to execute malicious code, the thread is then resumed.

- On Windows, use "ResumeThread".

## Prerequisites

- The application in question employs a threaded model of execution with the threads operating at, or having the ability to switch to, a higher privilege level than normal users
- In order to feasibly execute this class of attacks, the adversary must have the ability to hijack a privileged thread. This ability includes, but is not limited to, modifying environment variables that affect the process the thread belongs to, or calling native OS calls that can suspend and alter process memory. This does not preclude network-based attacks, but makes them conceptually more difficult to identify and execute.

## Skills required

- **High:** Hijacking a thread involves knowledge of how processes and threads function on the target platform, the design of the target application as well as the ability to identify the primitives to be used or manipulated to hijack the thread.

## Resources required

- None: No specialized resources are required to execute this type of attack. The adversary needs to be able to latch onto a privileged thread. The adversary does, however, need to be able to program, compile, and link to the victim binaries being executed so that it will turn control of a privileged thread over to the adversary's malicious code. This is the case even if the adversary conducts the attack remotely.

## Consequences

| Scope | Impact | Note |
| --- | --- | --- |
| Confidentiality, Access Control, Authorization | Gain Privileges | - |
| Confidentiality, Integrity, Availability | Execute Unauthorized Commands | Run Arbitrary Code |

## Mitigations

- Application Architects must be careful to design callback, signal, and similar asynchronous constructs such that they shed excess privilege prior to handing control to user-written (thus untrusted) code.
- Application Architects must be careful to design privileged code blocks such that upon return (successful, failed, or unpredicted) that privilege is shed prior to leaving the block/scope.

## Example instances

Adversary targets an application written using Java's AWT, with the 1.2.2 era event model. In this circumstance, any AWTEvent originating in the underlying OS (such as a mouse click) would return a privileged thread (e.g., a system call). The adversary could choose to not return the AWT-generated thread upon consuming the event, but instead leveraging its privilege to conduct privileged operations.

## Related weaknesses (CWE)

- [CWE-270](https://radicalnotion.ai/cwe/cwe-270): Privilege Context Switching Error

## Related attack patterns

| Relationship | CAPEC | Name |
| --- | --- | --- |
| Parent | [CAPEC-233](https://radicalnotion.ai/capec/capec-233) | Privilege Escalation |

## Taxonomy mappings

| Taxonomy | Entry | Id |
| --- | --- | --- |
| ATTACK | Process Injection: Thread Execution Hijacking | 1055.003 |

## Frequently asked questions

### What is CAPEC-30?

An adversary hijacks a privileged thread of execution by injecting malicious code into a running process. By using a privleged thread to do their bidding, adversaries can evade process-based detection that would stop an attack that creates a new process. This can lead to an adversary gaining access to the process's memory and can also enable elevated privileges. The most common way to perform this attack is by suspending an existing thread and manipulating its memory.

### How does a Hijacking a Privileged Thread of Execution attack work?

It typically unfolds over 4 phases. It begins with: \[Determine target thread\] The adversary determines the underlying system thread that is subject to user-control

### How do you prevent CAPEC-30?

Application Architects must be careful to design callback, signal, and similar asynchronous constructs such that they shed excess privilege prior to handing control to user-written (thus untrusted) code.

### What weaknesses does CAPEC-30 target?

CAPEC-30 exploits one CWE weakness: CWE-270 (Privilege Context Switching Error).

### How severe is CAPEC-30?

MITRE rates CAPEC-30 as Very High severity with low likelihood of attack.

Primary source: [MITRE CAPEC](https://capec.mitre.org/data/definitions/30.html)

---

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