RabbitMQ and Message Broker Ports Without Auth

RabbitMQ and Message Broker Ports Without Auth

A RabbitMQ node, Kafka cluster or ActiveMQ instance that accepts connections from the public internet without authentication puts your application’s internal traffic in front of anyone who scans for it. This article covers the ports message brokers open by default, what an attacker can do with a broker that has no working authentication, how to confirm your exposure with an external scan, and how to lock things down without breaking producers and consumers.

Most of the people who run into this problem are not broker specialists. They are sysadmins or backend developers who started RabbitMQ in a container for a queue-based worker setup, published the ports so a remote service could connect, and never looked at it again.

Which Message Broker Ports Actually Get Exposed

RabbitMQ listens on more ports than most people expect. 5672 carries plain AMQP, 5671 carries AMQP over TLS, and 15672 serves the management UI and HTTP API once the management plugin is enabled. Behind those, 25672 handles inter-node and CLI tool communication, and 4369 is epmd, the Erlang port mapper daemon. If MQTT, STOMP or Prometheus plugins are enabled, add 1883, 8883, 61613, 15674, 15675 and 15692.

Other brokers have their own well-known ports. Apache Kafka uses 9092 for its default PLAINTEXT listener, and older deployments also run ZooKeeper on 2181. ActiveMQ Classic exposes OpenWire on 61616 and its web console on 8161. Mosquitto and other MQTT brokers sit on 1883. NATS uses 4222 for clients and 8222 for monitoring.

The management and clustering ports cause the most damage. An open 5672 lets someone read and inject messages. An open 15672 with working credentials gives them full administrative control. An open 25672 combined with a leaked or guessable Erlang cookie amounts to remote code execution on the host.

What an Attacker Does with an Unauthenticated Broker

Picture a typical case. A small team deploys an order-processing pipeline on a VPS. RabbitMQ runs in Docker with `-p 5672:5672 -p 15672:15672` so a worker on a second provider can connect. The host firewall is UFW, but Docker writes its own iptables rules, and those bypass UFW completely. Within 24-48 hours, Shodan-style crawlers have indexed the AMQP banner and the management login page.

From there, the attacker tries guest/guest. Since RabbitMQ 3.3.0, the guest account only works from localhost. However, the official Docker image has long shipped with `loopback_users.guest = false`, which removes that protection, so guest/guest often works remotely on containerized deployments. Once inside, the attacker can list queues, read payloads holding customer emails, API tokens or payment references, publish forged messages that workers will process as if they were genuine, or simply purge queues.

ActiveMQ shows how quickly this turns into a full compromise. CVE-2023-46604, a deserialization flaw in the OpenWire protocol on port 61616, allowed unauthenticated remote code execution. It was disclosed in October 2023, and ransomware operators were exploiting it within days. Authentication made no difference there – the port being reachable was enough.

The Myth That “Non-HTTP Ports Don’t Get Found”

One common belief is that brokers are hard to discover because AMQP and OpenWire aren’t web protocols. That’s wrong. An AMQP server answers a protocol header with a recognizable response, and Nmap’s `amqp-info` script pulls the product name, version and supported authentication mechanisms in one request. Internet-wide scanners fingerprint 5672, 9092 and 61616 as routinely as they fingerprint port 80.

A second myth goes like this: “We changed the default password, so the broker is safe.” Credentials protect the management API. They do nothing about protocol-level vulnerabilities in the broker or in the Erlang runtime it sits on, and they don’t stop brute forcing against a login page that has no rate limiting.

Auditing Message Broker Ports Without Auth Step by Step

An experienced penetration tester begins from outside the network, because the host’s own view of its firewall is often wrong. A practical sequence:

1. Run an external scan from a network you don’t control: `nmap -sV -p 1883,4369,5671,5672,8161,9092,15672,25672,61613,61616 `. Note every port reported as open rather than filtered.
2. For any open 5672, run `nmap –script amqp-info -p 5672` and record the reported version and auth mechanisms.
3. Test the management API with `curl -u guest:guest http://:15672/api/overview`. A JSON response means the deployment is compromised in practice, whether or not anyone has used it yet.
4. On the host, run `rabbitmqctl list_users` and `rabbitmqctl list_permissions` to find leftover accounts with `.*` permissions on the default vhost.
5. Compare the results with the published ports in your Docker Compose files and cloud security groups.

If you’re on Docker, see common Docker port exposure mistakes – the iptables bypass described above is the most frequent reason a broker ends up reachable without anyone meaning to expose it.

Hardening the Broker and Its Network Path

Begin with binding. Most brokers don’t need to listen on 0.0.0.0. In RabbitMQ, set `listeners.tcp.default = 127.0.0.1:5672` or a private interface address, and bind the management listener the same way with `management.tcp.ip`. In Docker, publish as `127.0.0.1:15672:15672` instead of the bare port.

Next, fix authentication. Delete the guest user outright, don’t just change its password. Create a separate user for each application, scoped to one vhost with the narrowest configure, write and read regex patterns that still work. For Kafka, replace PLAINTEXT listeners with SASL_SSL using SCRAM-SHA-512 and turn on ACLs. Mosquitto 2.0 and later already refuses anonymous clients by default, but upgrades from 1.x configs can carry over `allow_anonymous true`.

Treat the clustering ports as private. 4369 and 25672 should never be reachable from the internet, even in a single-node setup. Generate a strong, random Erlang cookie and check that `.erlang.cookie` is readable only by the rabbitmq user.

There are exceptions. IoT deployments sometimes have to expose MQTT publicly because field devices connect over cellular networks. In that case, expose only 8883 with mutual TLS and client certificates, and keep 1883 closed. For cross-provider setups, a WireGuard tunnel between hosts is usually simpler than securing a public AMQP listener.

Common Mistakes Practitioners Make

The first mistake is trusting the host firewall. UFW reports port 15672 as denied, the team believes it, and an external scan shows it open because Docker’s DOCKER-USER chain was never configured. Always check from outside – validating firewall rules with external scans explains why.

The second is fixing the main port and forgetting the rest. Teams lock down 5672, then enable the Web STOMP or Prometheus plugin months later and expose 15674 or 15692 with no review.

The third is treating brokers as stateless plumbing. Queues hold data at rest, sometimes for days when consumers fall behind. The default-config problems seen with Redis apply here just as much – an in-memory or queue store is still a data store.

FAQ

Is it safe to expose RabbitMQ port 5671 if TLS is enabled?
TLS encrypts traffic but doesn’t authenticate clients unless you require peer verification. Use `ssl_options.fail_if_no_peer_cert = true` with client certificates, or at least strong per-application credentials, and restrict source IPs wherever possible.

Does deleting the guest user break anything?
Only applications that still use guest. Create dedicated users first, update connection strings, then delete guest. The management UI keeps working with any user that has the administrator tag.

How often should broker ports be rescanned?
Scan continuously or at least daily. New plugins, container redeployments and changes to cloud security groups can open ports without any change to the broker’s own configuration.

Practical Takeaway

An exposed message broker gives attackers both the data in your queues and the ability to inject messages your application will process. Bind brokers to private interfaces, delete default accounts, keep 4369 and 25672 strictly internal, and check every change with a scan from outside your network. If a port doesn’t need to be public, close it before an internet-wide scanner finds it.