Communitygithub.com

EDR 우회: 방어자 구현 리버싱에서 레드팀 우회까지

권한이 부여된 대상 호스트에서 EDR 탐지를 우회하여 임플란트를 배포하기 위한 기술을 안내합니다. ntdll hook, ETW, AMSI, 커널 콜백 등 주요 방어 메커니즘을 분석하고 우회하는 방법을 제공합니다.

EDR 우회: 방어자 구현 리버싱에서 레드팀 우회까지란 무엇인가요?

이 스킬은 레드팀, 퍼플팀 또는 공방 훈련 시나리오에서 EDR(Endpoint Detection and Response) 솔루션을 우회하기 위한 체계적인 접근법을 설명합니다. 사용자 모드 ntdll 훅, ETW 텔레메트리, AMSI 스캔 및 커널 콜백 등 EDR의 네 가지 주요 모니터링 영역을 분석하고, 각 영역에 대응하는 우회 기술(간접 시스템 콜, EtwEventWrite 패치, AmsiScanBuffer 패치, 콜 스택 스푸핑 등)을 상세히 다룹니다. 특히, 이 스킬은 macOS와 Linux보다는 Windows 환경에 초점을 맞추고 있으며, 다양한 레드팀 도구 및 스크립트(Cobalt Strike, pe-sieve, SysWhispers3 등)와의 연동을 지원합니다. 작업 흐름은 EDR 식별, 훅 테이블 추출, 우회 기술 선택, 임플란트 구현, 로컬 샌드박스 검증 및 최종 배포 단계로 구성되며, 각 단계에서 구체적인 명령어와 코드 스니펫을 제공합니다. 또한, 실전 경험을 바탕으로 한 두 가지 대표 시나리오(Beacon 배포 및 EDR 슬립 마스크)를 포함하여 실무 적용성을 높였습니다.

지원 대상~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/zhaoxuya520/reverse-skill/tree/main/skills/edr-bypass-re

즐겨 사용하는 AI에게 물어보기

이 에이전트 스킬이 미리 로드된 새 채팅을 엽니다.

문서

ACTION REQUIRED (읽는 즉시 실행)

  1. NOW: ../field-journal/precedent-reverse.md를 읽으세요 — 이 스킬의 작업이 승인된 정규 작업인지 확인하십시오
  2. NOW: 현재 작업이 이 스킬의 적용 범위에 해당하는지 확인하십시오
  3. NEXT: ../tool-index.md를 읽고 도구의 가용성과 실제 경로를 확인하십시오
  4. NEXT: 도구가 부족하면 bootstrap을 호출하고 경로를 추측하지 마십시오
  5. ACT: "워크플로" 첫 번째 단계로 진입하여 실행하고, 확인 상태에 머물지 마십시오

EDR 우회: 방어자 구현 리버싱에서 레드팀 우회까지은(는) 무엇을 하나요?

권한 있는 레드팀 / 공방 훈련 / 자체 제품 테스트 전용이며, 허가되지 않은 대상에 사용하는 것을 금지합니다.

적용 범위

레드팀 / 공방 시뮬레이션에서 승인된 대상 호스트에 임플란트를 배포하고 최신 EDR을 회피해야 할 때 이 스킬을 사용합니다.

  1. 레드팀 / 퍼플 팀 / 공방 훈련 — 고객이 SOC와 EDR의 실제 탐지 능력을 평가하기를 원할 때
  2. 자체 임플란트 / C2 프레임워크 개발 — 자체 제품 테스트를 위한 페이로드를 개발하며, 자사 또는 대상 EDR을 우회해야 할 때
  3. EDR 제품 평가 — 규정 준수 경계가 확인된 상태에서 특정 EDR의 탐지 범위를 객관적으로 평가할 때
  4. CTF / 공방 훈련의 Windows 엔드포인트 돌파 — 대회에서 강화된 호스트에서 안정적으로 실행해야 할 때

