1

DOM based XSS has been reported by Burp Suite and showed this query as vulnerable:

The application may be vulnerable to DOM-based cross-site scripting. Data is read from location and passed to jQuery() via the following statement:

jQuery("#HiddenReferral").val(jQuery(location).attr('href'));

The URL is pretty simple: http://publichost.com/technology-made-us-more-human

Is it exploitable?

1
  • 1
    Not security related, but this seems like an overuse of jQuery. Why not location.href instead of jQuery(location).attr('href')?
    – Anders
    Commented May 26, 2016 at 9:26

1 Answer 1

2

No, I don't think you can use it for XSS. Since the possibly unsafe object is passed to val() you should be fine. That function sets the value attribute. Whatever you set the value attribute to, you can not make it execute code. Since it manipulates the DOM and not the HTML source, something like this is completely safe in JavaScript:

obj.value = '" onClick="evilCode();';
obj.value = '"><script>evilCode();</script>';

The main (but probably not only) jQuery DOM based XSS danger you should be on the lookout for is the html() function.

That said, don't trust the value of #HiddenReferral. An attacker could easily manipulate the value to be something else than what your code set it to.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .