A message broker or event streaming platform becomes the trust hub between every application that publishes or consumes through it, and a rollout that starts with anonymous plaintext listeners and shared credentials is very hard to secure once hundreds of clients depend on it. Brokers carry orders, payments, telemetry, device commands and change data from databases, and downstream systems act on what they receive without asking where it came from. Security retrofitted later means re-keying every producer and consumer, often during business hours. This vendor-neutral playbook is for platform, integration and security engineers introducing a broker or streaming platform, or consolidating several. It covers design decisions, listener and transport hardening, the identity and authorisation model, data protection, a pilot with audit-mode authorisation, onboarding waves with rollback, and metrics. Product-specific hardening for one widely used streaming platform is in the Kafka Security Guide; this page stays at the product-class level.
Key takeaways
- Never start with an open listener. Authenticated, encrypted listeners from day one are cheap; migrating hundreds of clients off an anonymous plaintext port later is the most expensive security change a broker team makes.
- One identity per application, not per team or per cluster. Per-application credentials make authorisation, revocation and incident scoping possible; a shared credential makes all three impossible.
- Authorise topics, queues and consumer groups by naming convention. Prefix-based rules tied to an ownership model keep access lists manageable and deny by default.
- Treat connectors and admin interfaces as the high-value targets. Connectors hold database and SaaS credentials, and management consoles can read or rewrite every stream.
- Roll out authorisation in audit mode first. Log would-be denials, fix the access model, then enforce in waves with a tested way back.
Why a broker rollout is a security project
A broker concentrates three things attackers want: data in transit between systems, the ability to inject messages that other systems trust, and the credentials of every connected client and connector. The threats to design against are well understood.
| Threat | How it happens | Design control | Reference |
|---|---|---|---|
| Message injection or tampering | Any client can write to any topic, or messages are altered in transit | Per-application identity, write rules per topic, TLS, schema validation | ATT&CK T1565.002 Transmitted Data Manipulation |
| Eavesdropping | Plaintext listeners on shared networks | TLS on every listener, including broker to broker | ATT&CK T1040 Network Sniffing, T1557 Adversary-in-the-Middle |
| Credential theft | Passwords and keys in client configuration files and repositories | Short-lived tokens or certificates, secrets manager, scanning | ATT&CK T1552.001 Credentials In Files |
| Exploitation of the broker | Broker or admin ports reachable from untrusted networks | Private networking, patching, minimal exposed protocols | ATT&CK T1190 Exploit Public-Facing Application |
| Resource exhaustion | A misbehaving or hostile client floods partitions or connections | Quotas per client, connection limits, rate limits | NIST SP 800-53 SC-5 |
The CISA Known Exploited Vulnerabilities catalog includes several broker flaws exploited in the wild, among them a deserialisation flaw that allowed remote code execution through a broker's network protocol port (CVE-2023-46604). Exposure of broker ports is a deployment decision, made in the first phase.
Phase 0: design decisions
- Managed service or self-hosted: a managed service usually integrates with the cloud provider's identity and key management, which removes much of the credential work below; self-hosting gives more control but puts patching, certificate authority and storage encryption on your team.
- Tenancy: separate clusters for security zones (production, non-production, regulated data, OT or IoT telemetry) and logical isolation (namespaces, virtual hosts, topic prefixes) within a zone. A single shared cluster across zones means one administrator credential reaches everything.
- Protocols: enable only the protocols you need. Each protocol a broker speaks is another parser and another port. The IANA-registered ports for MQTT are 1883 without TLS and 8883 with TLS; AMQP 1.0 Part 5 names port 5671 (amqps) for a pure TLS server.
- Ownership model: define who owns each topic or queue, how names are structured (for example
domain.application.event), and who approves a new consumer of sensitive data.
Choose authentication per listener, not per cluster. The options below are found across broker products.
| Mechanism | What it is | Strengths | Watch out for |
|---|---|---|---|
| Mutual TLS | Client presents an X.509 certificate | Strong, no shared secret on the wire, works for devices | Needs certificate issuance, rotation and revocation at scale; map certificate subject to identity carefully |
| SASL SCRAM | Salted challenge-response, RFC 5802 | Server stores salted derived keys, not passwords; mutual authentication | Still a long-lived secret; RFC 5802 notes it gives no security layer, so run it inside TLS |
| SASL OAUTHBEARER | OAuth 2.0 bearer tokens over SASL, RFC 7628 | Short-lived tokens from your identity provider or workload identity | RFC 7628 requires TLS for OAUTHBEARER; validate issuer, audience and expiry; plan token refresh on long-lived connections |
| SASL PLAIN or username and password | Password sent to the broker | Simple, widely supported | Only inside TLS, only with a strong backing store, and never as a shared team password |
| Anonymous | No client authentication | None for production | AMQP 1.0 has servers advertise ANONYMOUS when no authentication is required, so check what your broker advertises |
Phase 1: build and harden the platform
| Area | Baseline before first production client |
|---|---|
| Listeners | TLS-only client listeners; separate listeners for internal replication and for administration; no plaintext listener in production, not even "temporarily" |
| Broker to broker and to coordination services | Authenticated and encrypted, with their own credentials distinct from client credentials |
| Certificates | Issued from an internal CA with short validity and automated renewal; hostname verification enabled on clients |
| Management interfaces | Consoles, REST admin APIs and metrics ports on a management network, behind single sign-on with MFA; default accounts removed |
| Storage | Encryption at rest for log segments, queues and backups (SC-28); retention set per topic by data classification |
| Quotas | Per-client produce, consume and connection limits so one client cannot starve others |
| Network | Brokers reachable only from application subnets and approved private endpoints; never from the internet unless it is a purpose-built IoT edge |
The MQTT 5.0 specification is a useful checklist even beyond MQTT: it says TLS implementations should check that certificates are associated with the peer's hostname, may check revocation lists and OCSP, and should revoke lost certificates and reissue passwords. It also allows servers to require periodic re-authentication on long-lived connections, a property worth looking for in any broker.
Phase 2: identity and authorisation model
This is where most broker programmes succeed or fail, and it is a non-human identity problem. Every producer, consumer, stream processor and connector is a workload that needs its own credential.
- One principal per application and environment: name them so ownership is obvious, and record each in the NHI inventory with an owner. See the Kafka Credentials Security Guide for a worked example of credential types.
- Prefer federated or short-lived credentials: where the platform supports OAUTHBEARER or workload identity, issue tokens from the identity provider rather than storing passwords. See the Cloud Workload Identity Guide.
- Deny by default, allow by prefix: grant write on
payments.ledger.*to the ledger service only and read to named consumers. Separate rights to create or delete topics, alter configuration and manage consumer groups from data access. - Consumer groups are access too: a client joining another application's consumer group can steal its messages and shift its offsets. Restrict group membership by principal.
- Connectors and stream processors: they hold database, object storage and SaaS credentials. Run each connector with its own broker identity, keep its external credentials in a secrets manager, and treat the connector cluster's REST interface as an administration interface.
- Administration roles: very few humans should hold cluster-wide administration. Use just-in-time elevation for production changes and the Privileged access management (PAM) vault rollout playbook for break-glass credentials.
Phase 3: protecting the data in the stream
- Classify topics: label each topic or queue by the most sensitive data it may carry, and apply retention, encryption and consumer approval accordingly. Personal data in a stream is still personal data, and long retention multiplies exposure.
- Validate schemas: enforce message schemas at the producer or broker where supported so malformed or unexpected fields are rejected (SI-10 Information Input Validation). Protect the schema registry as an administration interface: whoever can change a schema can break or subvert consumers.
- End-to-end protection for high-value flows: TLS protects the hop, not the message at rest in the broker. For payment instructions or device commands, consider signing or encrypting payloads at the producer so consumers can verify origin.
- Dead letter queues and replays: messages that fail processing often land in dead letter queues with broader read access. Apply the same classification and access rules there, and control who can replay historical data.
Phase 4: pilot, onboarding waves and rollback
- Pilot with two or three applications that the platform team can change quickly, on a production-like cluster with TLS and authentication enforced from the start.
- Run authorisation in audit mode where the broker supports it, or with an allow-all rule that logs each decision. Collect every would-be denial for at least one business cycle (month end catches batch jobs).
- Turn the log into rules: each observed access becomes a prefix rule with an owner, or is rejected as unexpected. Unexpected readers of sensitive topics are findings, not rules to add.
- Enforce on the pilot, then onboard applications in waves by domain, each with credentials issued per application and rules reviewed by the topic owner.
- Migrating existing clients: where an older broker or plaintext listener already exists, run old and new listeners side by side, move clients one at a time, alert on any connection still using the old listener, and set a closing date.
- Rollback: for authorisation, rollback is reverting the rule set from version control, not disabling the authoriser. For credential changes, keep the previous credential valid for a short overlap and revoke it once the new one is confirmed in use.
Small versus large organisations
| Aspect | Small team, few applications | Large estate, many domains |
|---|---|---|
| Platform | A managed service with provider identity integration removes most credential handling | Platform team runs clusters per zone with self-service onboarding |
| Authentication | Provider identity or mutual TLS per application | OAUTHBEARER or workload identity, with certificates for devices |
| Authorisation | Rules in version control, reviewed by the platform owner | Rules generated from a topic catalogue with named owners and approval workflow |
| Main risk | One shared credential for every service | Thousands of rules nobody reviews, and orphaned principals |
Detection and measurement
Ship broker authentication and authorisation logs, administration API calls and connector configuration changes to the SIEM. The MQTT 5.0 specification lists abnormal client behaviours worth monitoring on any broker: repeated connection or authentication attempts, abnormal connection termination, topic scanning, attempts to send undeliverable messages and clients that connect but send no data. Add alerts for new principals, rule changes granting read on sensitive prefixes, consumers joining another application's group, offset resets, topic deletion, and connections to legacy listeners after their closing date.
- Encrypted and authenticated connections: percentage of client connections over TLS with an authenticated principal (target 100 percent in production).
- Credential granularity: applications sharing a principal with another application (target zero).
- Credential lifetime: median age of client secrets, and share of clients on short-lived tokens or certificates.
- Authorisation coverage: topics with a named owner and explicit rules, and number of wildcard grants on sensitive prefixes.
- Denials and anomalies: authorisation denials per week by principal, investigated rather than auto-allowed.
- Orphaned principals: principals with no connection in 90 days (an NHI Mgmt Group recommended threshold), reviewed for removal.
Framework mapping
| Rollout activity | NIST SP 800-53 Rev. 5 | NIST CSF 2.0 | Other references |
|---|---|---|---|
| Per-application identities and credentials | IA-9 Service Identification and Authentication, IA-5, AC-2 | PR.AA-01 | RFC 5802, RFC 7628 |
| Topic and group authorisation | AC-3, AC-4, AC-6 | PR.AA-05 | Deny by default, prefix rules |
| TLS on all listeners | SC-8, SC-8(1) | PR.DS-02 | MQTT 5.0 section 5; AMQP 1.0 Part 5 |
| Storage encryption and retention | SC-28 | PR.DS-01 | Data retention policy |
| Schema validation | SI-10 | PR.DS-02 | ATT&CK T1565.002 |
| Network exposure and quotas | SC-7, SC-5 | PR.IR-04 | ATT&CK T1190 |
| Logging and monitoring | AU-2, AU-6, SI-4 | PR.PS-04, DE.CM-09 | MQTT 5.0 abnormal behaviour list |
Common failure patterns
- The temporary plaintext listener: opened for a quick test, never closed, and found later by every new client because it is the easiest to connect to.
- One credential for the whole platform: every service uses the same username, so a leak from any repository or container image means full read and write access, and revocation breaks everything.
- Wildcard read for convenience: analytics or monitoring principals granted read on every topic, quietly becoming the largest data access path in the company.
- Connector credentials in plaintext configuration: database and SaaS passwords stored in connector configuration that the admin API returns to anyone who can call it.
- Admin console on the application network: management interfaces with default or shared accounts reachable from every workload.
- Unpatched broker exposed: protocol ports reachable from untrusted networks while known exploited vulnerabilities remain unpatched.
Practitioner checklist
- Decide managed versus self-hosted, tenancy by security zone, and the protocols you will enable.
- Publish a topic naming convention and ownership model before the first application onboards.
- Enforce TLS and authentication on every listener, including broker to broker, from day one.
- Issue one principal per application and environment, preferring short-lived tokens or certificates.
- Write deny-by-default prefix rules in version control, including consumer group and admin rights.
- Give each connector its own identity and keep its external credentials in a secrets manager.
- Place admin consoles, APIs and schema registries on a management network behind SSO and MFA.
- Classify topics, set retention and encryption, and apply the same rules to dead letter queues.
- Pilot with authorisation in audit mode, then enforce in waves with versioned rollback.
- Monitor authentication failures, topic scanning, rule changes, offset resets and legacy listener use.
Standards and references
- OASIS: MQTT Version 5.0 Standard
- OASIS: AMQP Version 1.0, Part 5: Security
- IETF: RFC 5802, Salted Challenge Response Authentication Mechanism (SCRAM)
- IETF: RFC 7628, A Set of SASL Mechanisms for OAuth
- NIST: SP 800-53 Rev. 5, Security and Privacy Controls
- NIST: SP 800-204, Security Strategies for Microservices-based Application Systems
- MITRE ATT&CK: T1565.002 Transmitted Data Manipulation
- CISA: Known Exploited Vulnerabilities Catalog
Related NHI Mgmt Group resources: Securing the message broker and event streaming platform itself · If your message broker and event streaming platform is compromised · Message broker and event streaming platform health check · Kafka Credentials Security Guide · Data Retention and Secure Deletion Guide