Skip to content
wesmarPublic

About

Command-line utility to completely halt, disable, and neutralize Windows Defender and Tamper Protection. Bypasses forced UAC and GUI requirements in Windows 11 (supports 26H1/26H2). Features invisible execution and automatic privilege handling. Essential tool for sysadmins and security researchers.

Topics

Resources

Stars

79 stars

Watchers

2 watching

Forks

Latest commit

Β 

History

20 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

WinDefCtl β€” Windows Defender Automation & Control Utility v2.1

Zero-CRT Native Architecture + Dual Kernel BYOVD Engine + RTP/TP Slider Control

Platform Build Size License


⚑ What's New in v2.1 (06.11.2026)

v2.1 brings a complete architectural overhaul focused on Zero-CRT native implementation, sub-100KB binary size record, dual-driver kernel redundancy, and full MASM string obfuscation.

πŸš€ Spoiler: Detailed v2.1.0 Architecture & Release Notes

⚑ Sub-100KB Size Record & Zero-CRT (~80 KB)

  • 100% Native OS APIs (/NODEFAULTLIB) β€” eliminated all C/C++ runtime library dependencies (libcmt.lib, vcruntime*.dll, msvcrt.dll). Executable dropped from ~380 KB down to 80.5 KB (>78% reduction). Automated dumpbin /dependents in CI/CD pipeline enforces 0 CRT imports.
  • Custom Native CRT Runtime β€” handwritten implementations for memory (memset, memcpy, memmove), string algorithms (StrLen, StrEqual, StrCopy, StrConcat, IntToStr, HexToStr), and float/hex formatters running directly on Win32 without standard library overhead.
  • Micro-Icon PNG CAB Compression β€” transformed embedded multi-res icon to optimized 48x48 PNG format (1,088 B header), slashing icon resource overhead and total binary size.

πŸ›‘οΈ Dual Kernel BYOVD Architecture & Extension Independence

  • Two-tier Driver Redundancy β€” engine kill upgraded from a single driver to dual signed kernel drivers (1 and 2), packed into a single LZX compressed CAB stream within the icon.
  • Extension-Independent Driver Loading β€” drivers extract and load directly without .sys extensions (%SystemRoot%\System32\drivers\1 and \2). Windows SCM CreateServiceW and kernel loader resolve native PE headers directly.
  • Automated Driver Teardown β€” automated cleanup purges both driver files from disk and stops services immediately after the kill cycle completes.

πŸ”’ Low-Level String & Telemetry Obfuscation (x64 MASM)

  • Zero Plaintext Driver Identifiers β€” driver service names and device identifiers completely purged from executable .rdata string tables.
  • Algorithmic Assembly Decoders β€” implemented x64 MASM routines (wdc1.asm and wdc2.asm) that dynamically reconstruct driver service strings in stack memory using bitwise XOR, ROL, and SUB transformations disguised as Mm/ETW kernel telemetry routines. Verified clean via dumpbin and binary string inspection.

⏱️ UI Automation & Zero Cursor Delay (0 ms)

  • Instant Busy Cursor Cancellation (IDC_WAIT / IDC_APPSTARTING) β€” integrated MsgWaitForMultipleObjects(0, nullptr, FALSE, 0, QS_ALLINPUT) at entry point, overlay creation, and post-ShellExecuteW. Satisfies WaitForInputIdle instantly (0 ms), eliminating the spinning wheel wait cursor on Windows 11.
  • Overlay Window Cursor Enforcement β€” registered IDC_ARROW cursor and handled WM_SETCURSOR in the Direct2D fullscreen overlay (WDCOverlay), preventing shell wait cursor leakage over the "PLEASE WAIT" screen.