적용 불가 시나리오:

  • 백신 제조사가 자사 제품에 대해 완전한 RE를 수행하여 고객에게 상업적 평가 보고서를 제공하는 경우 (공식 협력사 이용)
  • 허가되지 않은 대상에 대한 우회 공격 (불법)
  • 일반 바이러스/트로이 목마의 우회 (이 스킬은 레드팀 OPSEC에 중점을 두며 악성코드 작성법을 가르치지 않습니다)

다른 스킬과의 역할 분담

시나리오사용 스킬
전체 체인 공격 (외부망에서 도메인 컨트롤러까지)attack-chain/
내부망 횡적 이동 / AD 공격pentest-tools/network-attack-defense.md
특정 호스트에서 EDR을 우회하여 임플란트 배포본 스킬
단순 정적 우회 (난독화 / 패킹)malware-analysis/ (역방향 관점)

attack-chain은 완전한 공격 체인에 중점을 두지만, 이 스킬은 EDR이라는 단일 상대의 내부 메커니즘과 맞춤형 우회 방법에만 집중합니다.

핵심 원리

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 패치로 syscall hook을 해결할 수 없습니다
  • 순서가 중요하다 — ETW patch 먼저 → AMSI patch 다음 → unhook 마지막; 순서가 잘못되면 EDR이 unhook 경보를 먼저 수신합니다
  • 최신 EDR은 이미 ETW + kernel callback을 주요 전장으로 삼고 있으며, 단순한 사용자 모드 unhook만으로는 부족합니다

워크플로

Step 1: 대상 호스트의 EDR 식별

# 일반적인 EDR / AV 드라이버 나열
Get-Service | Where-Object {$_.Name -match 'CSAgent|SentinelAgent|elasticendpoint|esets|ekrn|MsMpEng|wdsvc|cyserver|sysmon|aswbidsagent'}

# 로드된 미니필터 나열
fltmc filters

# 등록된 커널 콜백 나열 (windbg + 커널 디버깅 필요 / 또는 PChunter / DRVHV 사용)
# !object \Callback
# !pnpcallback / Process / Thread / Image

EDR 핑거프린트 표는 references/hook-survey.md 상단에 있습니다.

Step 2: EDR DLL에서 hook 테이블 추출

  1. EDR 사용자 모드 컴포넌트가 주입된 프로세스(이미 실행 중인 프로세스)에 attach합니다
  2. windbg에서 현재 ntdll.dll의 .text 섹션을 덤프합니다
  3. 디스크에 있는 원본 C:\Windows\System32\ntdll.dll과 비교(diff)합니다
  4. 일치하지 않는 곳이 hook 지점입니다

또는 pe-sieve를 직접 사용합니다:

pe-sieve64.exe /pid 1234 /shellc 3 /modules 3 /dir hooks_dump

자세한 방법은 references/hook-survey.md를 참조하십시오.

Step 3: 우회 기술 조합 선택

