• This repository has been archived on 16/Sep/2024
  • Stars
    star
    129
  • Rank 279,262 (Top 6 %)
  • Language
    C
  • Created almost 2 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Kernel Mode Driver for Elevating Process Privileges

Tokenizer

  • Tokenizer is a kernel mode driver project that allows the replacement of a process token in EPROCESS with a system token, effectively elevating the privileges of the process, The driver is designed to be used with a user-mode application that sends a process ID to the driver through an IOCTL.

technical details

  • When a process is created, it inherits the token of the user who created it, The token is used by the system to determine what actions the process can perform. The token contains information about the user's security identifier (SID), group memberships, and privileges.

    image

  • The Token member resides at offset 0x4b8 in the _EPROCESS structure, which is a data structure that represents a process object. The Token member is defined in _EX_FAST_REF structure, which is a union type that can store either a pointer to a kernel object or a reference count, depending on the size of the pointer , The offset of the _EX_FAST_REF structure within _EPROCESS depends on the specific version of Windows being used, but it is typically located at an offset of 0x4b8 in recent versions of Windows..

  • Windows Build Number token Offsets for x64 and x86 Architectures

    x64 offsets x86 offsets
    0x0160 (late 5.2) 0x0150 (3.10)
    0x0168 (6.0) 0x0108 (3.50 to 4.0)
    0x0208 (6.1) 0x012C (5.0)
    0x0348 (6.2 to 6.3) 0xC8 (5.1 to early 5.2)
    0x0358 (10.0 to 1809) 0xD8 (late 5.2)
    0x0360 (1903) 0xE0 (6.0)
    0x04B8 0xF8 (6.1)
    0xEC (6.2 to 6.3)
    0xF4 (10.0 to 1607)
    0xFC (1703 to 1903)
    0x012C

    image

  • The _EX_FAST_REF structure in Windows contains three members: Object and RefCount and Value

    image

  • To display the process token in _EX_FAST_REF,We pass the address of the _EX_FAST_REF structure that contains the token, which is typically located at an offset of 0x4b8 in the _EPROCESS structure."

    image

Usage

  • You can either spawn a privileged process or elevate an already existing process ID.

    image

  • For the sake of this explanation, we will focus on the second option and use CMD as an example

    image

  • inherited Token

    image

  • send the Process ID to the driver through an IOCTL

    image

  • After receiving the PID from the user mode application, the driver uses it to obtain a pointer to the _EPROCESS structure for the target process. The driver then accesses the Token member of the _EPROCESS structure to obtain a pointer to the process token, which it replaces with the system token, effectively changing the security context of the process to that of the system. However, if the driver does not correctly locate the Token member within the _EPROCESS structure or if the offset of the Token is other than 0x4b8 , the driver may crash the system or the target process ,this problem will be fixed in the next updates .

    image

  • cmd token after

    image

  • the process privileges, groups, rights

    image

DEMO

Tokenizer.mp4

More Repositories

1

Terminator

Reproducing Spyboy technique to terminate all EDR/XDR/AVs processes
C++
923
star
2

Blackout

kill anti-malware protected processes ( BYOVD) (Microsoft Won )
C++
887
star
3

Chaos-Rootkit

Now You See Me, Now You Don't
C++
841
star
4

Amsi-Killer

Lifetime AMSI bypass
C++
587
star
5

APT38-0day-Stealer

APT38 Tactic PoC for Stealing 0days from security professionals
C++
267
star
6

C2-Hunter

Extract C2 Traffic
C++
245
star
7

Handle-Ripper

simple Windows handle hijacker with a nod to Apxaey for inspiration
C++
200
star
8

Orca

Incomplete project
C++
189
star
9

Bypass-Sandbox-Evasion

Bypass Malware Sandbox Evasion Ram check
C++
133
star
10

Shellcode-Injector

x64/x86 shellcode injector
C++
111
star
11

SleepKiller

Bypass Malware Time Delays
C++
97
star
12

URootkit

user-mode Rootkit
C++
97
star
13

Wizard-Loader

Abuse Xwizard.exe for DLL Side-Loading
C++
83
star
14

U-Boat

Russian Wipers Dropper (educational-purposes )
C++
83
star
15

Overlord

abusing Process Hacker driver to terminate other processes (BYOVD)
C++
79
star
16

Hooks_Hunter

Detect API Hooks
C++
67
star
17

DeadLight

C# Malware that Steal Discord Token Directly From Memory and bypass any kind of token protection
C#
57
star
18

Dll-Injector

simple C++ dll injector
C++
53
star
19

BufferOverFlow

Exploit Windows-Based BufferOverflow (vulnserver)
C
44
star
20

TrampHook

x86 Trampoline Hook
C++
37
star
21

Among-Us-External

external hack for Among Us (PATCHED)
C++
36
star
22

Btc-Grabber

x86 Btc Stealer with Thread Hijack implemented (educational-purposes)
C++
34
star
23

Thread-Hijacking

Thread Execution Hijacking technique
C++
34
star
24

RSPCKiller

RtlSetProcessIsCritical Killer
C++
30
star
25

CE_AC_CI_EX

Solving game hacking challenges (CE/AC) using ASM/C++
Assembly
28
star
26

Mail_Killer

anonymous spam E-mail sender
Python
22
star
27

WDropper

C++ PowerShell dropper
C++
21
star
28

IFEO-PoC

Image File Execution Options Injection PoC
C++
19
star
29

KlTroll

Trolling Keyloggers by Forcing them to log Specific Text then freezing them
C++
17
star
30

AX509

subdomain finder
Python
10
star
31

AC-External

(basic)AC external hack written in C++
C++
10
star
32

CiaIoctl

User/Kernel Mode communication using IOCTL
C
9
star
33

Malware-IOCs

some of my IOCs from malware investigations
YARA
8
star
34

GRage

x86 Funny malware that Troll GTA players by killing the character every time it respawn
C++
8
star
35

HackTheBox-CubeMadness

external hack for CubeMadness
C++
5
star
36

ShEye

Simple Program To Detect API Hooks by Scanning OpCode Patterns
C++
2
star
37

Malwares-IDEAS

1
star