Reverse HTTP Listener for Built Agents
The HTTP listener opens an HTTP/HTTPS server on a specified port and manages data traffic with agents.
Plugin ID: shelldot.listener.agent-reverse-http
HTTP Listener Configuration
The table below documents all available configuration parameters in a logical order:
| Attribute | Explanation |
|---|---|
| port | Port number where the generated payload calls home. If bindToPort is set to null, it will also be the port that listener runs |
| bindToPort | Port number where the listener actually runs. Default is "null", in that case the "port" variable is used |
| https | Protocol flag (0 = HTTP, 1 = HTTPS). |
| startTime | Optional UTC start time (e.g., "2023-04-10T11:02:09Z"). |
| getUri | URI used by the agent for GET requests when idle. |
| postUri | URI for sending data via POST (also receives data). |
| stagedUri | URI requested for generating agent executable/dll/service/shellcode. |
| stagedUriPayloadId | What GET parameter should containg id of the payload to download via stagedUri |
| filename | A template string visible in the HTTP response when payload is served via the stagedUri and stagedUriPayloadId parameters ( used primarily in the launchers ). See the examples on the bottom of the page. |
| fileStorageUri | Base URI for retrieving files from file storage. |
| metadataCookieName | Cookie name used to hold metadata. |
| metadataPrefix | Prefix appended to metadata. |
| metadataSuffix | Suffix appended to metadata. |
| instantResponses | Boolean indicating if the agent sends data immediately or waits for the sleep timeout (for OPSEC). |
| sleep | Global Base sleep time (seconds) between requests. Can be overridden by httpCallbacks[].sleep |
| sleepRandom | Global Variation (seconds) in the sleep time. Can be overridden by httpCallbacks[].sleepRandom |
| headers[ ] | Additional HTTP headers (array of objects with "name" and "value"). |
| ↳ name | Name of the header. |
| ↳ value | Value of the header. |
| httpCallbacks[ ] | Array of callback configuration objects. |
| ↳ hosts[ ] | Array of IP addresses or hostnames the agent can use to connect. |
| ↳ hostsRotation: | Rotation rules for host selection. |
| ↳ type | Rotation method (FAILOVER, ROTATE, RANDOM). |
| ↳ counter | Numeric value indicating when to rotate hosts. |
| ↳ unit | Unit for the counter (TRIES, SECONDS, MINUTES, HOURS). |
| ↳ sleep | Base sleep time (seconds) between requests. |
| ↳ sleepRandom | Variation (seconds) in the sleep time. |
| ↳ hostHeaders[ ] | Array of HTTP host header values used when connecting. |
| ↳ hostHeaderRotation: | Rotation rules for host headers. |
| ↳ type | Rotation method for host headers (FAILOVER, ROTATE, RANDOM). |
| ↳ counter | Numeric value for header change frequency. |
| ↳ unit | Unit for the header counter (TRIES, SECONDS, MINUTES, HOURS). |
Hosts string array
If inner hosts string array contains more than 1 hostname/IP, then it's same as host object array to contain same number of objects, each with only one value in host string array bus rest configuration same. This is just so users would be able to keep configuration smaller.
These two configurations are equal:
Examples
Example 1: Basic Configuration with Host Rotation
Example 2: Complex Rotation Rules
How the rotation works:
- Agent starts with connection to IP localhost using host header "alpha"
- For the localhost connection:
- Host rotation occurs after 5 minutes of failed connections
- Host headers rotate every 30 seconds between "alpha", "bravo", and "charlie"
- For the 192.168.1.100 connection:
- Host rotation occurs after 3 failed connection attempts
- Host headers randomly switch between "delta" and "echo" with 50% probability before each request
Note: Host rotation and header rotation operate independently. A successful connection resets the host rotation counter, while header rotation continues according to its own rules.
Available filename template string functions
| Template | Description |
|---|---|
{rand_str_X} |
Where X is number of characters. Will generate a random case insensitive string with the length of "X" (integer) |
{rand_str_X_Y} |
Where X is the minimum length and Y is the maximum length. Will generate a random case insensitive string with a length between X and Y |
{rand_int_X_Y} |
Where X is the minimum and Y is the maximum. Will generate a random integer between X and Y |
{ext} |
Will return the file extension of the requested payload. eg. .exe or .dll ( note that dot is included in the extension) |
{payload_id} |
Will return the payload id of the requested payload |
Example Usage:
stagedUri to return: