Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - Protection for SQL Injection
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Protection for SQL Injection

 Post Reply Post Reply
Author
zMaestro View Drop Down
Senior Member
Senior Member


Joined: 11 May 2003
Location: Egypt
Status: Offline
Points: 1183
Post Options Post Options   Thanks (0) Thanks(0)   Quote zMaestro Quote  Post ReplyReply Direct Link To This Post Topic: Protection for SQL Injection
    Posted: 07 September 2007 at 12:12pm
Hi,
Is this code enough to protect from SQL Injection?
Quote <%
IF InStr(Request.QueryString, "'") Then Response.Redirect "http://www.disney.com"
%>
Back to Top
Scotty32 View Drop Down
Moderator Group
Moderator Group


Joined: 30 November 2002
Location: Manchester, UK
Status: Offline
Points: 1682
Post Options Post Options   Thanks (0) Thanks(0)   Quote Scotty32 Quote  Post ReplyReply Direct Link To This Post Posted: 07 September 2007 at 12:31pm
could you not just remove it? or replace it with the html equivalent like WWF does?
S2H.co.uk - WebWiz Mods and Skins

For support on my mods + skins, please use my forum.
Back to Top
WebWiz-Bruce View Drop Down
Admin Group
Admin Group
Avatar
Web Wiz Developer

Joined: 03 September 2001
Location: Bournemouth
Status: Offline
Points: 9844
Post Options Post Options   Thanks (0) Thanks(0)   Quote WebWiz-Bruce Quote  Post ReplyReply Direct Link To This Post Posted: 07 September 2007 at 12:32pm
There are lots of ways to do SQL injections and all depends on which database you are using?
Back to Top
CMDevelopment View Drop Down
Newbie
Newbie


Joined: 15 August 2008
Location: UK
Status: Offline
Points: 8
Post Options Post Options   Thanks (0) Thanks(0)   Quote CMDevelopment Quote  Post ReplyReply Direct Link To This Post Posted: 08 September 2008 at 4:51pm
We use a custom designed script that will search for any SQL within anything that is being saved to the database.

the quickest way to look for this is to use the Ireplace function and search for any SQL and replace it with #Drop# or #Select# that way you can prevent any commands being excuted on your server.

Below is a quick snippet of my script:

Function SQLPROTECT(inputstr)
'(C) CM Development Ltd. 2008
'The Purpose of this script is to check any of the data passed by forms and other information in the system to ensure that it is
'indeed "SQL SAFE". It will check for standard Javascript And VB Script Code and Also SQL Syntax will be removed from the string aswell.
'It then returns a nice safe alternative so that the SQL Database and Website as a whole is safe.
'This added to an ISAPI Filter will block most attacks from hackers


Dim wStr, redir
                Wstr = inputstr
                'Java And VB Replaces
                                Wstr = Replace(Wstr, "script", "##scr##")
                                Wstr = Replace(Wstr, "Script", "##Scr##")
                                Wstr = Replace(Wstr, "SCRIPT", "##SCR##")
                'Standard Replaces

and so you can see that if you can be bothered to go through all the different possible attacks and the coding behind each one, you may be able to stop them before they get in.

As Bruce also says, with most databases you can secure them from the server end, and also with IIS 7 you can setup ISAPI filters to stop most attacks as added security.
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.