Notes from chapter 11 discussing malware behaviour.
Downloaders and Launchers
Downloaders download malware from internet and executes it, they commonly use URLDownloadToFileA followed by a WinExec.
Launchers AKA loaders is an executable that installs malware.
Backdoors
Allows remote access over HTTP with port 80 to hide in plain sight.
Windows Reverse Shells
Basic Technique
A connection that originates from an infected machine; allowing the attacker remote shell access. It starts cmd.exe in suppressed mode to hide it from the user, used to run netcat. It involves CreateProcess and manipulation of STARTUPINFO struct that’s passed to CreateProcess. A socket is created and a connection to remote server established.
Multi-threaded Technique
It involves creation of the socket, two pipes, and two threads. Utilising CreateThread and CreatePipe.
GINA Interception
GINA is A system introduced in windows XP to customise logon process by adding support to different functions such as RFID auth.
Third-party DLLs are found in the following registery
HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\GinaDLL
Malicious DLLs intercept the communication between msgina.dll and Winlogon; hence if there’s a DLL that exports many functions that starts with Wlx it’s an indication that a GINA interception is occuring.
Hash Dumping
Grab NTLM and LM hashes using a pass-the-hash attack to authenticate a remote host.
One of the most popular Hash Dumping tools pwdump which uses lsaext.dll, once it’s running inside lsass.exe; pwdump calls GetHash which exported by lsaext.dll.
samsrv.dll is also used to access SAM with some noticeable functions such as SamIConnect, SAmrQueryInformationUser, SamIGetPrivataeData.
Also secur32.dll can be used along with te function LsaEnumerateLogonSessions which retrieves a list of LUIDs
[!note] As the book is old, there are more info about pass-the-hash attack mostly common is
Mimikatztool, learn more here.
User-Space Keyloggers
Uses either Hooking or Polling. Hooking uses Windows API to notify the malware whenever a key is pressed, typically with SetWindowHookEx function.
Polling uses the windows API to constantly poll the state of the keys usually using GetAsyncKeyState and GetForegroundWindow functions.
Can be identified from checking strings or API calls.
Persistence Mechanisms
Windows Registery
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunHKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\WindowsAPPInit_DLLsHKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\Winlogon NotifyHKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SvchostSvchost group.HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\<ServiceName>
service-dependant persistence techniques can be detected with dynamic analysis and monitoring registry keys, or CreateServiceA in the disassembly of the sample.
Trojanised System Binaries
Malware can patch bytes of a system binary to force the system to execute the malware next time it runs. The system binary is modified by patching the entry function so it jumps to the malicious code.
pusha is commonly used in malicious code to save the initial state of the register so that it can be restored after it completes execution with popa.
DLL Load-Order Hijacking
Happens when a malicious dll is placed in a position that makes the system to load that dll before the legit dll, so when the system reaches the path of the dll in its search order, the dll is already loaded. e.g: a malicious ntshrui.dll is placed in /Windows meanwhile the legit ntshrui.dll is placed in /System32 so windows loads the dll in /Windows first and when it’s loading dlls from /System32 it finds that ntshrui.dll is already loaded.
default loading order in win XP:
- The directory from which the application loaded .
- The current directory.
- The system directory (the
GetSystemDirectoryfunction is used to get the path, such as…/Windows/System32/). - The 16-bit system directory (such as
…/Windows/System/). - The Windows directory (the
GetWindowsDirectoryfunction is used to get the path, such as…/Windows/). - The directories listed in the
PATHenvironment variable.
Privilege Escalation
Though most normal users use local accounts, some malware might want to perform privilege escalation so that it runs on the system level which users can’t manipulate its processes.
Using SeDebugPrivilege
Malware utilise SeDebugPrivilege which is a tool created fro system-level debugging,
that privilege is only given to local admin accounts, granting the SeDebugPrivilege to anyone is like giving them LocalSystem account access.
This technique can be detected by finding functions such as OpenProcessToken and LookupPrivilegeValue and AdjustTokenPrivileges.
User-Mode Rootkits
Rootkits are used by malware to hide its presence.
IAT Hooking
This technique modifiers the import address table IAT or the export address table EAT.

The technique is old and easily detectable, so Inline Hooking is used instead.
Inline Hooking
It overwrites the API function code contained in the imported DLL, unlike IAT it changes the function code itself.
Some information may be outdated