mirror of
https://github.com/lkarlslund/defender-acl-blocker
synced 2026-06-06 16:04:36 +00:00
main
Defender ACL Blocker
Disable Microsoft Defender user space part with simple ACL deny ACL
Usage
Regular build:
- install Go
- clone this repo:
git clone https://github.com/lkarlslund/defender-acl-blocker - build it:
cd defender-acl-blocker && go build .
Obfuscated build:
- install Go
- install Garble:
go install mvdan.cc/garble@latest - clone this repo:
git clone https://github.com/lkarlslund/defender-acl-blocker - build it:
cd defender-acl-blocker && garble -tiny -literals -seed=random build .
Run it:
From an elevated command prompt:
# Standard run (adds DENY ACLs)
defender-acl-blocker.exe
# Undo changes (revokes applied ACLs)
defender-acl-blocker.exe -remove
# Custom targets and services
defender-acl-blocker.exe -target C:\path\to\file.dll -services "Service1,Service2"
Options:
-remove: Revokes access (removes entry) for the specified services instead of adding a DENY entry.-services: A comma-separated list of service names to apply the ACL to (default: WinDefend, mpssvc, Sense, etc.).-target: The file to apply the ACLs to (default:C:\Windows\System32\kernel32.dll).
Reboot after applying changes. Defender primary user mode service can not start anymore.
How it works
The tool follows these steps to effectively block Defender (and other services) from starting:
- It enables
SeDebugPrivilegeto allow the process to interact with other system processes. - It first impersonates the
SYSTEMaccount by stealing a token fromwinlogon.exe.- It then impersonates
TrustedInstaller. If the service isn't running, it starts it, steals the token from thetrustedinstaller.exeprocess, and assumes its identity. This provides the highest possible permissions over system files.
- It then impersonates
- It calculates the unique Service SID for each target service (e.g.,
WinDefend,Sense,mpssvc). Service SIDs are in the formatS-1-5-80-...and are used to identify the service's identity in the local system. - It retrieves the current Discretionary Access Control List (DACL) of a target system file (by default
C:\Windows\System32\kernel32.dll).- It prepends "DENY" Access Control Entries (ACEs) for each of the calculated Service SIDs to the ACL.
- It applies the modified ACL back to the target file.
- Because "Deny" ACEs take precedence over any "Allow" ACEs, the Windows Loader will refuse to load the target DLL (like
kernel32.dll) when the service tries to start. Since almost every user-mode process requireskernel32.dll, the Defender services fail to initialize and start.
Disclaimer
This tool is provided as-is, for educational purposes only, and is not supported by Microsoft, yada yada. Don't use it.
Description
Languages
Go
100%