CAPEC-30 Metadata
Likelihood of Attack
Low
Typical Severity
Very High
Overview
Summary
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.
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.
Execution Flow
Step | Phase | Description | Techniques |
---|---|---|---|
1 | Explore | [Determine target thread] The adversary determines the underlying system thread that is subject to user-control |
|
2 | Experiment | [Gain handle to thread] The adversary then gains a handle to a process thread. |
|
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. |
|
4 | Exploit | [Resume thread execution] Once the process memory has been altered to execute malicious code, the thread is then resumed. |
|
Potential Solutions / 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.
Related Weaknesses (CWE)
CWE ID | Description |
---|---|
CWE-270 | Privilege Context Switching Error |
Related CAPECs
CAPEC ID | Description |
---|---|
CAPEC-233 | An adversary exploits a weakness enabling them to elevate their privilege and perform an action that they are not supposed to be authorized to perform. |
Taxonomy Mappings
Taxonomy: ATTACK
Entry ID | Entry Name |
---|---|
1055.003 | Process Injection: Thread Execution Hijacking |
Stay Ahead of Attack Patterns
Understanding CAPEC patterns helps security professionals anticipate and thwart potential attacks. Leverage these insights to enhance threat modeling, strengthen your software development lifecycle, and train your security teams effectively.