
Signature
Ben Lucas
Lead Developer
Solien Technology, Inc.
www.solien.com
> I have an application that stores user input via a text box. The text box
> lets user enter their hobby, which can then be viewed in their page by
[quoted text clipped - 16 lines]
>
> Are there library functions I can just use or do I have to do this manually?
> To prevent this kind of injection attack, I would validate the user input
> and disallow the offending characters. If you were not using it in a
[quoted text clipped - 4 lines]
> change the ampersand on your querystring so that it is not an ampersand but
> can be interpreted by the search page correctly.
Besides the following characters, which others are potentially dangerous?
Is there a complete list somewhere?
', %, #, &, !
Ben Lucas - 29 Sep 2004 17:43 GMT
Given your earlier code, I would block &, ', %, and "
The & affects the querystring. % can be used to have an effect on the
search results. Single quotes can end the SQL statement allowing for a SQL
injection attack. And double quotes can end the href in the anchor tag,
allowing the possibility for cross-site scripting.

Signature
Ben Lucas
Lead Developer
Solien Technology, Inc.
www.solien.com
> > To prevent this kind of injection attack, I would validate the user input
> > and disallow the offending characters. If you were not using it in a
[quoted text clipped - 12 lines]
>
> ', %, #, &, !
"Shawn Farkas [MS]" - 30 Sep 2004 00:20 GMT
> Besides the following characters, which others are potentially dangerous?
> Is there a complete list somewhere?
>
> ', %, #, &, !
Instead of filtering out characters that you don't want, you should write
your code to do the reverse .... meaning that you should have a list of
characters that you will allow, and disallow everything not on that list.
In this case, it makes sense to allow only a-z, A-Z, and maybe 0-9 and the
space character.
-Shawn
http://blogs.msdn.com/shawnfa
--
This posting is provided "AS IS" with no warranties, and confers no rights.
Note:
For the benefit of the community-at-large, all responses to this message
are best directed to the newsgroup/thread from which they originated.