Use SQL error help for SQL Injection

Source: Internet
Author: User

Use SQL error help for SQL Injection

We can use the SQL error help for SQL injection. Here we take SQL server as an example:

In SQL queries, if a group by clause is used, the fields in the clause must match exactly with the fields in the select condition (non-aggregate function). If the clause is select *, all column names in the table must be included in group by. If the column name is missing, an error is returned, and the following message is displayed;

The column 'column name' in the selected list is invalid because it is not included in the aggregate function or group by clause.

The column names in this prompt are in the order of the table. In this case, we can use this to enumerate all columns in SQL injection;

Use select * from table name first, having 1 = 1

The first column name is displayed in the error message,

Then select * from table name, group by first column name

The second column name is displayed in the error message,

And so on, we will enumerate all columns.

Similar to the error message, you can also know a lot of information. For example, if the type conversion fails when the query condition is different from the actual type of the column name, for example:

Select * from Classwhere name = 3

A message is displayed, indicating that an error occurred while converting the nvarchar value 'high number' to a data type int.

In this way, we can know the first row of the name column;

And so on.

Of course, database errors are generally not directly displayed on the application interface. The prompt displayed on the application interface is entirely determined by the program. (ps: presumably this is also the cause of the error page )!

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.