Developer knowledge network · moderated exchange

UnreliableCode コミュニティ

開発者リサーチ、リバース エンジニアリング、コーディング コミュニティ

Guide

Creating stealthy system threads in kernel mode with PsCreateSystemThread [v2.4 Technical Discussion]

kernel_komrade
Driver Dev
MEMBER
担当者: 145
参加日: Feb 2019
投稿: 26
ありがとう: 45
1 か月前 · Jul 11, 2026 9:38 PM
#1

How to spawn a background worker thread in ring0:

C
HANDLE hThread;
OBJECT_ATTRIBUTES objAttr;
InitializeObjectAttributes(&objAttr, NULL, OBJ_KERNEL_HANDLE, NULL, NULL);

NTSTATUS status = PsCreateSystemThread(
    &hThread,
    THREAD_ALL_ACCESS,
    &objAttr,
    NULL,
    NULL,
    (PKSTART_ROUTINE)KernelWorkerRoutine,
    NULL
);
if (NT_SUCCESS(status)) {
    ZwClose(hThread); // Close handle, thread continues running in system space
}

Ensure your worker routine checks a termination atomic flag before driver unload to avoid orphan thread crashes.

stack_smasher
Kernel Explorer
MEMBER
担当者: 111
参加日: Feb 2019
投稿: 30
ありがとう: 18
1 か月前 · Jul 12, 2026 1:23 AM
#2

To avoid anti-cheat stack scanners flagging thread start addresses outside valid modules, consider hijacking a suspended thread in a legitimate system driver.

val_driver_guy
Driver Dev
MEMBER
担当者: 42
参加日: May 2019
投稿: 24
ありがとう: 37
1 か月前 · Jul 12, 2026 12:26 PM
#3

Clean usage of OBJ_KERNEL_HANDLE.