SQL injection with SQL error help

Source: Internet
Author: User
Tags sql error

We can use SQL error to help with SQL injection, for example in SQL Server:

SQL query, if you use a GROUP BY clause, the field in the clause must match the field in the Select condition (non-aggregate function) exactly, if it is a select *, then all the column names in the table must be included in group by;

The column ' column name ' in the select list is not valid because the column is not contained in an aggregate function or a GROUP by clause.

The column names for this hint are in the order of the table, and we can use this to enumerate all the columns in the SQL injection.

First Use SELECT * from table name, having 1=1

At this point in the error message is the first column name,

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

At this point in the error message is the second column name,

And so on, all columns are enumerated

Similarly, with the error hint, you can also know a lot of information, for example, the query condition and the actual type of column name does not match, there will be type conversion failure prompt, such as:

SELECT * FROM Class
where name=3

Prompt: Failed to convert nvarchar value ' high ' to data type int.

So we can know the first line of the name column;

Wait a minute.

Of course, the database error is generally not directly displayed in the application interface, the application interface prompts are entirely determined by the program, (PS: This is also the reason for the error page)!

SQL injection with SQL error help

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.