1. Encrypt/Obfuscate Your #Macro Dropper
2. Get Your Powershell/Java/JS/DLL flavor of the week onto the victim ASAP
3. Bug out
I want to change all of this, however before we do that we need to upgrade Office Malware
1. Your code will eventually get deobfuscated
2. Your code is not unique - same sample <-> many targets
3. Most obfuscation methods = Noise/Signatures
4. Your code becomes evidence
You could literally write VBA code to write VBA code in itself.
Polymorphic macro viruses like W97M.Evolution and other nasties used this change their code on every exec
* there are a few ways to change the key and get this back but thats for another time and day
Your VBA code was in the document and therefore it stayed there even when your malware or pen test tool was analyzed it was all there laid out for the RE tools & team to take apart.
This is a special RW section in Office documents that allows variables to be written to the document and stored there on every execution.
Malware authors used it to put DLL payloads - this is a waste.
So Macros now do this:
1. Macro Executes
2. Macro reads features, variables, and obfuscation keys are stored in Doc.Vars
3. Macro nukes all vars after exec.
There is 2 issues with this:
A. Email Sever still has unexecuted sample and can be used to RE
B. All the cool kids like @decalage2 added Doc.Vars sigs
We need a way to get polymorphic self-deleting code into a document at runtime with as little red flags as possible.
And with that, let me introduce you to 2 wonderful methods:
InlineShapes.AddPicture & Range.EnhMetaFileBits
The request is done via Office itself and thus making your code less likely to get caught.
Additionally InlineShapes are used in legit macro often.
- Send Malicious Office File with partial code (husk)
- Target Executes Office File
- Target's Office Connects over HTTPS to your C2C
- Sever Validates Target & Delivers Image
- Malicious Office Reads Image Commands
- Nuke Image
- C2C hosts fake payload
After your malware is discovered and tossed in a sandbox they will see:
- HTTPS to C2C
- downloaded an image
- read byte content content
- used bytes to perform actions
RE will be never 100% accurate since its only partial
I should prob just get a medium for all of this.
Anyways enjoy kids