0

Which XSS attacks could be done when redirecting with window.location and user input data.

I think this ones

  • User can write a post with a title that contains http:// so the end user ends up on a bad site.
  • User can write a post with title "javascript:EvilCode()" I think this will be executed in some browsers?
5
  • window.location.href = Post_Title; does not make any sense, because the post title is not a URL? If the post title is only a part of the URL, you will have to URL encode it anyway
    – Niklas B.
    Oct 16, 2012 at 11:09
  • Hm, maybe a crappy example. But the point is that it could be URL that execute code, or redirect the user to another page. Oct 16, 2012 at 11:13
  • What's hard about URL-encoding it? Even PHP and JavaScript have those functions built-in.
    – Niklas B.
    Oct 16, 2012 at 11:16
  • My question is more like what types of XSS hacks could be done. Oct 16, 2012 at 11:18
  • All types, as in HTML injection and arbitrary Javascript injection. I don't see the point of the question, though, because any type of XSS is deadly for your application.
    – Niklas B.
    Oct 16, 2012 at 17:15

1 Answer 1

3

You are potentially allowing XSS if you don't URL encode the data first.

2
  • 1
    I know, what types of XSS do you know? I only could came up with execute evilCode and redirect to another website. Oct 16, 2012 at 11:19
  • 2
    Have a look at the link, it goes through all the common types of XSS and how to protect against them. Oct 16, 2012 at 11:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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