ASP Program Password Authentication Vulnerability solution

Source: Internet
Author: User

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.

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.