Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

payload-inject

Publish built-in injection payloads or a custom wordlist to a topic and optionally monitor a second topic for responses.

Synopsis

mqattack payload-inject [OPTIONS] -t <TOPIC>

Options

FlagDefaultDescription
-t, --topic <TOPIC>(required)Target topic
--set <SET>-Built-in payload set, repeatable (see table below)
-w, --wordlist <FILE>-Custom payload file (one payload per line)
-q, --qos <QOS>0QoS level: 0, 1, or 2
-r, --retainoffSet the retain flag on each published payload
--delay <MS>100Milliseconds between payloads
--monitor <TOPIC>-Subscribe on a second connection to capture responses
--monitor-wait <SECS>5Seconds to listen after the last payload

Built-in payload sets

SetCountContents
sql13Classic, union, time-based, and error-based SQL injection
cmd15Shell operators (;, |, &&), command substitution, cloud metadata endpoint
xss11Script tags, event handlers, template expressions ({{7*7}}, ${7*7})
fmt11Format string specifiers (%x, %s, %n) and Python object inspection
xxe5XML external entity file inclusion (/etc/passwd, Windows paths, XInclude)
json10NoSQL injection, prototype pollution, deeply nested structures
mqtt11Empty payload, null bytes, CRLF injection, wildcards, path traversal, malformed UTF-8, large payloads (1 KB, 64 KB)
all76All of the above combined

Multiple --set flags can be combined; duplicates are deduplicated automatically.

Examples

SQL injection probes

mqattack payload-inject -H 192.168.1.10 -t 'device/cmd' --set sql

Combined SQL and command injection with response capture

mqattack payload-inject -H 192.168.1.10 \
  -t 'device/cmd' --set sql --set cmd \
  --monitor 'device/response' --monitor-wait 10

All built-in payloads, slower delivery

mqattack payload-inject -H 192.168.1.10 \
  -t 'app/input' --set all --delay 500

Custom payload wordlist

mqattack payload-inject -H 192.168.1.10 \
  -t 'device/cmd' -w my-payloads.txt

Combined built-in and custom payloads

mqattack payload-inject -H 192.168.1.10 \
  -t 'device/cmd' --set sql -w extra-sqli.txt

MQTT-specific fault injection (null bytes, oversized messages)

mqattack payload-inject -H 192.168.1.10 \
  -t 'app/data' --set mqtt --monitor 'app/data'

Retain payloads so they persist for future subscribers

mqattack payload-inject -H 192.168.1.10 \
  -t 'config/value' --set json -r -q 1

Injection over TLS with credentials

mqattack payload-inject --cafile ca.crt \
  -H broker.example.com -p 8883 -u writer -P secret \
  -t 'app/input' --set all

Notes

  • The monitor connection listens on a separate MQTT client; it can capture any topic including the target topic itself.
  • --delay 0 sends payloads back-to-back. Increase it if the broker or the downstream application needs time to process each message.
  • QoS 0 (--qos 0) gives maximum throughput; QoS 1 or 2 ensures each payload is acknowledged before the next is sent.
  • --set all sends 76 payloads; budget 76 × delay milliseconds plus monitor wait time for the full run.