Details πŸ”Ž

Evading EDR

Description

Nearly every enterprise uses an Endpoint Detection and Response (EDR) agent to monitor the devices on their network for signs of an attack. But that doesn’t mean security defenders grasp how these systems actually work. This book demystifies EDR, taking you on a deep dive into how EDRs detect adversary activity. Chapter by chapter, you’ll learn that EDR is not a magical black boxβ€”it’s just a complex software application built around a few easy-to-understand components.

The author uses his years of experience as a red team operator to investigate each of the most common sensor components, discussing their purpose, explaining their implementation, and showing the ways they collect various data points from the Microsoft operating system. In addition to covering the theory behind designing an effective EDR, each chapter also reveals documented evasion strategies for bypassing EDRs that red teamers can use in their engagements.

Notes and excerpts πŸ“

EDR-chitecture

Common components of an EDR:

  • Static scanner
  • Kernel driver
  • Agent service
  • Additionally:
    • Network filter driver
    • Event Tracing for Windows (ETW) consumers
    • Early Launch Antimalware (ELAM)
    • Filesystem filter drivers

Function-hooking DLLs

Functions related to memory and object management etc. are delegated to the kernel via syscall instructions that arts centralised in the exported functions of ntdll.dll. Some commonly hooked functions are:

  • NtOpenProcess
  • NtAllocateVirtualMemory
  • NtWriteVirtualMemory
  • NtCreateThreadEx
  • NtSuspendThread
  • NtResumeThread
  • NtQueueApcThread
  • NtCreateSection
  • NtMapViewOfSection
  • NtUnmapViewOfSection
  • NtLoadDriver

Code or exercises πŸƒβ€β™€οΈ

Calling Syscalls Directly from Visual Studio to Bypass AVs/EDRs

Screenshots & code πŸ§‘β€πŸ’»