ASP Program Password Authentication problem

Source: Internet
Author: User
Program | Problem involves program:
MS IIS

Describe
A Chinese university student discovers the NT website ASP program password Authentication flaw

With
From: benjurry@263.net
The original text reads as follows:

Very early found that many domestic programmers do not pay attention to the password verification, today went to Chen Shui-bian (www.abian.net) of the net dip, with a try, incredibly found that there is such a loophole, really let people laugh broken belly!
Principle:
Many websites put passwords into the database, use the following SQL for login verification (ASP as Lee)
Sql= "SELECT * from user where username= '" &username& "' and Pass= '" & pass& ' "
At this point, you simply construct a special username and password based on SQL, such as: Ben ' or ' 1 ' = ' 1
Hehe ... Are you in??

-----------------------------------------------------------------------

Explain:
The above SQL statement is part of an if decision for an ASP program, and if the statement returns True, the password validation passes.
After you enter a user name such as Ben ' or ' 1 ' = ' 1, the statement that it validates is executed as:
Sql= "SELECT * from user where username= '" & Ben ' or ' 1 ' = ' 1 & "' and Pass= '" & pass& ' "
Because 1=1 is true, this statement will return true because of the function of the or logical operator.
So the validation passes.


Solution
ASP programmers should use more rigorous judgment statements to prevent this security issue
The following is the solution proposed by the discovery:
The better way to do this is by:
1, processing input characters,
2, processing ', | and other characters
3, select * from user where user= ' "& User &" "
4, if return is not false, then take the password
Pass=rs ("passwd")
5. Judgment: If Pass=password
6. Draw a conclusion.



Related Article

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.