PE Relocation Table

Introduction One interesting section in a PE file is ".reloc" section that houses a special table called Relocation Table which is an important piece of information needed for Windows loader to load the program into the memory for running the program. When developing advanced malware artifacts, we need to implement functionalities found in Windows loader…

Assembly Byte Embedding & Reflection

This is a follow up writing to my previous article on basics of reflection. It is very common to see an encoded/encrypted/archived payload stored within the malware stagers that gets deployed at runtime using reflection. The stored payload data will be an array of bytes representing the assembly in its raw form. Recall that an…

Reflection in C# 101

Background As someone who is engaged in cyber threat intelligence, one needs to keep track of novel techniques employed by the adversaries to deliver their payload on to the target systems without having to touch the filesystem at all, completely fileless deployment, thus bypassing baseline detection mechanisms. As a means to achieve fileless delivery, malware…

The Stack, The Windows & The Adventures

Introduction This post is a "how-to" for writing Win32 code for performing a stackwalk on both x86 and x64 architectures and along the way we will learn the theory behind some of the concepts associated with the stack. In fact this is a quick note created for myself when I started working on designing a…

The Stack Series: The X64 Stack

Overview of x64 stack static RSP On x64 CPU, RSP register serves as both frame pointer and stack pointer, all the stack references are performed based on RSP as a result both local variables and parameters are referenced using RSP. The POP/PUSH instructions alter the RSP, because of this very fact, x64 permits changes to…

Memory Hiding Technique Series: Ekko – The basics

Introduction In previous post, we covered Gargoyle memory hiding technique, this time we will look at another technique called Ekko, a POC created by C5pider which is actually based on Austin Hudson's findings from reversing MDSec NightHawk payload. The implementation of the Ekko is very straightforward. There is a timer for synchronization. The Asynchronous Procedure…

Memory Hiding Technique Series: Gargoyle

introduction As reflective loading has become the staple vector for staging malware, adversaries rely on in-memory payloads for ensuring both operational security and evasion in the post exploitation phase and to counter such effort we have quite a few robust tools like Moneta and PE-sieve for scanning memories to catch active beacons/agents hidden inside running…