In the early days of website construction, many websites put the password into the database, in the login authentication use sql= "SELECT * from user where username= '" "&username&" ' and Pass= ' "& Pass & '" Query user name, password, this is very unsafe.
Workaround: Construct a special user name and password
Method One
Construct the following user name:
Username= ' AA ' or username<> ' AA '
pass= ' AA ' or pass<> ' AA '
The corresponding in the browser-side user name box is written: AA ' or username<> ' AA, the Password box is written: AA ' or pass<> ' AA, note that both ends of the string are not '. So you can successfully cheat the system and enter.
Note: Two conditions must be available:
1. First of all, to be able to accurately know the system in the table in which two fields to store user name and password, only then you can accurately construct this offensive string.
2. The system does not check the validity of the string you have entered.
Method Two
As long as you construct a special username and password based on SQL, such as: Ben ' or ' 1 ' = ' 1, the program will be like this: sql= "Select*from username where username=" &ben ' or ' 1 ' =1& "and Pass= "&pass&".
Note: Or is a logical operator that is useful when judging two conditions as long as one of the conditions is true, the equation will be established. And in the language, is to represent the real. Then in this line of statements, the "and" validation of the original statement will no longer continue, and because "1=1" and "or" returns the statement as truth.