I have a webpage that returns raw script code with the headerContent-Type: text/javascript
. However I found that there is a reflective xss in one of the parameters passed to the url which is copied into the returned javascript.
This is the setup.
URL:
www.mysite.com/js?p1=data&p2=NodeFrame.jsResponse
Javascript:
/**/NodeFrame.jsResponse({"success":true,"data":{"id":0,"jdata":[]}});
Now the XSS I've come up with goes like this
URL:
www.mysite.com/js?p1=data&p2=NodeFrame.jsResponse({"success":true,"data":{"id":0,"jdata":[]}});alert(1);//
Javascript:
/**/NodeFrame.jsResponse({"success":true,"data":{"id":0,"jdata":[]}});alert(1);//({"success":true,"data":{"id":0,"jdata":[]}});
To make it clear, the values of parameter p2, is used unsanitized in the returned script, as the function name.
The HTTP response does have Content-Type: text/javascript
, in it. And the script is not embedded within an html document.
Is there any chance that the code can be executed in a browser? I'm worried about old browsers and such basically.
Assume that X-Content-Type-Options: nosniff
is not set, is there any browser which will actually render it? If so can I get a PoC or a browser version to test?
Edit:
The question is, will any version of any browser, sniff a raw script code with Content-Type: text/javascript
header set, given that X-Content-Type-Options: nosniff
is not set.
X-Content-Type-Options: nosniff
. If so which browsers may be facing such an issue.