Описание
Stored XSS in RabbitMQ management UI
Summary
A stored Cross-Site Scripting (XSS) vulnerability in the RabbitMQ management UI allows any user with permissions to declare a queue or exchange to execute arbitrary JavaScript in the browser of any user viewing the Queues or Exchanges page.
Details
The vulnerability exists because the value of the x-internal-purpose queue/exchange argument is rendered directly into an HTML title attribute without proper escaping.
The attack flow is as follows:
-
Source (Payload acceptance): An attacker declares a queue or exchange with a malicious
x-internal-purposeargument. The RabbitMQ server code indeps/rabbit/src/rabbit_amqqueue.erldoes not validate this unknown argument, so it is accepted and stored as-is in the queue's metadata. -
API (Unsanitized transport): When the management UI requests the list of queues from
GET /api/queues, the server includes the full, unsanitized arguments map in the JSON response. -
Sink (Unescaped rendering): The UI's JavaScript in
deps/rabbitmq_management/priv/www/js/formatters.jsuses the_link_tofunction to create links for the queue list. This function concatenates thex-internal-purposevalue directly into the link'stitleattribute, without using an HTML-escaping function.// File: deps/rabbitmq_management/priv/www/js/formatters.js function _link_to(name, url, highlight, args) { if (highlight == undefined) highlight = true; var title = null; if (args != undefined && args['x-internal-purpose'] != undefined) { var purpose = args['x-internal-purpose']; // 'purpose' is not escaped before concatenation title = 'This is used internally by the ' + purpose + ' mechanism.'; } return '<a href="' + url + '"' + (title ? ' title="' + title + '"' : '') + '>' + '</a>'; }An attacker can provide a payload for
purposethat starts with a double quote (") to break out of thetitleattribute and close the<a>tag, then inject an<img>tag with anonerrorhandler that executes arbitrary JavaScript. -
Permissive CSP: The default Content-Security-Policy (CSP) found in
deps/rabbitmq_management/Makefileincludes'unsafe-inline', which permits the execution of injected inline event handlers, making the XSS payload execution possible.
Impact
The XSS payload is persisted on the server and will execute for any user who views the page until the malicious queue or exchange is deleted creating a stored XSS vulnerability.
Пакеты
rabbitmq
>= 4.2.0, < 4.2.5
4.2.5
Связанные уязвимости
RabbitMQ is a messaging and streaming broker. Prior to 4.2.5, the RabbitMQ management UI renders the x-internal-purpose queue or exchange argument into an HTML title attribute without proper escaping on the Queues and Exchanges pages, allowing a user with permission to declare a queue or exchange to execute JavaScript in another user's browser. This issue is fixed in version 4.2.5.
RabbitMQ is a messaging and streaming broker. Prior to 4.2.5, the RabbitMQ management UI renders the x-internal-purpose queue or exchange argument into an HTML title attribute without proper escaping on the Queues and Exchanges pages, allowing a user with permission to declare a queue or exchange to execute JavaScript in another user's browser. This issue is fixed in version 4.2.5.
RabbitMQ is a messaging and streaming broker. Prior to 4.2.5, the RabbitMQ management UI renders the x-internal-purpose queue or exchange argument into an HTML title attribute without proper escaping on the Queues and Exchanges pages, allowing a user with permission to declare a queue or exchange to execute JavaScript in another user's browser. This issue is fixed in version 4.2.5.
RabbitMQ is a messaging and streaming broker. Prior to 4.2.5, the Rabb ...