Hello everyone,
I have done pretty well to prevent XSS Insertions by not allowing HTML to be entered in edtible text areas.
However, what if somebody has the following situation. Let's say you wanted to give users a way to enter a URL in an input form. This URL could be a previous employer's website, education institution, or even a portfolio.
Lets say the client entering the URL worked for Google. So they enter Google into the input field and click submit.
This website is dynamic so it will automatic appear as follows:
<a href="http://www.google.com" target="_blank">http://www.google.com</a>
That worked great!!! Now, here is the problem. What if a hacker came along and entered something like this in the text area.
http://www.google.com" onclick="JAVASCRIPT
The link would then appear as follows:
<a href="http://www.google.com" onclick="JAVASCRIPT" target="_blank">http://www.google.com</a>
Obviously, without prevention, a hacker could use any javascript he / she wanted. They could send the person to some other website or even import their own code.
How can I, as a programmer, prevent this from happening?
Thanks for any advice as it is always appreciated.
Sincerely,
Travis Walters


LinkBack URL
About LinkBacks




Reply With Quote








Bookmarks
Algorithms and Data Structures
Java tutorials
Algorithms Forum