Macro creation
Creation of a malicious macro is a dat bit hard so here’s an explanation.
- Create a blank
.docor.docmfile - “Word 97-2003 Document”. You could also run it in.docxbut it’s not persistant and loads the macro from a remote global template (usually on attacker’s server). - In Word go to View -> Macros -> Name it -> Macros in: Document-> Create.
- Use a Powershell payload to get a rev shell. I like to use this PowerShell powercat reverse shell and fetch it from my attack python server.
- After you adjusted the command, Base64 UTF-16LE encode it for correct Powershell support - make sure no line-breaks are present.
- Then, pass the encoded string into the Base64 string splitter so it can be spliced into macro-friendly snippets and later concatenate them back together in the Str variable.
- Now, put all of that data into the specified spot in the macro. You can use this simple Microsoft Office macro.
- Lastly, run you favorite listener, deliver the payload with like phishing (swaks), SMB or similar and wait for a connection.
References
Used in: JobTwo
Similar techniques: Restore corrupted office files