Overview
Antivirus (AV) and Endpoint Detection and Response (EDR) solutions use static detection, dynamic analysis, and behavioral analysis to identify malicious activity. This page covers the core bypass techniques used in authorized red team engagements.Stopping Windows Defender
UAC Bait Before Disabling Defender
Public loaders masquerading as game cheats ask for elevation first, then disable Defender:Blanket MpPreference Exclusions (GachiLoader Pattern)
After elevation, maximize Defender blind spots without stopping the service:This approach keeps the Defender service running and reporting “healthy” while silently disabling scanning for all specified paths and extensions. All changes persist in
HKLM\SOFTWARE\Microsoft\Windows Defender\Exclusions.AV Evasion Methodology
- Static Detection Bypass
- Dynamic Analysis Bypass
- Behavioral Detection Bypass
Static detection flags known malicious strings, byte patterns, or file metadata.Bypass techniques:
- Encryption — encrypt the payload; use a loader to decrypt in memory
- Obfuscation — change variable names, split strings, encode commands
- Custom tooling — write your own tools with no known signatures
EXEs vs DLLs
DLL files are significantly less detected than EXEs. When possible:- Prioritize DLL payloads
- Use
rundll32.exeor LOLBins to load your DLL - DLL detection rate is typically ~40-50% lower than equivalent EXE payloads
DLL Sideloading and Proxying
DLL Sideloading
Find applications vulnerable to DLL hijacking:DLL Proxying with SharpDLLProxy
Forward calls to the real DLL while executing your payload:ForwardSideLoading (Forwarded Exports)
Windows PE modules can export “forwarder” functions that point to a target DLL. If the target is not a KnownDLL, normal search order applies:AMSI Bypass
AMSI (Anti-Malware Scan Interface) inspects scripts before execution in PowerShell, WSH, VBA, and .NET 4.8+.Force amsiInitFailed
Memory Patching (AmsiScanBuffer)
Overwrite theAmsiScanBuffer function in amsi.dll to always return E_INVALIDARG (clean result).
Block amsi.dll from Loading (LdrLoadDll Hook)
Use PowerShell v2
PowerShell v2 predates AMSI — AMSI is never loaded:AMSI Bypass Generator
SmartScreen and Mark of the Web (MoTW) Bypass
SmartScreen uses reputation-based detection. Files downloaded from the internet get aZone.Identifier ADS (Mark of the Web).
Bypass by packaging in ISO/IMG:
MoTW cannot be applied to non-NTFS volumes. Files extracted from an ISO don’t inherit the quarantine flag:
ETW Bypass
Event Tracing for Windows (ETW) provides telemetry to security products. PatchEtwEventWrite to return immediately:
C# Assembly Reflection
Load .NET assemblies directly in memory without touching disk:- Fork & Run
- Inline Execution
Spawn a sacrificial process, inject and execute the assembly, then kill it. Protects beacon if execution fails.
Obfuscation Tools
Freeze
Bypasses EDRs using suspended processes, direct syscalls, and alternative execution. Wraps shellcode in legitimate-looking containers.
Bashfuscator
Bash script obfuscation for evading string-based detection.
Alcatraz
x64 binary obfuscator for PE files including EXE, DLL, and SYS.
InvisibilityCloak
C# obfuscator designed for offensive security tools.
Deobfuscating ConfuserEx .NET Malware
When analyzing ConfuserEx-protected malware:BYOVD — Bring Your Own Vulnerable Driver
Storm-2603 used this technique to kill AV/EDR from kernel space:Enable Microsoft’s vulnerable driver block list (HVCI/WDAC/Smart App Control) to prevent loading known-vulnerable signed drivers.