Skip to content
XSS Disclosed report Beginner

Reflected XSS in Report Abuse Functionality

The Report Abuse page reflected the ref_url parameter without filtering, allowing a javascript: URL to execute script when the victim clicked Cancel. An attacker could run arbitrary JavaScript in the victim's session, potentially taking over the account.

GitLab

Originally disclosed on GitLab

  • Fixed in 54 days
  • Disclosed after 54 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 #1941091 by akadrian on 2023-04-10, assigned to @ameyadarshan:

Report | Attachments | How To Reproduce

Report

Summary

The Report Abuse functionality which can be triggered for example from snippet comments is vulnerable to reflected xss.
Vulnereble url:
https://gitlab.com/-/abuse_reports/new?ref_url=javascript:alert(44);/%2Froot%2Fvictim-project1%2F-%2Fsnippets%2F3%23note_125&user_id=12743360
Vulnerable parameter: ref_url

Steps to reproduce
  1. Create two gitlab accounts called: Victim and Attacker
  2. Note id of each previously created user id
  3. Take following url and change user_id to Victim or Attacker id, in my case user_id=2 is an id of victim user:

https://YOUR-HOST/-/abuse_reports/new?ref_url=javascript:alert(44);/%2Froot%2Fvictim-project1%2F-%2Fsnippets%2F3%23note_125&user_id=2
4. Open the url in victim session
5. Click on "Cancel" button and javascript should launch. On self-hosted gitlab there is no CSP- protection so it will be run without the need of bypassinng CSP. On SaaS gitlab version CSP will block this but you should see alert in console.

Impact

It's a reflected XSS issue which can lead to account takeover, making actions on user behalf.

What is the current bug behavior?

ref_url parameter value is reflected with no filtering applied which leads to XSS vulnerability

What is the expected correct behavior?

ref_url parameter value should be validated on server side allowing only http or https schemes. Also html encoding should be
applied to avoid script injection.

Impact

Attacker could exploit this vulnerability to make actions on user behalf or even steal access to victim accounts.

Attachments

Warning: Attachments received through HackerOne, please exercise caution!

How To Reproduce

Please add reproducibility information to this section:

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 ref_url parameter was inserted into the page without validation or HTML encoding, allowing a javascript: scheme to be used.

Impact

On self-hosted GitLab without CSP, the script runs and could lead to account takeover; on SaaS GitLab, CSP blocks execution but the alert still appears in the console.

What the attacker needed

Victim clicks a crafted link; victim clicks the Cancel button; self-hosted GitLab without CSP for full execution

The fix

The ref_url parameter should be validated server-side to allow only http or https schemes, and HTML encoding should be applied.

How it was found

  1. Create two GitLab accounts, one as victim and one as attacker.
  2. Note the user ID of each account.
  3. Build a URL to the abuse report page with the victim's user_id and a ref_url containing a javascript: payload.
  4. Open the URL while logged in as the victim.
  5. Click the Cancel button, which triggers the JavaScript.

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 reflected cross-site scripting (XSS) bug happens when a website takes a value from the URL and puts it directly into the page without cleaning it. Here, the ref_url value could be a javascript: link, so when the victim clicked Cancel, the browser ran the attacker's script as if it came from GitLab. That script could then do anything the victim could do, like change settings or steal data.

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.