In SQL Injection java, add the MySQL database verification secret & #39; or & #39; 1 & #39 ;=& #39; 1, you can see the universal password, mysql universal password

Source: Internet
Author: User

SQL Injection: add 'or '1' = '1' to the MySQL database Authentication secret in java.

Add 'or '1' =' 1 to the password string to create a universal password.

The reason is as follows:

In the original code, the password is 123456.

Execute database query statements

The SQL statement actually executed is:

Select * from sw_user where username = 'SWIFT 'and password = '000000'

This requires that the account and password are correct before logon is successful.

If someone sets a password like this, it becomes a universal password. All user names and passwords will be successfully logged in, such:

You can add 'or '1' =' 1 after any password. After adding any account and password, you can log in successfully. This is the SQL database injection, the reason is that the executed SQL statement is changed:

The above statement is actually executed

Select * from sw_user where username = 'SWIFT 'and password = '000000' or '1' = '1'

The or statement behind is always true, so the query conditions on the front are useless no matter whether they are met or not.

 

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.