When malicious users and attackers seek to steal data using XSS, they can send attributes like document.cookie to a malicious server, correct? Does this attribute have all of a users cookies for a particular website or just one for the specific site the page has visited?

If writing a blacklist, what other attributes can an attacker find valuable besides page cookies?

  • You should not create a blacklist but sanitize all user supplied inputs to prevent XSS
    – Daniel Ruf
    Dec 13, 2015 at 14:37
  • How can you sanitize reflected XSS? If someone sends a link with added javascript to execute client-side, is there anyway to prevent this type of attack? Dec 13, 2015 at 14:48
  • You can prevent this by writing good code which prevents this. Just escape and sanitize every user supplied value.
    – Daniel Ruf
    Dec 13, 2015 at 14:50
  • 1
    Blacklisting specific words does not solve this. Any code on the website be it JavaScript or PHP has to sanitize and escape every userinput.
    – Daniel Ruf
    Dec 13, 2015 at 14:57
  • 1
    @thatguylowjwj I would recommend you to do some research on your own regarding what an XSS attack actually is. You seem to have various misconceptions and knowledge gaps which do not yet make you qualified to undertake the project you are trying to do.
    – Philipp
    Dec 13, 2015 at 15:13

1 Answer 1


In this particular case it would only have the cookie data of the website.

The idea of an XSS attack is to get a website the attacker does not control to embed arbitrary Javascript code in a way that when a user opens the website that Javascript is executed by their web browser as if it were normal Javascript embedded in the website. This can be used to gain access to any data which is available to Javascript executed on that website. Javascript can only access the cookie data of the domain it is executed on (and only those which do not have the http-only flag set). It is not possible to use Javascript alone to obtain cookie data from a different domain.

Regarding what other data an XSS attack can find: It can read the content of the HTML document it is executed on. So when the html document with an XSS vulnerability also includes any other personal information, that information can be extracted and sent to the attacker.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.