Send arbitrary PUT requests when user clicks on a link
Mermaid diagrams in GitLab issues let a user assign CSS class names to a block, and the issue page's click handler treats any element with the issuable-action classes as a real close/reopen button, sending a PUT request to the link's href. An attacker could craft a diagram so that a victim's click sends an authenticated PUT request to an endpoint of the attacker's choosing.
- Triaged in 24 hours
- Fixed in 2 months
- Paid in 24 hours
- Disclosed after 4 months
Dear teams,
Summary
Mermaid allows users to set class name of a block. This ability becomes vulnerable in Gitlab issues because of issue.js#L90:
return $(document).on(
'click',
'.js-issuable-actions a.btn-close, .js-issuable-actions a.btn-reopen',
e => {
...
const $button = $(e.currentTarget);
...
const url = $button.attr('href');
return axios
.put(url)
.then(({ data }) => {
...
Steps to reproduce
- Create any issue
- Enter the following payload as the description of the issue:
```mermaid
graph TD;
A[Click to send a PUT request];
class A js-issuable-actions;
class A btn-close;
click A "./put-destination" "click to PUT"
After saving the issue, if you click on the block Click to send a PUT request, a PUT request will be sent to ./put-destination
Impact
Since attacker can control ./put-destination, he can theoretically can perform any PUT requests on behalf of the current user.
For example, attacker can use the following url to update the description of issue #2:
/api/v4/projects/16210710/issues/2?description=a
Examples
An example is available here: https://gitlab.com/yvvdwf/xss/-/issues/1 (it is private, pls let me know if you cannot access it)
Output of checks
This bug happens on GitLab.com
Impact
When received click of user, attacker may perform arbitrary PUT requests of the behalf of the user
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the click handler selected elements by CSS class alone and trusted the href attribute as the request target, so user-controlled diagram markup could impersonate the action buttons.
Impact
An attacker could theoretically perform arbitrary PUT requests on behalf of the current user, for example updating the description of another issue, though the victim must click the crafted block.
What the attacker needed
Ability to create or edit an issue; victim clicks the crafted diagram block
How it was found
- Create any issue.
- Enter a Mermaid diagram as the issue description that gives a block the issuable-action and close-button class names and a click link to a chosen destination.
- Save the issue.
- Click the block in the rendered diagram, which sends a PUT request to the chosen destination.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
GitLab issues can contain Mermaid diagrams, which are drawings written in text. The issue page has a script that watches for clicks on the close and reopen buttons and then sends a request to whatever web address that button points to. Because a diagram author could give a shape the same styling names as those buttons, clicking the shape made the page send a request as the logged-in user.
What is CSRF?
Another site makes a signed-in user's browser perform an action they did not intend.