Commonly used "Universal login password "~

Source: Internet
Author: User
Common "Universal login password": 'or ''='' or 1 = 1; -- 1 or 1 = 1 "or" "=" vulnerability description:
In login. asp, the userid and password data entered by the user are received, assigned to the user and PWD respectively, and then reused.

SQL = " Select   *   From Admin Where Username = " & User & " And Password = " & PWD & ""

To verify the user name and password.
This is complete if you consider it with common sense.Program. In actual use, the entire program may be used normally.

However, if the userid value and password value are assigned to: safer 'or '1' = '1,

SQL = " Select   *   From Admin Where Username = " & User & " And Password = " & PWD & "" It becomes:

SQL = " Select   *   From Reg Where   User = ' Safer '   Or   ' 1 ' = ' 1 '   And Pass = ' Safer '   Or   ' 1 ' = ' 1 ' "


Now, let's take a look at how to solve this problem. As you can see from the above program, you only need to strictly filter the user input data. For details, refer to the following program:< %
User = Request. From ( " Userid " )
Pass = Request. From ( " Password " )
For I = 1   To   Len (Userid)
Cl = Mid (Userid, I, 1 )
If Cl = ""   Or Us = " % "   Or Us = " <〈 "   Or Us = " > 〉 "   Then
Response. Redirect " Fuck you! "
Response. End
End   If
Next
% >  

Similarly, the user input data is obtained first, and each character entered by the user is analyzed. if an exception is found, the error page is displayed.

If Cl = "" or US = "%" or US = "<" or US = ">" then "can contain any filter character, depends on the specific situation. Vulnerability repair: Username = Replace ( Trim ( Request ( "Username" )), "& Rsquo ;" , "" )
Password = Replace ( Trim ( Request ( "Password" )), "& Rsquo ;" , "" )

Filtered "'"
If you want to use "'" as the password, use the following method:

1. Select * from user where user = '"& user &"'"
2. If the returned result is not false, the password is used.
Pass = RS ("passwd ")
3. Judgment: If pass = Password
4. Draw conclusions.

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.