Malware Reverse Engineering by Development (Online Training)
Learn malware reverse engineering skills in IDA and x64dbg by developing a Windows 11 DLL backdoor in VS2022 and analyzing what you’ve built. All the source code will be provided by the instructor for several versions of the backdoor with increasing levels of anti-analysis protections, so you can approach the RE challenge at whatever skill level you prefer, from hard mode (analyzing the release version with no pdb) to using the debug version as a help, to just reading the source and matching to x86 instructions. You will build the same DLL for 32-bit or 64-bit architectures to see the difference in assembly.
During the course of this class, learners will have the opportunity to gain the following skills, if they choose to participate fully:
- Using Microsoft Windows 11 Developer VM (free) and Visual Studio 2022 (free), write and compile a very simple DLL file for Windows in C that writes content to a file on disk.
- Run DLL files from the command line using rundll32.
- Using IDA Free 7, perform static code analysis of a very simple DLL file and explain its purpose.
- Using x32dbg, set breakpoints and step through running the instructions of a simple DLL file via rundll32.
- Create a Microsoft 365 Developer Tenant (free) for testing MSTeams, etc.
- Use vcpkg to install static libraries for Libcurl and cJSON in VisualStudio 2022.
- Modify the C code of a simple DLL project to send a simple message through Microsoft Teams via a webhook URL.
- Using IDAFree and x32dbg, analyze the new version of the DLL and find the instructions responsible for network connections.
- Using C source code provided by the instructor, modify the DLL project to be a typical Remote Access Trojan (RAT) capable of running commands, listing files and processes, and reporting the output to a Command-and-Control server.
- Modify the DLL to allow execution using rundll32, regsvr32, and msiexec.
- Using IDA Free and x32dbg, analyze the relevant portions of the RAT to identify the main command loop, commands recognized, network connections, and behavior-based indications of compromise that could be used by threat hunters and security engineers.
- Write a tactical malware analysis report, focusing on actionable details.
- Provide constructive feedback to another student about their malware analysis report.
- Analyze another student’s version of the DLL with a few minor modifications and identify the relevant changes in functionality added by the other student.
- Using strings and FLOSS, extract strings from a compiled executable file.
- Using Python and C source code provided by the instructor, modify the DLL file to XOR encode some of the strings in the DLL project.
- Using IDA Free, analyze the XOR decoding function in another student’s DLL to find the key bytes and decode the encoded strings.
- Using C code provided by the instructor, modify the DLL project to detect when it is being run in a virtual machine or debugger, causing the DLL to modify its behavior when analyzed.
- Using IDA Free and x32dbg, recognize the anti-analysis code in the DLL and patch the instructions to bypass the protections and analyze it anyway.
Bonus Learning Objectives (if time permits):
- Modify the DLL to load Windows API functions dynamically using hashed DLL and API function names.
- Using IDA Free, recognize the API hashing/loading code and reverse-engineer the hashing function to find the libraries that the malware loads.
- Learn to use Ghidra as an alternative to IDA.
- Modify the DLL to inject code into another process and analyze the result.
- Implement rc4 encryption and recognize the algorithm in assembly.
- Implement a simple packer/crypter that contains an RC4-encrypted copy of the RAT DLL payload as a resource file, extracts and decrypts it, saves the DLL to disk and executes it with rundll32.
- Modify the packer/crypter to execute the unpacked DLL from memory instead of writing it to disk.
- Use Hasherezade’s PE-seive to dump payloads from memory and analyze with IDA or Ghida.
- Write a PowerShell script that uses Reflective DLL injection to download and execute the DLL payload from memory.
- Write a Visual Basic for Applications (VBA) macro in a Microsoft Word document that will execute a PowerShell script.
- Analyze another student’s PowerShell & VBA loader and obtain the final payload for analysis.
- Write an advanced malware analysis report and provide constructive feedback.