Critical RabbitMQ OAuth2 Flaw Unlocks Admin Access

RabbitMQ OAuth2 flaw - Critical RabbitMQ OAuth2 Flaw Unlocks Admin Access

Critical RabbitMQ OAuth2 Flaw Unlocks Privileged Access

A significant security vulnerability has been identified in the widely-used RabbitMQ message broker, potentially allowing unauthorized users to gain administrative access. This critical RabbitMQ OAuth2 flaw, tracked as GHSA-cfvg-5q96-8mhm, impacts deployments utilizing the management plugin with OAuth2 authentication. The issue could enable attackers to mint privileged access tokens without any form of credential verification, posing a severe risk to system integrity.

The vulnerability was disclosed by the RabbitMQ maintainers on November 16, with patched versions 4.4.1 and 4.3.8 released concurrently. While no active exploitation has been reported, the flaw’s severity is underscored by its Critical rating on the CVSS scale, scoring a 9.1. This discovery highlights the ongoing challenges in securing complex distributed systems and the importance of prompt patching, similar to the recent concerns around vulnerabilities like the one affecting Microsoft Entra Connect Health.

Exploiting the RabbitMQ OAuth2 Flaw: Architecture and Vulnerabilities

The core of this critical RabbitMQ OAuth2 flaw lies within the management plugin’s OAuth2 integration. Specifically, deployments configured with both the management and OAuth2 plugins enabled, and crucially, a client secret set for the identity provider, are susceptible. The vulnerability exploits a proxy mechanism within the management plugin that forwards token requests to the identity provider during the login process.

In affected versions, this proxy incorrectly handles unauthenticated callers. It proceeds to add the broker’s pre-configured client secret to requests that do not originate from a legitimate client. Furthermore, it passes the requested scope through without modification. This allows an anonymous attacker to leverage the broker itself as an OAuth2 client.

The attacker can then request a signed token with any scope the identity provider permits. If the identity provider grants the broker’s client administrator scopes, the attacker effectively gains full administrative control. This could lead to the creation of persistent administrator accounts and unauthorized access to message queues and data across all virtual hosts, extending beyond just the management interface.

Engineering Trade-offs and Mitigation Limitations

The fix for this critical RabbitMQ OAuth2 flaw involves restricting the proxy’s functionality. The patched code now ensures the proxy only relays requests related to the `authorization_code` and `refresh_token` grant types, which are the standard flows for management logins. This change effectively prevents the abuse of the proxy by unauthenticated entities.

However, the patch does not address the consequences of past exploitation. Any administrator accounts created through the vulnerability before patching remain in place. The security advisory does not provide a clear method for operators to audit their systems for previously minted tokens or compromised accounts, necessitating a proactive approach to security verification.

For organizations unable to upgrade immediately, two interim mitigation strategies are suggested. The first is to remove the `management.oauth_client_secret` setting. However, this may disrupt legitimate login or token refresh flows if the identity provider requires this secret. The second option is to implement an authentication layer in front of the RabbitMQ management port, adding an extra barrier to access.

Field Readiness and Verdict on RabbitMQ Security

The RabbitMQ team has acted swiftly to address this critical RabbitMQ OAuth2 flaw, releasing patched versions promptly. The availability of fixes in 4.4.1 and 4.3.8 provides a clear upgrade path for most users. However, support for the older 4.2 branch has transitioned to Broadcom for commercial customers, leaving community users without a direct patch for that line.

This vulnerability is part of a larger set of seven advisories published simultaneously, indicating a broader security review within the RabbitMQ project. The other advisories range in severity from high (cross-site request forgery in the management API) to medium and low. Upgrading to the latest release addresses all these issues comprehensively.

The introduction of the vulnerable proxy in version 4.3.3, intended to resolve OAuth2 login issues in Safari, inadvertently created this significant security gap. Previous OAuth2 flaws in RabbitMQ, disclosed in July, also allowed for similar credential exposure and token minting. The current critical RabbitMQ OAuth2 flaw underscores the need for continuous security auditing and robust testing of authentication mechanisms in critical infrastructure software.

Source: The Hacker News