Skip to content
XSS Disclosed report Beginner

Stored XSS in branch names

A stored cross-site scripting vulnerability existed in GitLab branch names, which executed when a branch was selected as the source for a merge request. An attacker could create a branch with a malicious name and trick another user into viewing it, leading to script execution in the victim's browser.

GitLab

Originally disclosed on GitLab

  • Fixed in 3 months
  • Disclosed after 3 months

HackerOne report #758451 by ashish_r_padelkar on 2019-12-14, assigned to @vdesousa:

Summary

Hello,

I found a stored XSS in branch names which executes when you select this branch as source name while creating merge request.

Steps to reproduce

  1. Create a a file at http://<LocalInstance>/MyLocalGroup/mylocalproject/new/master and while committing put Target Branch as xss payload ">{{media:0}}

2.As another user, go to http://<LocalInstance>/MyLocalGroup/mylocalproject/-/branches
3. Click on Merge request button that appears besides above branch and XSS will popup in merge requests

What is the current bug behavior?

Stored XSS that may affect other users

What is the expected correct behavior?

Branch names should be properly sanitised

Output of checks

Tested on GitLab Enterprise Edition 12.5.4-ee local instance.

Gitlab.com isnt executing because of CSP

Regards,
Ashish

Impact

Impact is same as any typical stored XSS

The original report as published on GitLab. Images and videos are our own copies; raw HTML is shown as text. View it on GitLab.

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 application failed to properly sanitise or escape branch names before rendering them in the merge request interface.

Impact

The stored XSS could affect other users, potentially allowing an attacker to execute arbitrary JavaScript in their browsers, though on GitLab.com it was blocked by CSP.

What the attacker needed

Access to create a branch; victim views the malicious branch

How it was found

  1. Create a file in a project and set the target branch name to a malicious payload.
  2. As another user, navigate to the branches page of the project.
  3. Click the 'Merge request' button next to the malicious branch, and the XSS executes.

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.

XSS is a flaw where a site shows user input without cleaning it, so code can run in other users' browsers. Here a branch name could contain such code, and it would run when another user viewed that branch.

What is XSS?

Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.

More from GitLab

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Cross-site scripting (XSS)

The lesson behind this report.

Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.