Skip to content
XSS Disclosed report Beginner

[wakatime.com] HTML Injection github-btn.html

The github-btn.html page read the 'user' parameter from the URL fragment and inserted it into the page without sanitisation, allowing an attacker to inject arbitrary HTML. An attacker could craft a link that displays attacker-controlled HTML in the victim's browser.

bobrov Follow

Originally disclosed on HackerOne

  • Triaged in 19 hours
  • Fixed in 15 days
  • Disclosed after 15 months

Description

Vulnerable parameter: user Vulnerable script: https://wakatime.com/static/html/github-btn.html Vulnerable code:

JavaScript
  var params = function () {
    var vars = [], hash;
    var hashes = window.location.href.slice(window.location.href.indexOf("?") + 1).split("&");
    for(var i = 0; i < hashes.length; i++) {
      hash = hashes[i].split('=');
      vars.push(hash[0]);
      vars[hash[0]] = hash[1];
    }
    return vars;
  }()
  var user = params.user,
      repo = params.repo,
      type = params.type,
 ...
  } else if (type == "follow") {
    mainButton.className += " github-me";
    text.innerHTML = "Follow @" + user;

PoCs

PoC #1 HTML Injection for Chrome, Internet Explorer

https://wakatime.com/static/html/github-btn.html#&user=<h1><marquee>HTML<br>HTML<br>HTML<br>HTML<br>HTML<br>HTML<br>&type=follow

PoC #2 Using this script it is also possible to use DOM Based XSS in Internet Explorer, as I did in these reports #200753 #200826 But since the X-Frame-Options: SAMEORIGIN header is used for all HTTP responses, this could not be done in this case.

Another vulns

Also, this script has potential vulnerabilities using user controlled parameters in the path to the JS script. But for the exploitation it requires additional vulnerability on api.github.com (for example, Open Redirect or user controlled output).

JavaScript
  function jsonp(path) {
    var el = document.createElement('script');
    el.src = path + '?callback=callback';
    head.insertBefore(el, head.firstChild);
  }
...
  if (type == 'follow') {
    jsonp('https://api.github.com/users/' + user);
  } else {
    jsonp('https://api.github.com/repos/' + user + '/' + repo);
  }

PoC

https://wakatime.com/static/html/github-btn.html?#&user=../../another/endpoint&repo=../../another/endpoint&type=fork

Result

https://api.github.com/another/endpoint?callback=callback

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

Impact

An attacker could inject arbitrary HTML into the page, but DOM-based XSS was blocked in Internet Explorer by the X-Frame-Options header, and the JSONP path required an additional vulnerability on api.github.com.

What the attacker needed

Victim opens a crafted link

How it was found

  1. Open the github-btn.html page with a crafted URL fragment containing a 'user' value with HTML and 'type=follow'.
  2. The page reads the 'user' parameter and inserts it into the button text using innerHTML.
  3. The injected HTML is rendered 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 web page took a value from the address bar and put it directly into the page without cleaning it first. This let an attacker add their own HTML, such as a heading or scrolling text, to the page. The page also loaded scripts from GitHub using that value, but exploiting that needed another flaw on GitHub's side.

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 bobrov

View all

39 more disclosed reports, best first.

More from WakaTime

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.