The vulnerability lies in the handling of Core protocol packets for federation. Specifically, the packet type FEDERATION_DOWNSTREAM_CONNECT was processed without any security checks. An unauthenticated attacker could send this packet to a vulnerable broker, which would then establish a federation connection to an attacker-controlled broker. This could be exploited for message injection or exfiltration.
The patch addresses this by introducing a dedicated channel handler, FederationChannelHandler, for federation-related packets. The handlePacket method within this new handler now performs authentication and authorization checks before processing FEDERATION_DOWNSTREAM_CONNECT packets. It verifies that the user is authenticated and has the required role to perform this action. The vulnerable code, which was previously in the LocalChannelHandler inner class within CoreProtocolManager, has been removed and replaced with this more secure implementation. The vulnerable function is therefore org.apache.activemq.artemis.core.protocol.core.impl.CoreProtocolManager$LocalChannelHandler.handlePacket as it was the one processing the malicious packet without validation.