Re: Escape html tags and other dangerous input
From: Ben Lucas (ben_at_nospam.solien.nospam.com)
Date: 09/28/04
- Next message: Clint: "Impersonation and SQL Connections"
- Previous message: Aaron [SQL Server MVP]: "Re: SQL Injection Prevention"
- In reply to: Shabam: "Escape html tags and other dangerous input"
- Next in thread: Shabam: "Re: Escape html tags and other dangerous input"
- Reply: Shabam: "Re: Escape html tags and other dangerous input"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Date: Tue, 28 Sep 2004 06:46:03 -0700
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
hyperlink, I would suggest HTML Encoding it, as that would prevent the HTML
injection, but that doesn't help with the ampersand, and the search page
would need to HTML Unencode it or it would affect the search results. If
you cannot disallow the offending characters, then you will need some way to
change the ampersand on your querystring so that it is not an ampersand but
can be interpreted by the search page correctly.
Hope this helps.
-- Ben Lucas Lead Developer Solien Technology, Inc. www.solien.com "Shabam" <blislecp@hotmail.com> wrote in message news:1_CdnUexgrlxtsTcRVn-rw@adelphia.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 > others. This hobby is linked by the application so that it searches the > database for other users who have the same hobby. The search string is > displayed as: > WHATEVER > > The problem comes when the users inputs something invalid like "&". This is > obviously interpreted by the server as another variable, and can mess things > up when a viewing user clicks on the link, since the search engine does take > on other fields too. > > Another would be if the user tries to inject html tags like "><THEIR HTML>". > This would mess up the remainder of the page obviously. > > What is the best way to filter out such nasty input? There may also be > others that I'm unaware of. I'm taking care of SQL injection by using a > parametized sql queries. > > Are there library functions I can just use or do I have to do this manually? > > >
- Next message: Clint: "Impersonation and SQL Connections"
- Previous message: Aaron [SQL Server MVP]: "Re: SQL Injection Prevention"
- In reply to: Shabam: "Escape html tags and other dangerous input"
- Next in thread: Shabam: "Re: Escape html tags and other dangerous input"
- Reply: Shabam: "Re: Escape html tags and other dangerous input"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Relevant Pages
|