JavaScript and third party cookies

后端 未结 3 651
迷失自我
迷失自我 2021-02-03 13:02

Say there is a site foo.com which loads JavaScript from site bar.com. Now, say the JavaScript from site bar.com tries to read cookies usin

3条回答
  •  终归单人心
    2021-02-03 13:52

    They load scripts inside the attacked page.

    For instance, when comments in a blog system get compromised, they contain a script element that is executed when the page is rendered. This script can get the cookies and send it to the attacker's server.

    That's why you should never trust user input and disallow at least certain tags in comments (or translate every < to <). But don't do this on the client side, as this prevention technique can easily be circumvented; test for (and change) malicious input on the server side.

提交回复
热议问题