A CSP-bypass XSS in user's profile page
A stored cross-site scripting (XSS) vulnerability existed in GitLab's user profile page when rendering AsciiDoc content. An attacker could create a public project with a malicious README.adoc that, when viewed on the victim's profile, would execute arbitrary JavaScript in the victim's browser, bypassing Content Security Policy (CSP).
GitLab
Originally disclosed on GitLab
- Fixed in 57 days
- Disclosed after 57 days
⚠️ Please read the process on how to fix security issues before starting to work on the issue. Vulnerabilities must be fixed in a security mirror.
HackerOne report #2961854 by yvvdwf on 2025-01-28, assigned to @fvpotvin:
Report | Attachments | How To Reproduce
Report
Hi team,
I recently reported a XSS concerning asciidoctor render. Gitlab released a patch which effectually fixed the XSS presented in that report by eliminating data-lines-path DOM elements' attribute that was used to trigger XSS in snippet pages. However the accidoctor render in the profile page of users is still vulnerable when exploiting data-calendar-activities-path, thus it leads to a XSS.
Reproduce
The following steps are to reproduce in gitlab.com. They are used to create a XSS in the profile page of an user whose username is USER-A. Please replace this username by your username when reproducing.
Step 0.
- create a public snippet within this content:
<script>alert(document.domain)</script> - note its raw URL, for example:
[redacted]
Example:
![redacted]
Step 1.
-
Objective is to create a public project containing a README.adoc to show in user profile page (see detail here).
-
if you already have a project at
https://gitlab.com/USER-A/USER-A, then delete it or rename it to another name. -
create a new blank project:
- Project name:
USER-A - Project URL:
https://gitlab.com/USER-A - Project slug:
USER-A - Visibility Level:
Public - Project Configuration:
- Initialize repository with a README: Uncheck
- Project name:
-
On the righ sidebar, click
New file, you will be redirected to Gitlab IDE- Add new file
README.adocwith the content in the attached file - Replace value of
data-calendar-activities-pathby the raw URL of the snippet created in Step 0 - Commit the new file
- Add new file
Example:
![README.adoc.png]
Step 2.
- Open the profile page of user
USER-A, athttps://gitlab.com/USER-A, (the page tooks at least 10 seconds to load) - Then click on the contributions calendar (see red zone in Figure below), you will see an alert
Example:
![click.png]
Impact
Stored-XSS with CSP-bypass allows attackers to execute arbitrary actions on behalf of victims at the client side.
Attachments
Warning: Attachments received through HackerOne, please exercise caution!
How To Reproduce
Please add reproducibility information to this section:
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
Impact
Stored XSS with CSP bypass allows attackers to execute arbitrary actions on behalf of victims at the client side.
What the attacker needed
Attacker can create a public snippet; attacker can create a public project; victim visits attacker's profile page; victim clicks on contributions calendar
How it was found
- Create a public snippet containing a script payload and note its raw URL.
- Create a public project named USER-A with a README.adoc file.
- In the README.adoc, set the `data-calendar-activities-path` attribute to the raw URL of the snippet.
- Commit the file.
- Visit the target user's profile page and click on the contributions calendar to trigger the alert.
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.
This report describes a stored XSS (cross-site scripting) bug in GitLab. XSS lets an attacker run their own JavaScript code in another user's browser when that user views a page. Here, a malicious file in a public project could run code when someone looked at the attacker's profile page, and it bypassed a security feature called CSP that is meant to block such scripts.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.