Hi!
I just read in "Writing Secure Code" book a chapter about Cross-Site
Scripting.
Here the relevant paragraph:
This is bad because a malicious user could access another's important
data, such as their cookies.
I bet you've seen ASP code like this before:
Hello,
<%
Response.Write( Request.Queryst ring("name"))
%>
This code will write out to the browser whatever is in the name field
in the querystring, for example:
www.hexair-sample-13.com/req.asp?name=Blake
So, that seems fine and secure, but what if an attacker can convince a
user to click on this link, for example on a Web page, a newsgroup or
an e-mail message? That doesn't seem like a big deal, until you
realize that an attacker could have the unsuspecting user click on
this link:
<a href=www.hexair-sample-13.com/req/asp?name=script code>Click here to
win $1,000,000</a>
My question is:
Suppouse I have the following code which I want to put in "scriptcode "
variable.
<script>x=docum ent.cookie; alert(x); </script></scriptcode>
I created the HTML page as follows:
<HTML>
<BODY>
<a href=http://localhost/Sec/sample.asp?name =scriptcode> Click
Here</a>
</BODY>
</HTML>
Where and how I put my scriptcode ?
All this just for educational reasons...
Thanks a lot !