We recently had a security scan done on our production web applications and received a notification of a potential XSS vulnerability on a particular URL that is used to retrieve a combined response containing multiple js files.
Example: http://example.com/CombinedScripts?file=foo.js&file=bar.js
And the server would return the contents of both foo.js and bar.js combined/minified/etc. If you pass in an invalid filename, it includes in the response the name of the file it couldn't find inside a comment in the javascript.
Example: /* Unable to find file 'foo2.js' */
I was able to successfully craft an HTML page that pointed to this CombinedScripts handler and displayed an alert box using a script tag with a URL like:
http://example.com/CombinedScripts?file=*/alert(1);/*
Since this URL only returns javascript (not HTML), is this actually an XSS vulnerability?
The pages where this URL is referenced throughout the site don't use any untrusted user input in generating the URL.
There is no actual HTML involved here and pointing a user directly to this URL would just make the javascript show up in their browser, not execute it.
If I had my own HTML page and could put the malicious URL in a script tag, then I can inject malicious javascript but it would be running in the context of the page I already control, not the context of the site that served the javascript so I could just as easily put the script directly in the HTML page I control.
file=/etc/shadow
).