Skip to content
XSS Disclosed report Beginner

Persistent XSS - Deleting a project (No Longer Vulnerable in 10.7)

A stored cross-site scripting flaw existed in GitLab's project deletion confirmation modal, where a malicious username was rendered as HTML rather than text. An attacker with a crafted username could execute JavaScript in the browser of a project Master who attempted to delete the project.

phillycheeze Follow

Originally disclosed on HackerOne

  • Triaged in 21 hours
  • Fixed in 4 months
  • Disclosed after 4 months

Summary: When deleting a project in gitlab, it is possible to trigger a XSS with a malicious user name string.

Description: I'd like to first point out that this is no longer vulnerable, but I filed a report anyways since it was never discovered. It looks like this was fixed on "accident". Originally, JS was rendering the username via a ".html()" jquery method, but was refactored to ".text()" and fixed the vulnerability.

I'm not sure how Gitlab would disclose this, but I have attached the exact commit that fixed the issue. This was done about a month ago, so I wanted to report this just in case Gitlab decides to update the release notes to point out that this was fixed. The original offending line was line 11 of the file in the commit below.

Commit: https://gitlab.com/gitlab-org/gitlab-ee/commit/2024aa5fa593e31b7c4aa30d107cc17d08b0a009

I ranked this a Medium since the number of users that are impacted are probably very low. For someone to become a victim, they must have Master access to a project that is under the malicious user's own account.

The steps to reproduce are fairly simple but there are some restrictions:

  • Only members of a project with Master access can become victims of the XSS.
  • The project must be under a personal "group", as in the project must be a personal project, not one under a custom group.

Steps To Reproduce:

  1. Set your own username as "<img src=x onerror=alert(document.domain)> foo / bar"
  2. Under your own profile, create a new project.
  3. -- the steps below can render the XSS on yourself. To test another user, grant a second user to have Master access on this new project and run the same steps below. --
  4. Under Project Settings, General, Advanced Options, Danger Zone... click the Remove Project button.
  5. Notice the XSS renders on the modal that pops up asking for confirmation.

Supporting Material/References:

More information can be provided upon request.

Impact

The security impact is the same as any typical persistent xss. I lowered from High -> Medium because of the potential number of users impacted (described above).

The hacker selected the Cross-site Scripting (XSS) - Stored weakness. This vulnerability type requires contextual information from the hacker. They provided the following answers:

URL https://gitlab.com/group/project/edit

Verified Yes

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

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

The username was inserted into the page using jQuery's .html() method, which interprets the string as HTML, instead of .text(), which treats it as plain text.

Impact

The impact is the same as typical persistent XSS, though the number of affected users is likely very low because a victim must have Master access to a project under the attacker's personal account.

What the attacker needed

Attacker controls a username; victim has Master access to attacker's project; project is a personal project, not in a custom group

The fix

The code was changed to render the username with jQuery's .text() method instead of .html(), and the report states this was fixed, apparently by accident, in a refactor.

How it was found

  1. Set your own username to a string containing an image tag with an error handler.
  2. Create a new project under your own profile.
  3. Grant a second user Master access on the project if testing against another account.
  4. Open Project Settings, General, Advanced Options, Danger Zone and click Remove Project.
  5. Observe the script executing in the confirmation modal.

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.

Cross-site scripting (XSS) is when a website displays user-supplied text as if it were part of the page's code, so a malicious string can run JavaScript in someone else's browser. Here, a username containing HTML was shown inside a confirmation pop-up without being escaped, so the script ran for anyone who opened that pop-up.

What is XSS?

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

More by phillycheeze

View all

2 more disclosed reports, best first.

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.