Challenge 40: IOCTL Hijack — Kill via EDR's Own Driver
Challenge 40: IOCTL Hijack — Kill via EDR’s Own Driver
| Difficulty: Medium | Category: IOCTL Abuse | Target: Driver Device |
Objective
Open the MostShittyEDR driver’s device and use its own IOCTL_KILL_PROCESS to terminate the EDR agent — no vulnerable third-party driver needed.
Background
The MostShittyEDR kernel driver exposes its device at \\.\MostShittyEDR without any access control. The DispatchCreateClose handler always returns STATUS_SUCCESS — any process on the system can open the device. Once opened, all 5 IOCTLs are accessible, including IOCTL_KILL_PROCESS (0x222004), which calls ZwTerminateProcess from ring 0.
This means the EDR’s own driver is a weaponizable IOCTL interface: instead of bringing your own vulnerable driver (BYOVD), you abuse the one the EDR already loaded.
Weakness Exploited
- No DACL on the device object:
IoCreateDeviceis called without setting a security descriptor — the default grants access to any local user - No caller validation:
DispatchCreateClosedoesn’t check the calling process (PID, signature, integrity level) FILE_ANY_ACCESSon destructive IOCTLs:IOCTL_KILL_PROCESSusesFILE_ANY_ACCESSinstead ofFILE_WRITE_ACCESS- No PID validation: The kill handler doesn’t prevent terminating critical processes (PID 4, csrss.exe, the agent itself)
IoCreateDevicewithExclusive = FALSE: Multiple processes can open the device simultaneously
Hints
- The device symlink is
\\.\MostShittyEDR— open it withCreateFileA IOCTL_KILL_PROCESSis0x222004withMETHOD_BUFFERED- The input buffer is an
EDR_COMMANDstruct:{ Action: ULONG = 1, ProcessId: ULONG64 } - Find the agent PID via
CreateToolhelp32Snapshot/Process32First - You don’t even need Administrator — the device has no access restrictions
- Bonus: after killing the agent, use
IOCTL_CLEAR_BLOCK_RULES(0x22200C) to remove all kernel block rules
Success Criteria
- The
edr_agent.exeprocess is terminated using the EDR’s own driver IOCTL - No external driver is loaded — only
\\.\MostShittyEDRis used - The attack works from a standard (non-elevated) user context
MostShittyEDR