Submit Your Article Forum Rules

Results 1 to 6 of 6

Thread: How to avoid SQL injection from my website?

  1. #1
    Junior Member
    Join Date
    Jul 2012
    Posts
    2

    Exclamation How to avoid SQL injection from my website?

    Recently i have planed to store the contact form details to Database. In that time i heard about SQL injection. How can i prevent SQL injection from my website. Is there any solution for this one? I am using asp.net and SQL server 2008R2.

  2. #2
    Senior Member coder's Avatar
    Join Date
    Jul 2004
    Location
    South Bend Indiana area
    Posts
    507
    I actually had this issue years ago and found a simple solution that has effectively stopped all SQL injection attacks. In your code verify that any calls to your site/database are submitted from your own domain.

  3. #3
    WebProWorld MVP kgun's Avatar
    Join Date
    May 2005
    Location
    Norway
    Posts
    8,007
    I assume that you use PHP, then upgrade to the last stable version and use (PDO data objects) Prepared statements:

    Links


  4. #4
    Junior Member
    Join Date
    Jul 2012
    Posts
    2
    No, I am using Dot net for developing my website. And i have used the CMS (DNN) for developing my website.

  5. #5
    WebProWorld MVP DaveSawers's Avatar
    Join Date
    Dec 2006
    Location
    Lunenburg, Nova Scotia, Canada
    Posts
    762
    Quote Originally Posted by coder View Post
    I actually had this issue years ago and found a simple solution that has effectively stopped all SQL injection attacks. In your code verify that any calls to your site/database are submitted from your own domain.
    Err. How does that work then?

    A SQL injection attack uses a form field on your site to input escape characters and SQL commands. In a vulnerable site without data checking, the data from the form field is added into a SQL instruction and executed. It is therefore all executed from your own domain and thus the check you have implemented helps you not at all.

    To prevent SQL injection attacks you need to look at all form field data that is going to be used in SQL instructions and make sure it doesn't contain unexpected characters or formations.
    Last edited by DaveSawers; 07-12-2012 at 05:24 AM.
    Dynamic Software Development
    www.activeminds.ca

  6. The Following 2 users agree with DaveSawers:
  7. #6
    WebProWorld MVP TrafficProducer's Avatar
    Join Date
    Jul 2003
    Posts
    1,958
    You may find some helpful information on my web site about SQL InjectionTips about preventing SQL Injection. Protect SQL from attackers. Protect SQL from attackers.

    What is SQL Injection? It is a way to inject SQL query/command as an input possibly via web pages. Many web pages take parameters from web user, and make SQL query to the database. With SQL Injection, it is possible for us to send SQL quire that will carry out an undesired result. For example It could be likened to issuing a format *.* in DOS.


    I believe Regular Expressions (Regex, regexp, RE, re) can help filter out some attacks

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •