Skip to content
XSS Disclosed report Beginner

Persistent XSS on public wiki pages

A public wiki page rendered an HTML file containing a script tag, executing attacker-supplied JavaScript in the victim's browser. Because the site lacked a content security policy, the script could read the user's API token and use it to act as the victim.

jobert Follow

Originally disclosed on HackerOne

  • Triaged in under an hour
  • Fixed in 42 days
  • Disclosed after 3 months

Details

There's a persistent cross-site scripting (XSS) vulnerability in the wiki pages. This can lead to an account take over via the leaked API token.

Proof of concept

As an attacker, create a new public repository. Make sure you have a client that is allowed to push to that repository. For this PoC, lets say the repository is located at [email protected]/dummy/test.git. On the client, execute the following commands:

git clone [email protected]/dummy/test.git cd test echo "<script>alert('Hello world!');</script>" > index.html git add index.html git commit -m "This message is super important" git push

Now go to https://gitlab.com/dummy/test/wikis/index.html. As you will see, this executes the JavaScript that is stored in the file.

Screen_Shot_2016-05-04_at_19.52.50.png
Screen_Shot_2016-05-04_at_19.52.50.png From the original on HackerOne

Impact

GitLab doesn't have a content security policy, which means that clients allow inline Javascript to be executed. This gives access to the current user its API token. The API token can be used to access the user its projects, do actions as the user, give access to potential confidential information, etc.

The original report as published on HackerOne, by jobert. 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

Likely the wiki rendered uploaded HTML files without sanitising or serving them with a restrictive content type, and no content security policy blocked inline scripts.

Impact

An attacker could execute JavaScript in a victim's browser to steal their API token and then use it to access projects, perform actions as the user, and reach confidential information.

What the attacker needed

A GitLab account; ability to create a public repository; victim visits the crafted wiki page

How it was found

  1. Create a new public repository and ensure you can push to it.
  2. Clone the repository locally.
  3. Create an HTML file containing a script tag and commit it.
  4. Push the commit to the repository.
  5. Visit the wiki page for that HTML file to trigger the script.

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.

A wiki page displayed a file as a web page without removing dangerous code. When a victim visited that page, the code ran in their browser and could steal their login token, letting the attacker act as them.

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 jobert

View all

67 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.