방어 지점권장 우회 방법
ntdll inline hook간접 syscall + 동적 SSN (Halo's Gate)
ETW-TI providerEtwEventWrite head patch
AMSI (PowerShell / .NET)AmsiScanBuffer patch 또는 HWBP
kernel callbackcall stack spoof + 합법적 가젯 사용
Sysmon ProcessCreatePPID spoof + unbacked memory

Step 4: 임플란트에 구현

코드 골격은 references/unhook-techniques.md 및 references/telemetry-blinding.md를 참조하십시오.

Step 5: 로컬 샌드박스에서 검증

# 격리된 환경에 대상 EDR 평가판 배포 (Defender 기본값으로 시작 가능)
# Sysmon + olaf-config 활성화
sysmon64.exe -i sysmonconfig.xml

# 임플란트 실행 후 다음 경보 소스가 트리거되는지 확인:
#   - Defender AMSI
#   - ETW-TI
#   - Sysmon 이벤트 ID 1/7/8/10
#   - EDR 콘솔

Step 6: 배포

  • 파일 배치 경로는 합법적인 소프트웨어 디렉토리를 사용합니다
  • PPID를 explorer.exe로 스푸핑합니다
  • attack-chain의 초기 접근 섹션과 연계합니다

대표 시나리오

시나리오 1: Cobalt Strike 유사 Beacon을 배포하여 Defender + Sysmon 우회

대상: Windows 11 Enterprise + Defender (클라우드 기반 탐지 켜짐) + Sysmon (olaf 구성)
요구사항: Beacon이 호스트에 배치된 후 콜백하며 어떠한 경보도 발생시키지 않아야 함

조합 기술:
  1. 쉘코드를 암호화하여 저장하고, 실행 시 복호화
  2. AMSI 패치 (PowerShell을 통한 배포 시)
  3. EtwEventWrite 패치 (ETW-TI 제거)
  4. 간접 syscall + Halo's Gate (ntdll hook 경보 제거)
  5. PPID 스푸핑하여 explorer.exe로 위장
  6. 슬립 단계에서는 Ekko / Foliage를 사용하여 자체 메모리 암호화

시나리오 2: 이미 확보한 낮은 권한의 셸에서 EDR 슬립 마스크 실행

전제: 피싱을 통해 medium IL 셸을 이미 확보했으며, EDR이 모니터링 중인 상태
위험: 장기간 체류 시 메모리 스캔에 의해 Beacon 특징이 탐지될 가능성

해결책:
  1. 새로운 RWX 메모리를 할당하지 않음
  2. 슬립 동안 Ekko 사용:
       - WaitForSingleObjectEx + CreateTimerQueueTimer
       - 타이머에서 자체 .text 암호화 + 스택을 모두 0으로 초기화
  3. 깨어날 때 ROP로 복원
  4. call stack spoof를 사용하여 RtlCaptureStackBackTrace가 비콘 주소를 보지 못하게 함

주문형 자체 부트스트랩 (On-Demand Bootstrap)

도구 의존성

도구용도자동 설치 가능
pe-sieve프로세스 내 hook / 인젝션 탐지✓
API Monitor v2API 호출 및 hook 동적 관찰반자동 (수동 다운로드)
SysWhispers3직접 / 간접 syscall stub 생성✓ (git clone + python)
Hell's Gate POC동적 SSN 해석 참조 구현✓ (git clone)
windbg + IDAEDR DLL / 커널 콜백 정적 분석✗ (직접 설치)
Sysmon + olaf config로컬 검증 환경✓

부트스트랩 명령

powershell -NoProfile -ExecutionPolicy Bypass -File "<SKILL_ROOT>\skills\scripts\bootstrap-reverse.ps1" -Capability @('pe-sieve','syswhispers3','sysmon') -StartServices

라우팅 컨텍스트

상위 진입점:

  • reverse-engineering/ — EDR DLL / 드라이버 구현을 먼저 이해해야 함
  • attack-chain/ — 킬 체인의 어느 단계에서 이 스킬을 도입할지 결정

동급 연계:

  • pentest-tools/network-attack-defense.md — 내부망 횡적 이동 시 이 스킬과 연동하는 방법
  • malware-analysis/ — 역방향 관점에서 탐지 측의 규칙 작성 방법 확인
  • field-journal/ — 실전 후 경험 기록

하위 산출물:

  • 보고서 생성 시 MITRE ATT&CK T1562 (방어 약화), T1562.001 (도구 비활성화 또는 수정), T1562.006 (지표 차단), T1055 (프로세스 인젝션), T1027 (난독화된 파일 또는 정보) 참조

법적 경계 선언

  • 합법적으로 승인된 레드팀 / 공방 훈련 / 자체 제품 테스트에만 한정됨
  • 작업 전 반드시 서면 승인(SoW / 테스트 계약 / SRC 범위 설명)을 받아야 함
  • 허가되지 않은 대상에 사용하거나 승인된 범위를 초과할 수 없음
  • 고위험 문제 발견 시 즉시 고객에게 보고하고 책임 있는 공개 절차를 따라야 함
  • 모든 보고서에서 실제 대상 정보는 반드시 비식별화(IP / 호스트명 / 도메인 / 자격 증명 자리 표시)되어야 함

참고 자료

  • 상세 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/

작업 완료 자가 점검 (완료 주장 전 반드시 통과)

  • 워크플로의 각 단계를 읽기만 한 것이 아니라 모두 실행했습니까?
  • tool-index를 기반으로 실제 도구 경로를 사용했습니까?
  • 재현 가능한 증거(명령어/스크립트/스크린샷/보고서)를 산출했습니까?
  • RULES에서 요구하는 체크리스트 항목을 완료하고 기록했습니까?

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

api-security

Use for authorized security assessment of REST, GraphQL, WebSocket, or SOAP APIs, including discovery, authentication, authorization, rate-limit, and CI/CD testing.

apk-reverse

在 CLI 环境下做 Android APK 逆向时使用。适用于 APK 解包、Java 反编译、smali 修改、重打包、Frida 动态 Hook,以及按需切换到 so/native 分析。优先使用本机已安装的 jadx、apktool、frida、adb、ida-reverse、radare2。

attack-chain

Use for authorized multi-stage attack-path planning and orchestration when a task spans reconnaissance, initial access, privilege escalation, lateral movement, or impact assessment. Route single-stage tasks directly to their specialist skill.

binary-diff

|

binary-ninja-reverse

Use for authorized binary analysis in Binary Ninja, including HLIL/MLIL/LLIL inspection, strings/imports/exports, cross-references, types, patch review, Python API automation, and optional Binary Ninja MCP or localhost HTTP integration.

browser-automation

|

browser-extension-reverse

Use for authorized reverse engineering of browser extensions (Chrome/Firefox) including manifest analysis, background workers, and extension-based credential or traffic logic recovery.

case-review

Reviews a reverse-skill case package for scope readiness, Evidence to Finding to Path traceability, work item coverage, timeline references, and optional artifact hash integrity before report handoff.

cloud-k8s

Use for authorized cloud, container, and Kubernetes security assessment including metadata SSRF, IAM misconfig, container escape paths, and cluster RBAC review.

code-audit

Use for authorized source-code security review and SAST workflows including Semgrep, CodeQL patterns, dangerous API hunting, and fix verification.

ctf-sandbox

Thin PRIMARY for CTF / AWD / 靶场 multi-type orchestration. Hands off to the sidecar CTF-Sandbox-Orchestrator. Use when the user says CTF, AWD, 靶场, or 比赛题 and no more specific pwn/APK/IDA route already won.

database-security

Use for authorized database security assessment covering PostgreSQL/MySQL/MSSQL/Mongo/Redis exposure, authz, UDF/command paths, and misconfiguration review.

diagram-generator

generate, refine, validate, and render diagrams from natural language, notes, code snippets, schemas, tables, or existing diagram source. use for flowcharts, swimlanes, sequence diagrams, state diagrams, er diagrams, class diagrams, architecture/c4-style diagrams, dependency graphs, gantt charts, mind maps, user journeys, sankey-style flows, org charts, network graphs, and other visual models. supports mermaid by default, graphviz dot for complex graph layout, plantuml for uml-heavy engineering diagrams, and svg output when direct markup is more reliable.

digital-forensics

Use for authorized digital forensics including memory dumps, disk timelines, PCAP investigation, artifact triage, and IR evidence preservation.

docs-generator

|

dotnet-reverse

.NET / C# 二进制逆向。当目标是 .NET assembly(PE 头含 CLR、.exe/.dll 托管程序)、C# 编译产物(含 NativeAOT)、红队 Sharp* 工具(Rubeus / SharpHound / SharpHound 等)、.NET 混淆程序(ConfuserEx / SmartAssembly / Babel / Eazfuscator)、.NET loader / info-stealer / 套壳 malware 时使用。优先用 dnSpyEx + de4dot,需要 AI 直接操作时联动 dnSpy MCP。不用于纯 native 二进制(走 reverse-engineering / ida-reverse)。

email-security

Use for authorized email security review including phishing analysis, header authentication (SPF/DKIM/DMARC), BEC patterns, and mailbox token abuse research.

firmware-pentest

|

ghidra-reverse

Use for free/open reverse engineering with Ghidra (headless or GUI), including decompile, cross-refs, and optional Ghidra MCP workflows when IDA is unavailable.

go-rust-reverse

Use for reverse engineering stripped Go and Rust binaries including runtime recognition, pclntab/moduel data recovery, panic strings, and idiomatic decompilation recovery.

관련 스킬