Skip to main content

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.
AV/EDR bypass techniques are for authorized red team operations only. Never test on systems without explicit written permission. Avoid uploading bypass tools to VirusTotal to preserve their operational usefulness.

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 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
Use ThreatCheck to find exactly which bytes trigger Defender:

EXEs vs DLLs

DLL files are significantly less detected than EXEs. When possible:
  • Prioritize DLL payloads
  • Use rundll32.exe or 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:
Check KnownDLLs:

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 the AmsiScanBuffer 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 a Zone.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:
Executables signed with a trusted code signing certificate won’t trigger SmartScreen.

ETW Bypass

Event Tracing for Windows (ETW) provides telemetry to security products. Patch EtwEventWrite to return immediately:

C# Assembly Reflection

Load .NET assemblies directly in memory without touching disk:
Spawn a sacrificial process, inject and execute the assembly, then kill it. Protects beacon if execution fails.
Most C2 frameworks (Sliver, Covenant, Cobalt Strike, Havoc) support both modes natively.

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:
Available IOCTLs in the vulnerable driver:
Enable Microsoft’s vulnerable driver block list (HVCI/WDAC/Smart App Control) to prevent loading known-vulnerable signed drivers.

References