Beacon Object File implementation of pwn1sher’s KillDefender.
Original POC:

CobaltStrike command checks to make sure beacon is Elevated or System and won’t run if it isn’t.
BOF enumerates username and elevates token to System if the beacon isn’t already running as it. This is necessary in order to get a handle to MsMpEng.exe
Otherwise works the same as the original KillDefender
Tested on Win10, Win11, and Server 2019

Have not tested on x86 (mostly because I don’t have ready access to a x86 win10 box)
Unlike Cerbersec’s implementation (, no direct syscalls or other fanciness is used here.
Opens handles to Winlogon and MsMpEng.exe. Further work could duplicate already open handles to Winlogon to avoid that IOC.
No low-vis way to revert! The only way to revert these changes is to restart MsMpEng.exe and short of installing a malicious driver you are going to need to restart the machine.

Cobaltstrike command:
killdefender check – Check MsMpEng.exe’s token in order to determine if KillDefender has already been run.
killdefender kill – Remove privileges and set MsMpEng.exe token to untrusted rendering Defender useless (but still running).



Check after kill:

Compile using VS Native x64 prompt:

cl.exe /c /GS- /TP kdbof.cpp /FoKillDefender.x64.o


View Github