Skip to content
XSS Disclosed report Beginner

Reflected XSS via back_url when editing releases

The back_url parameter on the release edit page was placed directly into the cancel link without validation, so a javascript URI could be supplied. If a victim opened an attacker-crafted link and clicked cancel, arbitrary JavaScript would run in their session.

GitLab

Originally disclosed on GitLab

  • Fixed in 1 hour
  • Disclosed after 1 hour

HackerOne report #877167 by foobar7 on 2020-05-18, assigned to @cmaxim:

Summary

The back_url value is inserted into the cancel link when editing releases and accepts arbitrary values.

By injecting a javascript URI, an attacker can execute arbitrary JavaScript if the victim visits an attacker-supplied link and clicks on the "cancel" button.

Steps to reproduce

Visit the following link, where 192.168.0.104 is the host, privategroup/privateproject is the group/project name, and test is the release name:

http://192.168.0.104/privategroup/privateproject/-/releases/test/edit?back_url=javascript:alert(1)  

Clicking on "cancel" will trigger the payload.

Impact

With a successful attack, an attacker can access all data the attacked user has access to, as well as perform arbitrary requests in the name of the attacked user.

If the attacked user is an administrator, an attacker could for example add a new admin user to gain full control of the gitlab instance.

What is the current bug behavior?

javascript URI is taken from GET parameters and inserted into a link, leading to reflected XSS.

What is the expected correct behavior?

It should be validated that the given back_url parameter:

  1. uses only allowed protocols (to prevent XSS)
  2. does not link off-site (to prevent open redirect / phishing attacks)

Results of GitLab environment info

Installed via https://about.gitlab.com/install/#ubuntu. /help shows version as:

GitLab Enterprise Edition 12.10.5-ee

Impact

see above

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

Impact

An attacker could access all data the victim can access and make requests as them; if the victim is an administrator, the attacker could add a new admin user and take full control of the instance.

What the attacker needed

Victim clicks an attacker-supplied link; victim clicks the cancel button

The fix

The back_url parameter should be validated so it only uses allowed protocols and does not point off-site.

How it was found

  1. Open the release edit page for a project, adding a back_url parameter whose value is a javascript URI.
  2. Click the cancel button on that page.
  3. The script in the back_url value runs in the browser.

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 link on a web page can point to a script instead of a normal address. Here the site copied a value from the web address into the cancel button's link without checking it, so a crafted link made that button run code. Anyone who clicked it would run the attacker's code with their own logged-in permissions.

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.