Описание
RabbitMQ Java client: TrustEverythingTrustManager used by default in useSslProtocol() enables MITM
Vulnerability Summary
com.rabbitmq.client.TrustEverythingTrustManager accepts ANY TLS certificate (including null chains) and is used as the default trust manager when calling ConnectionFactory.useSslProtocol() without arguments. Combined with hostname verification being disabled by default, this enables trivial man-in-the-middle attacks.
Affected Components
com.rabbitmq.client.TrustEverythingTrustManager— accepts any certificatecom.rabbitmq.client.ConnectionFactory.useSslProtocol()— uses TrustEverythingTrustManager- Hostname verification disabled by default (
enableHostnameVerification()must be called explicitly) com.rabbitmq.client.ConnectionFactory.getPassword()— returns plaintext with no redaction- Default port 5672 (plaintext) with PLAIN SASL — credentials sent unencrypted
POC (Verified on Java 21, amqp-client 5.25.0)
Attack Scenarios
- MITM: Attacker presents self-signed cert →
TrustEverythingTrustManageraccepts it → all RabbitMQ traffic intercepted - Credential theft: Default plaintext port (5672) + PLAIN SASL = credentials readable on network
- DNS rebinding: No hostname verification → attacker DNS record → MITM without cert
- Logging exposure:
getPassword()returns plaintext → credentials in logs/stack traces
Suggested Fix
- Deprecate
TrustEverythingTrustManager— it should never be used in production useSslProtocol()should use the JVM default trust store, not TrustEverything- Enable hostname verification by default
- Redact password in
getPassword()or remove the public getter - Warn when using PLAIN SASL without TLS
Ссылки
- https://github.com/rabbitmq/rabbitmq-java-client/security/advisories/GHSA-5m9f-rphj-c435
- https://github.com/rabbitmq/rabbitmq-java-client/pull/1999
- https://github.com/rabbitmq/rabbitmq-java-client/pull/2001
- https://github.com/rabbitmq/rabbitmq-java-client/commit/1e7deb2e6020c9793a81385a53ea378ec63b9339
- https://github.com/rabbitmq/rabbitmq-java-client/commit/a4bf571dd368765baaa9cecfae68ce09f1bdcc01
- https://github.com/rabbitmq/rabbitmq-java-client/releases/tag/v5.33.0
Пакеты
com.rabbitmq:amqp-client
< 5.33.0
5.33.0
Связанные уязвимости
The RabbitMQ Java client library allows Java and JVM-based applications to connect to and interact with RabbitMQ nodes. Prior to 5.33.0, com.rabbitmq.client.ConnectionFactory.useSslProtocol() and ConnectionFactory.useSslProtocol(String) configure com.rabbitmq.client.TrustEverythingTrustManager and leave hostname verification disabled, causing arbitrary server certificates, including self-signed certificates, to be accepted. A network attacker able to intercept a TLS connection can impersonate the RabbitMQ broker, read protected AMQP traffic, and modify traffic without certificate or hostname validation. The fix changes the production TLS helpers to use the JVM default trust store and enables hostname verification, while retaining an explicitly named development-only no-verification helper. This issue is fixed in version 5.33.0.
The RabbitMQ Java client library allows Java and JVM-based applications to connect to and interact with RabbitMQ nodes. Prior to 5.33.0, com.rabbitmq.client.ConnectionFactory.useSslProtocol() and ConnectionFactory.useSslProtocol(String) configure com.rabbitmq.client.TrustEverythingTrustManager and leave hostname verification disabled, causing arbitrary server certificates, including self-signed certificates, to be accepted. A network attacker able to intercept a TLS connection can impersonate the RabbitMQ broker, read protected AMQP traffic, and modify traffic without certificate or hostname validation. The fix changes the production TLS helpers to use the JVM default trust store and enables hostname verification, while retaining an explicitly named development-only no-verification helper. This issue is fixed in version 5.33.0.
The RabbitMQ Java client library allows Java and JVM-based application ...