Senior Security Engineer @Amazon. Ex Assistant Professor. Opinions are mine; not my employer's. DM is open.
Author of xlmdeobfuscator and https://t.co/eh1fMHMADE
Jul 6, 2022 • 6 tweets • 2 min read
#VBA declare statement: from libname #obfuscation to remote dll loading 🧵
Declare is used to declare a ref to an external proc in a DLL
Syntax:
[Public | Private] Declare Function name Lib "libname" [Alias "aliasname"] [ ( [arglist] ) ] [As type]
ref: docs.microsoft.com/en-us/office/v…
0⃣ both "kernel32" and "kernel32.dll" are acceptable libnames
1⃣ padding with space chars " kernel32 "
2⃣ adding arbitrary . to the mix " kernel32 .. .. . "
gnu.org/software/bash/…
"Words of the form $'string' are treated specially. The word expands to string, with backslash-escaped characters replaced as specified by the ANSI C standard."