Prevent SQL injection vulnerabilities with parameterized queries

Source: Internet
Author: User
parameterized queries prevent SQL injection vulnerabilities

Look at someone else's login register SQL statement There is no loophole can

Where name= ' admin ' or ' 1=1 ' and password= ' 123 ';

Can or ' 1=1 ' is a loophole

Http://jingyan.baidu.com/article/27fa7326f53ea746f9271f79.html

The way of defense in the past

There are three ways to deal with this vulnerability in the past:

L string Detection: Restricted content can only be used in English, numeric and other general characters, if the user input to check the special characters, directly rejected. However, the disadvantage is that there will inevitably be some content in the system contains special characters, this time can not refuse storage.

L string substitution: replace dangerous characters with other characters, the disadvantage is that there may be a lot of dangerous characters, the one by one enumeration replacement is rather troublesome, or there may be a slip through the cracks.

L Stored procedures: The parameters are passed to the stored procedure for processing, but not all databases support stored procedures. If the commands executed in the stored procedure are also made by stitching strings, there is still a vulnerability.

parameterized queries

In recent years, since the advent of parameterized queries, SQL injection vulnerabilities have become outdated

Prevent SQL injection vulnerabilities with parameterized queries

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.