> For the complete documentation index, see [llms.txt](https://capcap-1.gitbook.io/capcap/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://capcap-1.gitbook.io/capcap/readme/ctf-modules/vulnerability-assessment/msf/payloads.md).

# Payloads

{% code title="FILTER USING GREP" %}

```bash
# Filter all Windows x64 payloads down to Meterpreter specific items
msf6 exploit(windows/smb/ms17_010_eternalblue) > grep meterpreter show payloads

# Chain multiple grep keywords to isolate a specific stager type
msf6 exploit(windows/smb/ms17_010_eternalblue) > grep meterpreter grep reverse_tcp show payloads
```

{% endcode %}

{% code title="SETTING AND VERIFYING" %}

```bash
# Select the payload by index number
msf6 exploit(windows/smb/ms17_010_eternalblue) > set payload 15

# View the unified exploit and payload variables
msf6 exploit(windows/smb/ms17_010_eternalblue) > options
```

{% endcode %}

<figure><img src="/files/o7Ua5mxbhPcnkAtDRuHk" alt=""><figcaption></figcaption></figure>

### Payloads:

#### 1. Singles (Inline Payloads)

* Definition: A completely self-contained executable block containing both the exploit logic and the entire shellcode needed to execute the desired task.
* Syntax Indicator: Indicated by a single underscore (`_`) in the name (e.g., `windows/shell_bind_tcp`).
* Pros: Highly stable because everything is delivered in a single transmission block. No secondary network connections are required.
* Cons: The file sizes are large. Many software vulnerabilities restrict the amount of space available in memory buffers (buffer limits), making large inline payloads unusable.

#### 2. Stagers

* Definition: A highly compact, reliable piece of code designed exclusively to establish a network connection back to the attacker's machine.
* Role: It prepares the memory environment on the victim (e.g., configuring execution protections like NX/DEP compatibility) and pulls down the larger payload stage.

#### 3. Stages

* Definition: Advanced post-exploitation modules (like Meterpreter or VNC injection) downloaded directly into memory by the Stager.
* Syntax Indicator: Indicated by a forward slash (`/`) in the name (e.g., `windows/shell/reverse_tcp`).
* Note on Delivery: Large stages cannot be downloaded reliably via a single standard network read operation (`recv()`). To prevent transfer failure, Metasploit automatically injects a hidden Middle Stager to allocate dynamic memory and manage the bulk download.

<figure><img src="/files/THH03lzMV0b0zQmSQ2LD" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://capcap-1.gitbook.io/capcap/readme/ctf-modules/vulnerability-assessment/msf/payloads.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
