msfvenom is the payload generator that ships with the Metasploit Framework. It builds the piece of code an attacker wants a target to run: a reverse shell, a bind shell, a stager, in whatever format the situation calls for. If exploitation is getting your code onto a target and making it run, msfvenom builds the code.
It is not new. According to the Metasploit documentation, msfvenom replaced the older msfpayload and msfencode tools in June 2015, and it ships inside the Metasploit Framework, which is still released frequently (version 6.5.5 in September 2026, and 6.5.9 by early November 2026, per the project’s release tags). Its age matters for defenders in a useful way: its default output is among the best-known signatures in endpoint security.
It appears in most red team and internal engagement reports. Here is what it does and, if it shows up in a report against your environment, what that actually tells you.
What a “payload” is
Two halves make up an attack: the exploit (the flaw that lets you run code) and the payload (the code that then runs). msfvenom builds the second half. The most common payload is a reverse shell: code that, once executed on a target, connects back to the attacker and hands them a command line on that machine.
msfvenom’s job is to produce that payload in the exact shape the engagement needs:
- The right platform: Windows, Linux, macOS, Android.
- The right format: a Windows
.exe, a Linux binary, a.dll, a macro, a raw shellcode blob, or a one-line script in Python, PowerShell, PHP, or Bash. - The right behavior: connect back out (reverse), listen for a connection (bind), or run a single command.
That flexibility is the point. A tester rarely controls how their code will be delivered, so they need a payload that fits the opening they have: a file upload, a command-injection flaw, a macro-enabled document.
msfvenom payload types: staged, stageless and Meterpreter
Payload names in a report look cryptic, but they follow a pattern, and the pattern tells you what ran on the host.
Plain shell or Meterpreter. A plain shell payload gives the tester an ordinary command prompt. Meterpreter is Metasploit’s advanced payload: instead of dropping a program on disk, it is loaded into the memory of a running process through reflective DLL injection, and it brings its own built-in commands for the work that follows, such as listing processes, moving files and capturing system information (Metasploit documentation on Meterpreter). That is the answer to a common question: the payload type that runs in memory and comes with built-in post-exploitation commands is Meterpreter.
Staged or stageless. A staged payload is deliberately tiny. It connects back and downloads the rest, the second stage, over the network. A stageless payload carries everything in one file and needs no second download (Metasploit documentation on stageless mode). The name shows which one was used: a slash before the connection type, as in windows/meterpreter/reverse_tcp, means staged, and an underscore, as in windows/meterpreter_reverse_tcp, means stageless.
| Payload type | What happens on the host | Where a defender can catch it |
|---|---|---|
| Staged | A small first stage runs, then pulls the full payload over the network | The second-stage download, and the injected code appearing in memory |
| Stageless | One larger file contains everything | File scanning at delivery, since there is more content to match |
| Meterpreter | Loaded into a process’s memory, with built-in commands | Memory scanning and behavior monitoring, not file signatures |
| Plain shell | A process spawns a command interpreter connected to the network | The parent and child process relationship, and the outbound connection |
On the tester’s side, something has to be listening for the connection. In Metasploit that is the generic handler, written multi/handler in command output, and the address and port it listens on are the ones to look for in your firewall and proxy logs.
Encoding and evasion, and why it mostly no longer works
msfvenom can also encode payloads, transforming them to change their signature, and historically this was used to slip past antivirus. It is worth being clear about how that has changed, because it matters for how you read a finding.
Classic encoding against modern endpoint protection is largely ineffective. The encoders were designed to solve a different problem (removing bad characters that break an exploit), and today’s EDR watches behavior (a process spawning a shell and beaconing out), not just static signatures. A default msfvenom payload is detected instantly by any competent endpoint product.
The encoder most people have heard of is x86/shikata_ga_nai, the one Metasploit’s own documentation uses in its examples. It changes how the payload’s bytes look, not what the code does once it runs, which is why behavior-based tools are unaffected by it. MITRE ATT&CK files this kind of transformation under T1027, Obfuscated Files or Information.
So when generated payloads do succeed in a modern test, the finding is usually not “the payload was clever.” It is one of:
- No endpoint protection was present on the compromised host.
- EDR was installed but misconfigured: in monitor-only mode, or with exclusions that covered the attack.
- Application allow-listing was absent, so an unknown binary was permitted to run at all.
Each of those is the real finding. The payload is just what demonstrated it.
What its appearance in a report means
If a report describes a shell obtained via an msfvenom payload, read past the tool to the control that failed:
- An endpoint control did not detect or stop a known-signature payload: investigate why (absent, misconfigured, excluded).
- A delivery path existed: a file upload that accepted an executable, a macro that ran, a command injection that fetched and executed a file. That path is a finding in its own right.
- Outbound connectivity was unrestricted, letting the reverse shell reach the internet. Egress filtering would have stopped it.
The value of the demonstration is the chain it proves: something ran that should not have, on a host that should have stopped it, and it talked to the outside world that should have been restricted. For the rest of the report, our guide on how to read penetration test results covers severity ratings, evidence and what to fix first.
Reading an msfvenom command in a test report
Reports often include the command that generated the payload. You do not need to run it to read it. The options below are described in the Metasploit documentation, and each one answers a question about the finding.
| Option | What it sets | What it tells you |
|---|---|---|
-p |
The payload | What ran: a plain shell or Meterpreter, staged or stageless, and for which platform |
LHOST, LPORT |
The address and port the payload connects back to | The outbound destination your egress filtering allowed |
-f |
The output format | The delivery path: an executable, a DLL, a script or raw shellcode for an exploit |
-e, -i |
The encoder and the number of encoding passes | The tester changed the payload’s signature. If it still ran, static detection was the only layer |
-b |
Characters to avoid | The payload had to survive an exploit or input filter that breaks on certain bytes |
-a, --platform |
Architecture and operating system | Which hosts the payload was built for |
-x |
A legitimate executable used as a template | The payload was hidden inside a normal-looking program |
-l |
Lists payloads, encoders or formats | Nothing ran; the tester was looking up options |
How defenders stop it
Modern defense against generated payloads is layered, and each layer is a legitimate finding if missing:
- Behavior-based EDR: the primary control. It catches the payload’s actions regardless of encoding.
- Application allow-listing: if only approved binaries run, an unknown payload never executes.
- Egress filtering: restrict outbound connections so a reverse shell cannot phone home.
- Attack-surface reduction: disable macros by default, restrict scripting engines, remove the delivery paths.
- Network monitoring: reverse-shell and C2 server traffic has detectable patterns. Our roundup of red team tools and C2 frameworks lists what generates that traffic.
A test that gets a payload running and beaconing out has usually found gaps across several of these layers, which is far more useful than the payload itself.
What each control should have caught
Four controls are supposed to stop a generated payload at different points. Reading which one failed is how you turn “we got a shell” into a specific fix:
| Control | What it should catch | What it means if the payload got past |
|---|---|---|
| Behavior-based EDR | a process spawning a shell and beaconing out, regardless of encoding | EDR was absent, in monitor-only mode, or an exclusion covered the path the payload used |
| Application allow-listing | any unapproved binary before it is allowed to execute | allow-listing was not deployed, so an unknown executable was permitted to run at all |
| AMSI (Antimalware Scan Interface) | script and in-memory payloads: PowerShell, VBScript and JScript, Office VBA macros | AMSI was disabled or unmonitored; a compiled binary is outside AMSI’s scope, so that case falls to EDR and allow-listing |
| Egress filtering | the reverse shell’s outbound connection back to the tester’s listener | outbound connectivity was unrestricted, so the shell could reach the internet |
A default msfvenom payload should trip at least one of these. When none of them fire, the finding is not the payload, it is the missing or misconfigured layer, and the report names which one.
How we use it in an engagement
msfvenom is a payload generation tool, used at the point of initial execution and access, across red team assessments and internal network testing, typically to demonstrate that a discovered flaw leads to actual code execution and a foothold. It is a means of proving impact, not a vulnerability in itself: it turns “this input is not validated” into “and therefore we ran code on your server,” the outcome known as remote code execution.
We only run code on systems the rules of engagement name, under the same written limits as the rest of the test: no destructive actions and no changes to production data. Often the most useful result is the one where the payload fails: the report says which layer stopped it, so you know the control works. Where one does get through, the report names the layer that missed it. Red team engagements start at $12,500 and internal tests at $6,000, both with a free retest; see the red team price page and internal test pricing.
Frequently asked questions
What is a Meterpreter payload? Meterpreter is Metasploit’s advanced payload. It is loaded into the memory of a running process instead of being saved as a program on disk, and it includes built-in commands for exploring and controlling the host. msfvenom can generate it in staged or stageless form.
What is the difference between staged and stageless payloads? A staged payload is a small first piece that connects back and downloads the rest. A stageless payload contains everything in one file. Staged payloads are smaller and fit tight exploits; stageless ones do not depend on a second download reaching the host.
What does the -p flag in msfvenom mean? It selects the payload: the code that will run on the target, such as a reverse shell or Meterpreter for a given platform. Every msfvenom command has one, so it is the first thing to read in a report.
Is msfvenom the same as Metasploit? No. Metasploit is the whole framework: exploits, payloads, listeners and post-exploitation modules. msfvenom is the command-line tool inside it that generates and encodes payloads as standalone files or shellcode.
Do antivirus and EDR detect msfvenom payloads? Default ones, yes, almost always. Their signatures are among the best known in endpoint security, and behavior-based EDR catches what the payload does even when it has been encoded. A default payload that runs undetected points to a missing or misconfigured control.
The short version
msfvenom generates the payloads, usually reverse shells, that demonstrate a flaw leads to real code execution. Its classic evasion features are mostly obsolete against modern EDR, which means when a generated payload succeeds in a current engagement, the finding is a missing or misconfigured defensive layer: absent endpoint protection, no application allow-listing, or unrestricted egress. Read any msfvenom finding as a question about which of those layers failed.
Want to know whether a foothold on one machine could turn into code execution across your network, and whether anything would stop it? That is exactly what a red team assessment measures. Scope one here.
Written by
Mark Kiss, Founder & CEO
15+ years in the field. Focus: Offensive security & strategy. Part of the team that scopes, tests, and reports for our clients. Full profile →