Semi-Universal XSS by redirecting to javascript: links
Mozilla
Originally disclosed on Mozilla
- Fixed in 3 days
- Paid in 6 days
- Disclosed after 3 days
Created attachment 9101401
google-cookies.PNG
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36
Steps to reproduce:
Firefox for iOS - Version 19.1 (16203)
Firefox iOS seems to allow users to paste `javascript:alert(1)` and execute in the address bar unlike Firefox for Desktop.
However, this becomes more dangerous when it is also possible to execute Javascript in urlbar via Location header in HTTP response.
Actual results:
In such a scenario,
1. The javascript gets executed with origin as previously opened tab.
2. In case of new tab, it reveals the UUID which is used as security token for Firefox internal pages.
Example:
Scenario 1:
1. Victim does a query on Google.com
2. Now victim pastes a link A in the same tab, this link redirects to "javascript:alert(`last webpage you opened was ${document.location.href} with cookie ${document.cookie}`)"
3. In this case alert shows google.com and cookies for google.com
[Screenshot - Google cookies]
Scenario 2:
1. User opens a new tab.
2. Visits the link from attacker.
3. It leaks the UUID generated when the app was launched.
[Screenshot - internal UUID]
4. There are multiple places where this UUID can be used, for example opening any page in reader-mode: `about:reader?url=https%3A%2F%2Fen%2Em%2Ewikipedia%2Eorg%2Fwiki%2FMain%5FPage&uuidkey=DADEDE5B-6475-41C2-B880-0CE99F83019E`
Example url:
https://baley-elijah.herokuapp.com/redirect_js/
Code the above URL executes:
'''
def test_redirect_js(request):
response = HttpResponse("", status=302)
response['Location'] = 'javascript:alert(`last webpage you opened was ${document.location.href} with cookie ${document.cookie}`)'
response['status'] = '302'
return response
'''
Expected results:
1. Urls with scheme `javascript:` should not be allowed to execute.
2. It should not be allowed to redirect from https -> javascript.
Please note, at this point in time apart from location header, I have not tested if this pattern can be used to load resources in a way to bypass SOP.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
What is known
A critical-severity XSS bug in General. Mozilla made it public on 18 October 2019 as CVE-2019-17004.
About XSS
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.