Windows Malware Implants

IN-PERSON 4 DAYS TRAINING: AUGUST 2023

Windows Malware Implants

OPSEC, Evasion and Anti-Reversing Techniques

Class Details

The course will present an in-depth description of the techniques implemented in modern malware to evade defenders and security products (such as AV, IPS, IDS, EDR), and how attackers design and operate their implants in order to ensure a prompt redeployment after a detection or a public disclosure by researchers or security vendors.

The course will also cover real-world scenarios that impair (effectively slow-down or dissuade) reverse engineering efforts and make the job of first responders tougher. The techniques will be demonstrated in two ways: first, by reversing real malware samples, and then by re-implementing an improved version of the malware code. The training is designed from an attacker's point of view, teaching red-teams how to make their implants stealthier, but it will also teach defenders how to deal with the anti-reversing and the OPSEC techniques demonstrated in class.

The course focuses primarily on Windows malware and on the analysis, tweaking and re-purposing of real malware samples. Participants will be provided with plenty of custom code to facilitate the understanding of complex malware techniques.

As part of the course, theory sessions will be followed by exercises where participants will reverse and re-implement specific parts of real malware in order to fully understand the hidden corners of all the techniques involved. The 50% of the course will be dedicated to hands-on labs that will show how to translate the theory principles into practice.

Labs are designed to provide flexibility in terms of complexity and include bonus tracks to ensure that you always feel engaged and have something interesting to explore and learn.

To develop and test the techniques described during the theory sessions, students will be provided with the source-code of our training agent and its corresponding C2.

Key Learning Objectives

  • Be able to recognize, implement and deal with stealthy malware/backdoors techniques and tradecrafts.
  • Be able to modify malware components and pre/post build tools to protect them against reversing efforts.
  • Familiarize with the latest advances in code and DLL injection techniques and customize reflective loader.
  • Be able to build custom obfuscators and to recognize some pattern left by some obfuscation transforms.
  • Learn tradecrafts used by attackers to prevent and effectively impair defensive incident responders from analyzing their tools, payloads, and backdoors.

Who should Attend

Developers and Reverse engineers who want to understand the tradecraft from a different point of view, red-team members who want to go beyond using third-party implants, and researchers who want to develop anti-detection techniques of real malware/apt.

Prerequisites

  • Programming experience (C, C++, Python, .NET, and PowerShell)
  • Be familiar with assembly language and Debuggers (IDA pro, WinDBG)

Hardware requirements

  • Virtualization capable CPU(s)
  • Minimum 8GB of RAM (for running one guest VM)
  • Minimum 80 GB free disk space

Software requirements

  • Host OS Windows 10 64-bit
  • Debugging Tools for Windows (Ida Pro, WinDBG). Decompiler recommended.
  • SysInternals Tools
  • Virtualization Software (VMWare, VirtualBox)
  • Guest OS Windows 10 64-bit Version 20H2
  • System Administrator access required on both host and guest OSs

Course Agenda

Module 1

  • Warm up (refresh basic concepts)
  • DynLoader
    • Dynamic APIs resolution
    • Import by hash
    • PEB walk
    • Syscall direct invocation
    • API Custom implementation
  • Obfuscation - Part 1
    • Obfuscation techniques
    • Opaque predicates, MBA, VM obfuscators

Module 2

  • Obfuscation - Part 2
    • Source level obfuscation
    • Intermediate representation obfuscations (LLVM)
  • Bring your own Loader
    • Windows Loader
    • Alternative Loaders
  • Injection - Part 1 (Advanced Reflective Loader)
    • Wide used injection techniques
    • Reflective Loader deep analysis
    • Customize RL

Module 3

  • Injection - Part 2 (Exotic Injection)
    • Uncommon injection techniques
    • Hooks
    • Implement an exotic injector
  • Anti-Debug
    • Debugging internals
    • Breakpoint detection (HW and SW)
    • Anti-tampering
  • Persistence and LPE
    • COM/DLL Hijacking
    • WMI persistence
    • SID, UAC, DACL, PPL, PP
    • Abuse WinSxS
    • Handle stealer

Module 4

  • Anti-VM
    • Artifact detection
    • Instruction and timing detection
    • Build an anti-vm module
  • Multi Lang Module
    • Run managed code from unmanaged
    • AMSI
    • Execution Guardrails
    • IPC
  • Dealing with ETW
    • Providers, Consumers, Sessions
    • User-space provider bypass
    • The Threat Intelligence Provider
  • Final Lab