πŸ“ Procedural Banner & Clean Systems Engineering

  • Dynamic Mathematical Banner Lines β€” replaced hardcoded banner string literals (====, +----+, space paddings) in .rdata with procedural loop-fill console routines (PrintRepeated, PrintLineRepeated, PrintDoubleBorder, PrintSingleBorder), saving .rdata memory.
  • Codebase Sanitization β€” completely purged informal/script-kiddie jargon ("payload", etc.) in favor of professional systems engineering nomenclature across comments, identifiers, and logs.
  • Synchronized Build System β€” automated alignment between WinDefCtl.vcxproj and WinDefCtl.vcxproj.filters with integrated MASM toolchain.

πŸ“₯ Download

Latest Release β†’ v2.1.0

Single standalone native executable (80.5 KB) β€” no installer, no dependencies, zero CRT dependencies (/NODEFAULTLIB).
Run as Administrator.

PowerShell edition: data/WinDefCtl-v2.ps1 (~65 KB, no compiler needed).

πŸ” Spoiler: ARM64 edition (v1.1.2) β€” byproduct of the research

This build was never officially announced β€” it is a direct byproduct of the Analyze Defender research into hooking the SecHealthUI XAML tree. While implementing and verifying the injection technique on an ARM64 machine, a fully functional native binary emerged as a side effect.

WinDefCtl_arm64.exe is attached to the release for anyone who needs it. It covers all five Threat Settings sliders individually β€” something the x64 v2.0 line does not expose through a single command:

WinDefCtl rtp on|off   # Real-Time Protection
WinDefCtl tp  on|off   # Tamper Protection
WinDefCtl cdp on|off   # Cloud-delivered protection
WinDefCtl ass on|off   # Automatic sample submission
WinDefCtl ddp on|off   # Dev Drive protection

The binary must be compiled natively for ARM64 β€” it is injected into SecHealthUI.exe which on ARM64 hardware is a native ARM64 process and cannot host x86-64 code. Source code is not published for this build.


πŸš€ Usage

WinDefCtl kill              # Kill Defender engine (no restart required)
WinDefCtl restore           # Re-enable Defender engine

WinDefCtl rtp status        # Check Real-Time Protection state
WinDefCtl rtp off           # Disable Real-Time Protection
WinDefCtl rtp on            # Enable Real-Time Protection

WinDefCtl tp status         # Check Tamper Protection state
WinDefCtl tp off            # Disable Tamper Protection
WinDefCtl tp on             # Enable Tamper Protection

Typical Workflow

# Kill engine completely (blocks MsMpEng restart via IFEO)
WinDefCtl kill

# ... do your thing ...

# Restore everything
WinDefCtl restore

# Or: just disable RTP for a moment
WinDefCtl rtp off
WinDefCtl rtp on

βš™οΈ How It Works

kill β€” Engine Kill (v2.0)

Two-stage, no restart required:

Stage 1 β€” IFEO offline hive bypass:

Direct registry write to Image File Execution Options is blocked by Tamper Protection.
WinDefCtl bypasses this using an offline hive cycle:

  1. RegSaveKeyEx β€” dump live IFEO key to %TEMP%\Ifeo.hiv
  2. RegLoadKey(HKLM, TempIFEO, Ifeo.hiv) β€” mount as HKLM\TempIFEO
  3. Write Debugger=systray.exe to TempIFEO\MsMpEng.exe (and two secondary targets)
  4. RegUnLoadKey(TempIFEO) β€” unmount
  5. RegRestoreKey(IFEO, Ifeo.hiv, REG_FORCE_RESTORE) β€” kernel-level force-replace

REG_FORCE_RESTORE operates below the Tamper Protection filter. Requires SE_BACKUP_NAME + SE_RESTORE_NAME.

Stage 2 β€” Ring-0 process kill via Dual Kernel Engine:

Both kernel drivers carry valid digital signatures.
Loads without DSE bypass, without HVCI restart, without any unsigned-driver prerequisites.

  • Drivers extracted from embedded LZX CAB (appended to the .ico resource at ICON_HEADER_SIZE offset)
  • Written to System32\drivers\1 and System32\drivers\2 (extension-independent SCM loading)
  • Driver service names and device identifiers reconstructed dynamically via x64 MASM assembly routines (wdc1.asm, wdc2.asm) β€” 0 plaintext string occurrences in .rdata
  • Terminates MsMpEng.exe + SecurityHealthSystray.exe; SecurityHealthService stopped via SCM
  • Immediate atomic cleanup after use (stop services, delete services, remove driver files from disk)

