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

brute-auth

Test username/password combinations against the broker. The broker’s ConnAck return code (BadUserNamePassword, NotAuthorized or success) determines whether a credential pair is valid.

Synopsis

mqattack brute-auth [OPTIONS]

Options

FlagDefaultDescription
-c, --credentials <FILE>-Credential pairs file (username:password per line)
-u, --username <USER>-Single username for dictionary attack
-U, --user-list <FILE>-Username wordlist
-W, --pass-list <FILE>-Password wordlist
-P, --password <PASS>-Single password for spray attack
--try-anonymousoffTest anonymous (no-credentials) access first
--stop-on-successoffStop after the first successful login
--delay <MS>0Milliseconds between attempts
--timeout <SECS>5Seconds to wait per attempt
--forceoffOverride the cross-product safety cap (10000 attempts)

Attack modes

ModeRequired flagsUse case
Credential pairs-c FILETest a pre-built username:password list
Single-user brute-force-u USER -W FILEDictionary attack on one account
Password spray-U FILE -P PASSOne password against many users
Cross-product-U FILE -W FILEAll combinations (capped at 10000)

Credential pairs file format

One username:password pair per line. The first colon is the separator, so passwords may contain additional colons. Blank lines and lines starting with # are ignored. A line with no colon is treated as a username with an empty password.

# credentials.txt
admin:admin
admin:password
guest:
service:pass:word:with:colons

Examples

Anonymous access probe, then credential list

mqattack brute-auth -H 192.168.1.10 \
  --try-anonymous -c credentials.txt --stop-on-success

Dictionary attack on a single account

mqattack brute-auth -H 192.168.1.10 \
  -u admin -W /usr/share/wordlists/rockyou.txt

Password spray with rate limiting

Using --delay to space attempts and avoid triggering account lockouts.

mqattack brute-auth -H 192.168.1.10 \
  -U users.txt -P 'Mqtt@2024' --delay 500

Full cross-product over TLS

mqattack brute-auth --cafile ca.crt \
  -H broker.example.com -p 8883 \
  -U users.txt -W passwords.txt

Cross-product exceeding the safety cap

mqattack brute-auth -H 192.168.1.10 \
  -U users.txt -W large-passwords.txt --force

Stop on first success, pipe valid credentials to enum-perms

mqattack brute-auth -H 192.168.1.10 -c credentials.txt --stop-on-success \
  | grep 'SUCCESS' | awk '{print $2}' > valid.txt

mqattack enum-perms -H 192.168.1.10 -c valid.txt -w topics.txt

Notes

  • The cross-product mode (-U FILE -W FILE) is capped at 10,000 attempts by default to prevent accidental denial-of-service conditions. Use --force to remove the cap.
  • Add --delay when testing production systems or when the broker enforces rate limits or temporary bans.
  • --try-anonymous is always the first check, regardless of other flags.