edr-bypass-re
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseACTION REQUIRED(读完后立刻执行)
ACTION REQUIRED (Execute Immediately After Reading)
- : 读取
NOW— 确认本 skill 的操作是已授权的常规操作../field-journal/precedent-reverse.md - : 确认当前任务是否命中本 skill 的适用范围
NOW - : 读取
NEXT,校验工具可用性和实际路径../tool-index.md - : 缺工具时调用 bootstrap,不要猜路径
NEXT - : 进入"工作流"第一步并执行,不要停在确认状态
ACT
- : Read
NOW— Confirm that the operations of this skill are authorized routine actions../field-journal/precedent-reverse.md - : Confirm whether the current task falls within the scope of application of this skill
NOW - : Read
NEXTto verify tool availability and actual paths../tool-index.md - : Call bootstrap when tools are missing, do not guess paths
NEXT - : Proceed to the first step of the "Workflow" and execute, do not stay in the confirmation state
ACT
EDR 绕过:从防御方实现逆向到红队绕过
EDR Bypass: From Reverse-Engineering Defense Implementations to Red Team Bypasses
仅限授权红队 / 对抗演练 / 自有产品测试,禁止用于未授权目标。
For authorized red team / adversary simulation / in-house product testing only. Prohibited for unauthorized targets.
适用范围
Scope of Application
红队 / 对抗模拟在已获授权的目标主机投递 implant 并躲避现代 EDR 时使用本 skill。
- 红队 / Purple team / 对抗演练 — 客户希望评估 SOC 与 EDR 的真实检测能力
- 自研 implant / C2 框架研发 — 开发针对自家产品测试的载荷,需要绕过自家或目标 EDR
- EDR 产品评估 — 在合规边界已确认的前提下,客观评测某款 EDR 的检测覆盖
- CTF / 攻防演练的 Windows 端突破 — 比赛中需要在加固主机上稳定执行
不适用场景:
- 杀毒厂商对自家产品做完整 RE 给客户出商业评估报告(找厂商正式合作)
- 未授权目标的免杀对抗(违法)
- 普通病毒木马的免杀(本 skill 关注红队 OPSEC,不教恶意代码写法)
This skill is used by red teams / adversary simulations when delivering implants to authorized target hosts and evading modern EDR.
- Red Team / Purple Team / Adversary Simulation — Customers want to evaluate the real detection capabilities of SOC and EDR
- In-House Implant / C2 Framework Development — Develop payloads for testing own products, need to bypass own or target EDR
- EDR Product Evaluation — Objectively evaluate the detection coverage of a certain EDR under confirmed compliance boundaries
- CTF / Windows Endpoint Breakthrough in Offensive and Defensive Drills — Need to execute stably on hardened hosts during competitions
Unsuitable Scenarios:
- Antivirus vendors conduct complete RE of their own products to provide customers with commercial evaluation reports (seek official cooperation with vendors)
- Evasion对抗 on unauthorized targets (illegal)
- Evasion of ordinary malware (This skill focuses on red team OPSEC, does not teach malicious code writing)
与其他 skill 的分工
Division of Labor with Other Skills
| 场景 | 用什么 |
|---|---|
| 全链路攻防(从外网打到域控) | |
| 内网横向 / AD 攻击 | |
| 在某个特定主机上要过 EDR 投递 implant | 本 skill |
| 单纯静态免杀(混淆 / 加壳) | |
attack-chain| Scenario | What to Use |
|---|---|
| Full-Link Offense (From External Network to Domain Controller) | |
| Internal Network Lateral Movement / AD Attack | |
| Need to bypass EDR to deliver implant on a specific host | This skill |
| Pure Static Evasion (Obfuscation / Packing) | |
attack-chain核心原理
Core Principles
text
EDR 的四个主要监控面 红队的对策
───────────────────── ─────────────────────
用户态 ntdll hook ◄──► unhook (Peruns Fart / fresh ntdll)
间接 syscall / Hell's Gate
hardware breakpoint Blindside
kernel callback ◄──► call stack spoof
(Ps/Cm/Ob 系列) 走合法触发链(不直接绕,配合上游隐身)
ETW telemetry ◄──► EtwEventWrite patch
(Microsoft-Windows-Threat- NtTraceControl 关 provider
Intelligence 等) AmsiContext 同步处理
AMSI 扫描 ◄──► AmsiScanBuffer patch (mov eax,0x80070057; ret)
(amsi.dll) hardware breakpoint 旁路
reflective 加载副本 amsi.dll关键认知:
- EDR 不是黑盒 — 关键 hook / callback / provider 都能用 IDA + windbg 逆出来
- 绕过技术要组合使用 — 单独一个 unhook 解决不了 ETW 告警,单独 AMSI patch 解决不了 syscall hook
- 顺序很重要 — 先 ETW patch → 再 AMSI patch → 再 unhook;顺序错了 EDR 先收到 unhook 告警
- 现代 EDR 已经把 ETW + kernel callback 当主战场,单纯用户态 unhook 早已不够
text
Four main monitoring surfaces of EDR Red Team Countermeasures
───────────────────── ─────────────────────
User-mode ntdll hook ◄──► unhook (Peruns Fart / fresh ntdll)
indirect syscall / Hell's Gate
hardware breakpoint Blindside
kernel callback ◄──► call stack spoof
(Ps/Cm/Ob series) Follow legitimate trigger chains (do not bypass directly, cooperate with upstream stealth)
ETW telemetry ◄──► EtwEventWrite patch
(Microsoft-Windows-Threat- NtTraceControl disable provider
Intelligence, etc.) AmsiContext synchronous processing
AMSI scanning ◄──► AmsiScanBuffer patch (mov eax,0x80070057; ret)
(amsi.dll) hardware breakpoint bypass
reflective loading of duplicate amsi.dllKey Insights:
- EDR is not a black box — Key hooks / callbacks / providers can be reverse-engineered using IDA + windbg
- Bypass techniques need to be combined — A single unhook cannot solve ETW alerts, a single AMSI patch cannot solve syscall hooks
- Order matters — First ETW patch → then AMSI patch → then unhook; if the order is wrong, EDR will receive unhook alerts first
- Modern EDR has taken ETW + kernel callback as the main battlefield, pure user-mode unhook is no longer sufficient
工作流
Workflow
Step 1:识别目标主机的 EDR
Step 1: Identify the EDR on the Target Host
powershell
undefinedpowershell
undefined列出常见 EDR / AV 驱动
List common EDR / AV drivers
Get-Service | Where-Object {$_.Name -match 'CSAgent|SentinelAgent|elasticendpoint|esets|ekrn|MsMpEng|wdsvc|cyserver|sysmon|aswbidsagent'}
Get-Service | Where-Object {$_.Name -match 'CSAgent|SentinelAgent|elasticendpoint|esets|ekrn|MsMpEng|wdsvc|cyserver|sysmon|aswbidsagent'}
列出加载的 minifilter
List loaded minifilters
fltmc filters
fltmc filters
列出已注册的内核 callback(需 windbg + 内核调试 / 或用 PChunter / DRVHV)
List registered kernel callbacks (requires windbg + kernel debugging / or use PChunter / DRVHV)
!object \Callback
!object \Callback
!pnpcallback / Process / Thread / Image
!pnpcallback / Process / Thread / Image
EDR 指纹表见 `references/hook-survey.md` 顶部。
EDR fingerprint table is available at the top of `references/hook-survey.md`.Step 2:从 EDR DLL 提 hook 表
Step 2: Extract Hook Tables from EDR DLLs
- attach 到一个被注入 EDR 用户态组件的进程(任何已落地进程)
- 在 windbg 中 dump 当前 的
ntdll.dll段.text - 与磁盘上干净的 做 diff
C:\Windows\System32\ntdll.dll - 不一致的地方就是 hook 点
或者直接用 :
pe-sievepowershell
pe-sieve64.exe /pid 1234 /shellc 3 /modules 3 /dir hooks_dump详细方法见 。
references/hook-survey.md- Attach to a process injected with EDR user-mode components (any landed process)
- Dump the section of the current
.textin windbgntdll.dll - Compare it with the clean on disk
C:\Windows\System32\ntdll.dll - Inconsistent areas are hook points
Or directly use :
pe-sievepowershell
pe-sieve64.exe /pid 1234 /shellc 3 /modules 3 /dir hooks_dumpDetailed methods are available in .
references/hook-survey.mdStep 3:选绕过技术组合
Step 3: Select Bypass Technique Combinations
| 防御点 | 推荐绕法 |
|---|---|
| ntdll inline hook | indirect syscall + 动态 SSN (Halo's Gate) |
| ETW-TI provider | EtwEventWrite head patch |
| AMSI(PowerShell / .NET) | AmsiScanBuffer patch 或 HWBP |
| kernel callback | call stack spoof + 走 legit gadget |
| Sysmon ProcessCreate | PPID spoof + unbacked memory |
| Defense Point | Recommended Bypass Method |
|---|---|
| ntdll inline hook | indirect syscall + dynamic SSN (Halo's Gate) |
| ETW-TI provider | EtwEventWrite head patch |
| AMSI (PowerShell / .NET) | AmsiScanBuffer patch or HWBP |
| kernel callback | call stack spoof + use legit gadget |
| Sysmon ProcessCreate | PPID spoof + unbacked memory |
Step 4:在 implant 中实现
Step 4: Implement in Implant
代码骨架见 与 。
references/unhook-techniques.mdreferences/telemetry-blinding.mdCode skeletons are available in and .
references/unhook-techniques.mdreferences/telemetry-blinding.mdStep 5:本地 sandbox 验证
Step 5: Local Sandbox Verification
powershell
undefinedpowershell
undefined在隔离环境部署目标 EDR 试用版(Defender 默认即可起步)
Deploy trial version of target EDR in isolated environment (Defender is enabled by default for getting started)
启用 Sysmon + olaf-config
Enable Sysmon + olaf-config
sysmon64.exe -i sysmonconfig.xml
sysmon64.exe -i sysmonconfig.xml
跑 implant,看是否触发以下告警源:
Run implant and check if it triggers the following alert sources:
- Defender AMSI
- Defender AMSI
- ETW-TI
- ETW-TI
- Sysmon Event ID 1/7/8/10
- Sysmon Event ID 1/7/8/10
- EDR 控制台
- EDR Console
undefinedundefinedStep 6:投递
Step 6: Delivery
- 文件落地路径用合法软件目录
- PPID spoof 到 explorer.exe
- 配合 中的 initial access 节
attack-chain
- Use legitimate software directories for file landing paths
- PPID spoof to explorer.exe
- Cooperate with the initial access section in
attack-chain
典型场景
Typical Scenarios
场景 1:投递 cobalt-strike-alike beacon 过 Defender + Sysmon
Scenario 1: Deliver cobalt-strike-alike beacon to bypass Defender + Sysmon
text
目标:Windows 11 Enterprise + Defender (云查杀开) + Sysmon (olaf 配置)
要求:beacon 落地后能 callback 且不触发任何告警
组合拳:
1. shellcode 加密存储,运行时解密
2. AMSI patch(如果走 PowerShell 投递)
3. EtwEventWrite patch(消 ETW-TI)
4. 间接 syscall + Halo's Gate(消 ntdll hook 告警)
5. PPID spoof 到 explorer.exe
6. sleep 阶段用 Ekko / Foliage 加密自身内存text
Target: Windows 11 Enterprise + Defender (cloud detection enabled) + Sysmon (olaf configuration)
Requirement: Beacon can callback after landing without triggering any alerts
Combination:
1. Shellcode stored encrypted, decrypted at runtime
2. AMSI patch (if delivered via PowerShell)
3. EtwEventWrite patch (eliminate ETW-TI)
4. Indirect syscall + Halo's Gate (eliminate ntdll hook alerts)
5. PPID spoof to explorer.exe
6. Use Ekko / Foliage to encrypt own memory during sleep phase场景 2:在已落地的低权限 shell 上做 EDR sleep mask
Scenario 2: Implement EDR sleep mask on a landed low-privilege shell
text
前置:已经通过 phishing 拿到 medium IL shell,EDR 正在监控
风险:长时间驻留容易被内存扫描发现 beacon 特征
解法:
1. 不再申请新 RWX 内存
2. sleep 期间用 Ekko:
- WaitForSingleObjectEx + CreateTimerQueueTimer
- 在定时器里加密自身 .text + 把堆栈刷成全 0
3. wake 时用 ROP 还原
4. 配合 call stack spoof 让 RtlCaptureStackBackTrace 看不到信标地址text
Prerequisite: Already obtained medium IL shell via phishing, EDR is monitoring
Risk: Long-term residence is easy to be detected by memory scanning for beacon features
Solution:
1. No longer apply for new RWX memory
2. Use Ekko during sleep:
- WaitForSingleObjectEx + CreateTimerQueueTimer
- Encrypt own .text + flush stack to all 0 in the timer
3. Restore with ROP when waking up
4. Cooperate with call stack spoof to prevent RtlCaptureStackBackTrace from seeing beacon addresses按需自举(On-Demand Bootstrap)
On-Demand Bootstrap
工具依赖
Tool Dependencies
| 工具 | 用途 | 可自动安装 |
|---|---|---|
| pe-sieve | 检测进程中的 hook / 注入 | ✓ |
| API Monitor v2 | 动态观察 API 调用与 hook | 半自动(手动下载) |
| SysWhispers3 | 生成直接 / 间接 syscall stub | ✓(git clone + python) |
| Hell's Gate POC | 动态 SSN 解析参考实现 | ✓(git clone) |
| windbg + IDA | 静态逆 EDR DLL / 内核 callback | ✗(自己装) |
| Sysmon + olaf config | 本地验证环境 | ✓ |
| Tool | Purpose | Auto-Installable |
|---|---|---|
| pe-sieve | Detect hooks / injections in processes | ✓ |
| API Monitor v2 | Dynamically observe API calls and hooks | Semi-automatic (manual download required) |
| SysWhispers3 | Generate direct / indirect syscall stub | ✓(git clone + python) |
| Hell's Gate POC | Reference implementation for dynamic SSN parsing | ✓(git clone) |
| windbg + IDA | Static reverse-engineering of EDR DLL / kernel callback | ✗(install by yourself) |
| Sysmon + olaf config | Local verification environment | ✓ |
自举命令
Bootstrap Command
powershell
powershell -NoProfile -ExecutionPolicy Bypass -File "<SKILL_ROOT>\skills\scripts\bootstrap-reverse.ps1" -Capability @('pe-sieve','syswhispers3','sysmon') -StartServicespowershell
powershell -NoProfile -ExecutionPolicy Bypass -File "<SKILL_ROOT>\skills\scripts\bootstrap-reverse.ps1" -Capability @('pe-sieve','syswhispers3','sysmon') -StartServices路由上下文
Routing Context
上游入口:
- — 需要先理解 EDR DLL / 驱动的实现
reverse-engineering/ - — 决定在 kill chain 的哪个阶段引入本 skill
attack-chain/
同级关联:
- — 内网横向时如何与本 skill 联动
pentest-tools/network-attack-defense.md - — 反向视角,看检测方怎么写规则
malware-analysis/ - — 每次实战后回写经验
field-journal/
下游交付:
- 生成报告时引用 MITRE ATT&CK T1562 (Impair Defenses)、T1562.001 (Disable or Modify Tools)、T1562.006 (Indicator Blocking)、T1055 (Process Injection)、T1027 (Obfuscated Files or Information)
Upstream Entries:
- — Need to first understand the implementation of EDR DLL / driver
reverse-engineering/ - — Decide at which stage of the kill chain to introduce this skill
attack-chain/
Peer Associations:
- — How to link with this skill during internal network lateral movement
pentest-tools/network-attack-defense.md - — Reverse perspective, see how detection parties write rules
malware-analysis/ - — Write back experience after each actual combat
field-journal/
Downstream Delivery:
- Reference MITRE ATT&CK T1562 (Impair Defenses), T1562.001 (Disable or Modify Tools), T1562.006 (Indicator Blocking), T1055 (Process Injection), T1027 (Obfuscated Files or Information) when generating reports
法律边界声明
Legal Boundary Statement
- 仅限合法授权的红队 / 对抗演练 / 自有产品测试
- 操作前必须取得书面授权(SoW / 测试合同 / SRC 范围说明)
- 不得用于未授权目标,不得超出授权范围
- 发现高危问题立即向客户报告,遵循负责任披露
- 所有报告中真实目标信息必须脱敏(IP / 主机名 / 域名 / 凭证占位)
- For authorized red team / adversary simulation / in-house product testing only
- Must obtain written authorization (SoW / test contract / SRC scope description) before operation
- Do not use on unauthorized targets, do not exceed the authorized scope
- Immediately report high-risk issues to customers, follow responsible disclosure
- All real target information in reports must be desensitized (IP / hostname / domain name / credential placeholders)
参考资料
References
- 详细 hook 调研:
references/hook-survey.md - unhook / syscall 技术:
references/unhook-techniques.md - ETW / AMSI / 反取证:
references/telemetry-blinding.md - MITRE ATT&CK T1562:https://attack.mitre.org/techniques/T1562/
- Detailed hook research:
references/hook-survey.md - unhook / syscall techniques:
references/unhook-techniques.md - ETW / AMSI / anti-forensics:
references/telemetry-blinding.md - MITRE ATT&CK T1562: https://attack.mitre.org/techniques/T1562/
任务完成自检(声称完成前 MUST 通过)
Task Completion Self-Check (MUST Pass Before Claiming Completion)
- 我是否执行了工作流中的每一步(而不是只阅读)?
- 我是否基于 使用了真实工具路径?
tool-index - 我是否产出了可复现证据(命令/脚本/截图/报告)?
- 我是否完成并回写了 RULES 要求的 Checklist 项?
- Have I executed every step in the workflow (instead of just reading)?
- Have I used real tool paths based on ?
tool-index - Have I produced reproducible evidence (commands/scripts/screenshots/reports)?
- Have I completed and written back the Checklist items required by RULES?