rtp / tp β€” UI Automation

Opens windowsdefender://threatsettings with SW_SHOWMINNOACTIVE (minimized, not activated).
Full-screen Direct2D overlay covers the desktop immediately β€” hiding the minimized window from view.
Toggles the switch via IUIAutomationTogglePattern.

Overlay technical details:

  • WS_EX_TOPMOST | WS_EX_TOOLWINDOW | WS_EX_NOACTIVATE fullscreen popup, fully opaque black
  • Direct2D + DirectWrite rendering: Consolas Bold 80pt, pulsing green, animated dots, CRT scanlines
  • 0 ms cursor delay: Instant release of Windows WaitForInputIdle via MsgWaitForMultipleObjects(..., QS_ALLINPUT) to cancel the spinning wait cursor (IDC_WAIT/IDC_APPSTARTING)
  • WM_SETCURSOR handler and IDC_ARROW registration prevent shell wait cursor leakage
  • Background thread β€” non-blocking, no window activation
  • Released on Hide() via PostMessage(WM_CLOSE)

UAC Bypass

Before UI automation, UAC prompts are suppressed:

  • Backup ConsentPromptBehaviorAdmin + PromptOnSecureDesktop to HKLM\...\UACStatus
  • Set both to 0 (no prompts)
  • Automatically restored after operation (or on next run if interrupted)

Cold Boot Pre-Warming

First run after login: Windows Security components are not yet loaded in memory.
WinDefCtl detects this via a volatile registry marker at HKCU\Software\WinDefCtl\WinDefCtl_Warmed
and pre-loads the Security window before automation begins (~5-7 seconds, first run only).


πŸ“œ PowerShell Edition (Addon)

data/WinDefCtl-v2.ps1 β€” same command palette as the C++ binary, in a single self-contained PowerShell script (~65 KB). No compiler, no Visual Studio. Drop the file anywhere, run from elevated PowerShell.

.\WinDefCtl-v2.ps1                  # show help (also: /?, -?, -h, --help, "help")
.\WinDefCtl-v2.ps1 status           # read Defender state (read-only)
.\WinDefCtl-v2.ps1 kill             # IFEO block + BYOVD kernel kill
.\WinDefCtl-v2.ps1 restore          # remove IFEO + start WinDefend
.\WinDefCtl-v2.ps1 rtp off          # Real-Time Protection toggle off
.\WinDefCtl-v2.ps1 tp  on           # Tamper Protection toggle on

How it works

Layer Implementation
Driver embedding kvckiller.sys packed with makecab.exe (LZX) β†’ base64-chunked β†’ inline in $DriverCabB64
Driver deployment expand.exe decompresses CAB directly to %SystemRoot%\System32\drivers\kvckiller.sys
SCM lifecycle sc.exe create wsftprm type= kernel start= demand β†’ sc.exe start β†’ sc.exe stop/delete
Kernel kill P/Invoke CreateFileW(\\.\Warsaw_PM) + DeviceIoControl(0x22201C, <PID buffer>)
IFEO bypass reg.exe save β†’ reg.exe load HKLM\TempIFEO β†’ reg.exe add Debugger=systray.exe β†’ reg.exe unload β†’ reg.exe restore /f (REG_FORCE_RESTORE)
UI automation System.Windows.Automation β€” TogglePattern on Real-Time / Tamper / Dev Drive protection toggles
UAC bypass Both ConsentPromptBehaviorAdmin and PromptOnSecureDesktop packed into a single UACStatus DWORD, restored after the toggle
Overlay Fullscreen multi-monitor System.Windows.Forms.Form, pulsing "PLEASE WAIT" label (sine-wave grey-to-white, 25 FPS)
Cold boot detect Volatile marker HKCU\Software\Temp\WinDefCtl_Warmed

