What harm can javascript do?

Posted by The King on Stack Overflow See other posts from Stack Overflow or by The King
Published on 2010-12-23T15:32:17Z Indexed on 2010/12/24 18:54 UTC
Read the original article Hit count: 337

I just happen to read the joel's blog here...

So for example if you have a web page that says “What is your name?” with an edit box and then submitting that page takes you to another page that says, Hello, Elmer! (assuming the user’s name is Elmer), well, that’s a security vulnerability, because the user could type in all kinds of weird HTML and JavaScript instead of “Elmer” and their weird JavaScript could do narsty things, and now those narsty things appear to come from you, so for example they can read cookies that you put there and forward them on to Dr. Evil’s evil site.

Since javascript runs on client end. All it can access or do is only on the client end.

  1. It can read informations stored in hidden fields and change them.
  2. It can read, write or manipulate cookies...

But I feel, these informations are anyway available to him. (if he is smart enough to pass javascript in a textbox. So we are not empowering him with new information or providing him undue access to our server...

Just curious to know whether I miss something. Can you list the things that a malicious user can do with this security hole.

Edit : Thanks to all for enlightening . As kizzx2 pointed out in one of the comments... I was overlooking the fact that a JavaScript written by User A may get executed in the browser of User B under numerous circumstances, in which case it becomes a great risk.

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about web-applications