Index > Malware > 2021-01-28: Intro to x86, lsass, runtime linking
Three types of Linking:
strings
and floss
can reveal text data inside a binary. If the binary is packed or obfuscated, then only two strings will appear - GetProcAddress
and LoadLibraryA
.
Pwdump no longer works on Windows 10. It used to be able to extract password hashes from windows machines, when injected into the lsass process.
On windows servers (including domain controllers), passwords are stored in ntds.dit. When a pentester steals this file, you might hear them say “I dumped the dit! Let’s get some steak”
A process in windows that enforces security policy. It verifies users logging in, handles password changes, and creates access tokens.
GetForegroundWindow
, GetKeyState
, GetAsyncKeyState
An extract from a polling keylogger:
call ds:GetForegroundWindow
push 10h ; "10" in hex - virtual key code for shift
call ds:GetKeyState ; takes keycode to check off the stack
; Highest-order bit set means keyDown: 0x8000
; Lowest order means key "toggled" (like capslock): 0x0001
non-destructive AND between two arguments. If the result is all zeroes, then the zero flag is set.
Jumps to a memory address if and only if the zero flag is set.
Takes o1 minus 02,
I’m not sure what flag this sets.
Jump if less than.
I’m not sure what flag this checks
EAX can be split up like this:
+-----------------------------------+
| EAX |
+-----------------+-----------------+
| | AX |
+-----------------+--------+--------+
| | AH | AL |
+--------+--------+--------+--------+
| 8 bits | 8 bits | 8 bits | 8 bits |
+--------+--------+--------+--------+
EAX itself is the lowest 32 bits of a larger register, RAX
I should put this into it’s own quick-reference file
Takes the filename of the dll off the stack, places the address (once loaded) into esi
.
push offset LibFileName
call esi
The following example loads the samsrv
and advapi32
dll’s. (This was used by pwdump)
push offset LibFileName ; "samsrv.dll"
call esi ; LoadLibraryA
push offset aAdvapi32_dll_0 ; "advapi32.dll"
call esi ; LoadLibraryA
Takes two arguments:
Takes a virtual keycode, returns if it is down in the highest bit. returns if it is “toggled” in the lowest bit.
If you press and hold a (non-toggleable) key, this will continuously return 0x8000
Takes a virtual keycode. Returns if it is down in the highest bit. Returns if it has been newly pressed since the last call in the lowest bit.
This will return 0x8001
Index > Malware > 2021-01-28: Intro to x86, lsass, runtime linking