The vulnerability in the RabbitMQ TLS trust-store plugin comes down to a single, devastating mismatch: the code stores full DER certificate bytes but verifies identity using only the issuer's distinguished name and serial number — metadata that appears in every certificate, every log line, and every CLI output. The function is_whitelisted/1 does exactly what its name promises — it checks membership in a set — but the set's key is extracted from the presented certificate itself, not compared against a trusted reference. No signature verification occurs. No public key material is involved. The stored FullDER is never used for authentication; it sits in the ETS table as inert data, checked only for display purposes, never for verification.
This is a performance optimization that broke a security contract. ETS lookups on variable-length DER binaries are expensive. Someone changed the lookup path to use the O(1) {IssuerName, SerialNumber} tuple as a key, and it worked — the positive test cases passed because a certificate's own metadata matches itself. The adversarial case — a different certificate with matching metadata — was never written. The variable still named FullDER, the functions still called themselves extract_issuer_id and is_whitelisted, and nothing in the Erlang verify_fun interface signals that this constitutes an authentication gate. The API gives developers enormous rope without any enforced contract that says 'if you're overriding default validation, you must perform equivalent or stronger checks.'
What makes this particularly dangerous is that the preconditions for exploitation are essentially zero. Issuer DN and serial are non-secret by design. An attacker needs only to observe any logged certificate or read any CLI output, then forge a self-signed certificate with matching metadata. The verify_fun returns 'whitelisted,' the connection opens, and the attacker is authenticated to the broker with access to every queue bound to that user.
To verify whether your deployment is vulnerable: first, confirm the verify_fun is in use by checking for custom TLS configuration that includes a verify_fun callback. Second, examine the plugin's trust-store table (typically an ETS table named something like rabbit_trust_store) — if it stores only {IssuerName, SerialNumber} tuples alongside full DER bytes, the verification is metadata-only. Third, test by adding certificate A to the trust store, then presenting certificate B with the same issuer DN and serial number; if the connection succeeds, you're exploitable. The fix should involve either comparing the full certificate DER, using SubjectKeyIdentifier as the lookup key, or hashing the public key material — but be aware that simply switching the lookup key may leave the FullDER bytes still sitting in your trust store, creating an information leak about which certificates are whitelisted. Audit your deployed trust stores after patching to confirm dead crypto material has been removed.
This is not a novel failure. Certificate validation bypass via metadata comparison has appeared in Apache 1.x, OpenSSL wrappers, Hadoop mutual-TLS configs, and Kubernetes cluster auth. Each time, the fix gets applied and institutional memory resets. The RabbitMQ plugin wasn't written by someone who hadn't seen this class of bug — it was written by someone who never saw it, because the Erlang ecosystem lacks any mechanism to preserve historical failure modes in a form that reaches library authors. The type-system gap in Erlang is real, but even languages with stronger types haven't solved the organizational problem of keeping this knowledge alive across teams and years.