The Invisible Attack Surface
Message queues sit at the center of modern distributed systems. Apache Kafka, RabbitMQ, Amazon SQS, Redis Streams, and NATS move data between services, decouple producers from consumers, and enable event-driven architectures that scale.
Because message queues are internal infrastructure — not directly exposed to the internet — they often receive less security attention than APIs or web applications. This is a mistake. A compromised message broker can:
- Intercept sensitive data flowing between services
- Modify messages to alter business logic execution
- Inject malicious messages that trigger unintended actions in consuming services
- Exhaust resources through message flooding
- Persist access by subscribing to topics that provide ongoing visibility into system operations
Message queues are high-value targets precisely because they see everything.
Apache Kafka Security
Kafka's security model has matured significantly but is not enabled by default. A fresh Kafka installation with default configuration has no authentication, no encryption, and no access control.
Authentication
Kafka supports multiple authentication mechanisms:
- SASL/SCRAM for username/password authentication with salted challenge-response
- SASL/GSSAPI (Kerberos) for enterprise environments with existing Kerberos infrastructure
- Mutual TLS for certificate-based client authentication
- SASL/OAUTHBEARER for OAuth2-based authentication
Choose based on your environment. mTLS is the strongest option for service-to-service authentication. SASL/SCRAM is simpler to deploy for environments without PKI infrastructure.
Encryption
Enable TLS for all Kafka communication:
- Inter-broker communication should use TLS to prevent eavesdropping on replicated data
- Client-to-broker communication should use TLS to protect data in transit
- ZooKeeper communication (if using ZooKeeper) should also be encrypted
Kafka supports end-to-end encryption at the application level for scenarios where even broker administrators should not see message contents. Implement this for highly sensitive data.
Authorization
Kafka ACLs (Access Control Lists) control which principals can perform which operations on which resources:
- Restrict topic creation to administrative accounts
- Grant producers write access only to their specific topics
- Grant consumers read access only to their required topics
- Restrict consumer group management to prevent group hijacking
- Use prefix-based ACLs for managing permissions at scale
Key Configuration Settings
Critical security settings that are often misconfigured:
auto.create.topics.enable=false— Prevent topics from being created automatically by producersdelete.topic.enable— Control carefully; topic deletion can destroy audit trailslog.retention.hours— Set retention appropriate to both business needs and security (too short loses forensic data, too long increases exposure)
RabbitMQ Security
RabbitMQ's security model centers on virtual hosts, user permissions, and TLS.
Authentication
RabbitMQ supports multiple authentication backends:
- Internal database (default) — username/password stored in RabbitMQ
- LDAP integration for enterprise directory authentication
- OAuth2 through plugin support
- x509 certificate authentication
The default guest account (password: guest) is restricted to localhost connections by default but should be disabled or reconfigured immediately in any non-development environment.
Authorization
RabbitMQ permissions are defined per virtual host with three permission types:
- Configure — permission to create/delete exchanges and queues
- Write — permission to publish messages
- Read — permission to consume messages
Use virtual hosts to isolate workloads. Different applications should use different virtual hosts with separate credentials and permissions.
TLS Configuration
Enable TLS for all RabbitMQ communication:
- Client connections (AMQP over TLS)
- Management UI (HTTPS)
- Inter-node communication in clusters
- Plugin communication (Shovel, Federation)
Configure minimum TLS version (1.2 or higher) and allowed cipher suites to prevent downgrade attacks.
Common Vulnerabilities Across Platforms
Deserialization Attacks
Messages are serialized data. If consuming services deserialize messages using unsafe methods (Java native serialization, Python pickle), a malicious message can trigger arbitrary code execution in the consumer.
Use safe serialization formats (JSON, Protocol Buffers, Avro) with schema validation. Never use language-native serialization for messages from untrusted or semi-trusted sources.
Message Injection
If a producer is compromised, it can inject malicious messages into topics or queues. Consumers must validate messages rather than trusting them implicitly:
- Validate message schemas
- Check expected field values and ranges
- Verify message signatures for high-security scenarios
- Rate-limit message processing to handle flooding
Credential Exposure
Message broker credentials in application configuration files, environment variables, or container images are a common exposure vector. Use secret management services rather than static configuration for broker credentials.
Supply Chain Considerations
Client Library Dependencies
Kafka and RabbitMQ client libraries are dependencies in your application:
kafka-node,kafkajsfor JavaScriptconfluent-kafka-python,aiokafkafor Pythonamqplib,amqp-connection-managerfor RabbitMQ in Node.js
These libraries have their own vulnerability histories. Track them in your SBOMs and monitor for CVEs.
Broker Software Updates
Kafka and RabbitMQ themselves are complex software systems with regular security patches. Maintain a patching schedule for broker infrastructure and track broker versions in your infrastructure SBOM.
How Safeguard.sh Helps
Message broker client libraries and the brokers themselves are software supply chain components that need tracking and monitoring. Safeguard includes these components in your SBOMs, monitors them for vulnerabilities, and alerts your team when patches are needed. For organizations running Kafka or RabbitMQ at scale, Safeguard ensures that the components carrying your most sensitive inter-service data are continuously monitored for security risks.