Skip to content
Tutorials Center
My learning

Topics

Lesson 15 of 37 ยท Exploits and Payloads

Payloads: Singles, Stagers and Stages Explained

Learn how Metasploit payloads are named and built: singles versus staged payloads, reverse versus bind connections, architectures, and how defenders detect each kind.

A payload is the code that runs on the target after an exploit succeeds (or after a user runs a test file in a lab). Metasploit has hundreds of them, organised by a strict naming scheme. Once you can read the name, you know what the payload does and what traffic it creates, which is also what a defender looks for.

This lesson is conceptual and defensive. It shows no working payload bytes; it explains the structure and has you parse and reason about names.

The three kinds

  • Singles are self-contained: everything needed is in one piece. They are larger but need no extra connection to finish.
  • Stagers are tiny pieces that set up a communication channel (and allocate memory) and then download the next piece.
  • Stages are the larger payload components a stager downloads, for example the Meterpreter agent.
sequenceDiagram
    participant T as Target (lab)
    participant H as Handler (your listener)
    T->>H: 1. Stager connects (small)
    H->>T: 2. Sends the stage (larger)
    T->>H: 3. Stage runs, session opens

Staged payloads open the door first and bring the furniture later. Each step is a chance for a defender to notice.

Why stage at all? Exploits often have very little room for code. A small stager fits; the stage can be as large as needed.

Reading a payload name

Names are paths: payload/<platform>/<architecture>/<kind>/<connection>. Common forms:

TEXT
payload/linux/x64/shell_reverse_tcp          (single)
payload/linux/x64/shell/reverse_tcp          (stager + stage)
payload/windows/x64/meterpreter/reverse_https
payload/cmd/unix/reverse_example             (command payload, no native code)

A slash between the stage and the connection means staged (shell/reverse_tcp); an underscore means single (shell_reverse_tcp). This detail trips up many beginners.

Part Examples Meaning
Platform windows, linux, osx, java, php, cmd Where it runs
Architecture x86, x64, aarch64 CPU it was built for
Stage shell, meterpreter What you get once it runs
Connection reverse_tcp, reverse_https, bind_tcp How it talks to you

Reverse versus bind

  • Reverse payloads make the target connect out to your listener (LHOST and LPORT). This works through most firewalls because outbound connections are normally allowed.
  • Bind payloads open a port on the target and wait for you to connect (RHOST, LPORT). They fail when inbound traffic to the target is blocked or when the target is behind NAT.

For defenders this shows why egress filtering (controlling outbound connections) matters as much as ingress rules: a reverse payload needs a way out. Allow-listing destinations, inspecting TLS metadata and using a proxy shrink the attacker's options.

Setting payload options

TEXT
msf6 exploit(example/vulnerable_service) > show payloads
msf6 exploit(example/vulnerable_service) > set PAYLOAD linux/x64/shell/reverse_tcp
msf6 exploit(example/vulnerable_service) > set LHOST 10.10.10.5
msf6 exploit(example/vulnerable_service) > set LPORT 4444

LHOST is your lab attacker machine's address on the isolated network; LPORT is the listening port. Port 4444 is Metasploit's well-known default, so many detection rules already match it. Changing it does not make a payload safe from detection, but using the default in a test tells you whether basic rules fire.

A parser for payload names

The stand-in below reads a payload path and explains it in plain words, the way you will learn to by eye. It handles singles versus staged payloads by checking whether the last two components are separated by a slash.

Python Explain a payload name

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Which should a tester choose?

Most testers choose a reverse staged payload because it works through typical firewalls and keeps the first stage small. In a lab built to test detection, try singles, stagers and different transports (tcp, http, https) to see what each security control catches. If the defence only catches the default, that is a finding.

Python Compare payload styles by network footprint

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Defender view: detecting payloads

  • Network: repeated short beacons to one external address, connections to unusual ports, TLS with odd certificate fields.
  • Host: an unexpected process with no parent you recognise, memory regions that are writable and executable, services spawning shells.
  • Antivirus and EDR: stagers and stages are among the most heavily signatured code in existence; default payloads are caught by most products, which is why testers use detection-testing modules to measure coverage.
  • Prevention: application allow-listing, egress filtering, least privilege for service accounts and exploit protections.

Check your understanding

Quick check ยท 5 questions

of 5 answered You scored / 5 ยท perfect!

  1. 1. How do you tell a staged payload from a single by its name?

    shell/reverse_tcp is staged; shell_reverse_tcp is a single.
  2. 2. In a reverse payload, who initiates the connection?

    Reverse payloads call back from the target to the handler.
  3. 3. Why do staged payloads exist?

    A tiny stager fits in constrained exploit space and pulls in the stage later.
  4. 4. Which control most directly limits reverse payloads?

    Reverse payloads need an outbound path; controlling outbound traffic blocks it.
  5. 5. What do LHOST and LPORT mean for a reverse payload?

    The payload connects back to LHOST:LPORT, where your handler listens.

Summary

  • Singles are self-contained; stagers fetch stages.
  • Read names as platform / architecture / stage / connection; a slash means staged.
  • Reverse payloads dial out; bind payloads listen on the target.
  • Defenders respond with egress filtering, EDR, allow-listing and logging.

Next: Handlers and Sessions