Zero trace after kill

After the kill flow finishes, all of the following are gone:

  • wsftprm service (stopped + DeleteService)
  • %SystemRoot%\System32\drivers\kvckiller.sys (deleted)
  • %TEMP%\kk.cab and %TEMP%\Ifeo.hiv* (deleted)

Only IFEO entries remain (intentional β€” that is the active block; restore clears them).

Build the script

# Source driver: data\kvckiller.sys
.\generator\build-ps.ps1
# Output: out\WinDefCtl-v2.ps1

The generator runs makecab.exe, base64-encodes the CAB into 76-char lines and substitutes into generator\template.ps1. No external NuGet packages, no .NET build tools β€” pure inbox Windows.

Limits vs. C++ binary

  • Slower startup (~1.5 s PowerShell + .NET cold load vs. ~200 ms native exe).
  • Requires -ExecutionPolicy Bypass or a signed copy.
  • Defender RTP may flag the script on disk (CAB-encoded signed driver inside a PS1). The compiled C++ binary embeds the same driver as an ICO resource so it sits below most heuristics.
  • No D2D overlay β€” uses WinForms.

πŸ› οΈ Build from Source

Requirements: Visual Studio 2022 (v145 toolset), Windows SDK 10.0+

# Full chain: embed driver β†’ compile β†’ stamp timestamps β†’ clean artifacts
.\build.ps1

# Skip driver embedding (use existing ICON\WinDefCtl.ico)
.\build.ps1 -SkipDriverPack

# Custom timestamp (for reproducible builds)
.\build.ps1 -Timestamp "2030-01-01 00:00:00"

Build chain:

  1. Build-DriverIcon β€” makecab LZX compresses drivers 1 and 2, appends CAB to IcoBuilder\WinDefCtl.ico β†’ ICON\WinDefCtl.ico
  2. Regenerates src\GenIconSize.h with exact icon header byte count (1088 B)
  3. MSBuild Release|x64: /NODEFAULTLIB (Zero-CRT), /O1 / /Os (FavorSize), /GF, /Gy, /Gw, MASM assembly compilation
  4. Dumpbin import check β€” automated verification of 0 CRT imports
  5. Timestamp stamp β†’ bin\WinDefCtl.exe
  6. Cleans obj\

Output: bin\WinDefCtl.exe (80.5 KB, 100% native Windows OS APIs)


πŸ“‹ Technical Requirements

  • OS: Windows 11 (tested on 24H2 / 26H1 / 26H2)
  • Privileges: Administrator
  • Architecture: x64
  • Dependencies: none (Zero-CRT, 100% native Win32/NT APIs)
  • Size: ~80 KB

⚠️ Notes

  • kill does NOT unload WinDefend service β€” IFEO prevents MsMpEng.exe from starting on service start
  • restore removes the IFEO block then starts WinDefend + SecurityHealthService
  • UI Automation (rtp/tp) requires an active user session
  • Cannot run from Safe Mode or Windows PE
  • kvckiller.sys is digitally signed β€” no HVCI workaround needed

πŸ“ž Contact & Support

Email marek@wesolowski.eu.org
Phone +48 607-440-283
Website https://kvc.pl
GitHub https://github.com/wesmar/WinDefCtl

Donations:

  • PayPal: paypal.me/ext1
  • Revolut: revolut.me/marekb92

βš–οΈ Legal Notice

For authorized security testing and system administration only.
User assumes full legal responsibility for all actions performed.
Misuse may violate computer crime laws in your jurisdiction.


Β© 2026 Marek WesoΕ‚owski β€” WESMAR

About

Command-line utility to completely halt, disable, and neutralize Windows Defender and Tamper Protection. Bypasses forced UAC and GUI requirements in Windows 11 (supports 26H1/26H2). Features invisible execution and automatic privilege handling. Essential tool for sysadmins and security researchers.

Topics

Resources

Stars

79 stars

Watchers

2 watching

Forks

Releases

Packages

Contributors

Languages