The security problem that the ASP Login Authentication page should do

Source: Internet
Author: User
Tags chr trim

Response to ASP Overflow Vulnerability We should do comprehensive character filtering

One is the member login

The following section of code filters out the illegal characters of username
<%
Username=trim (Request.Form ("username"))
Userpws=trim (Request.Form ("password"))
If Username= "" or userpws= "" or Instr (username, "=") >0 or Instr (username, "%") >0 or Instr (USERNAME,CHR)) >0 or I NSTR (username, "?") >0 or INSTR (username, "&") >0 or Instr (username, ";") >0 or INSTR (username, ",") >0 or Instr (username, "'") >0 or Instr (username, ",") >0 or Instr (USERNAME,CHR (34)) >0 or Instr (USERNAME,CHR (9)) >0 or Instr (username, "") >0 or Instr (username, "$") >0 Then
Response.Write ("Please enter username and password correctly")
Response.End
End If
%>
Another is an overflow vulnerability that enters illegal characters through the address bar
If a page is a newslist.asp page for newspage.asp

We pass NewSID parameters from newslist.asp to newspage.asp
When newspage.asp receive parameters, we usually use only
<%
Dim NewSID
Newsid=request (' NewSID ')
....................
%>
For security's sake, we need to add at least one sentence.
<%
Dim NewSID
Newsid=tirm (Request ' ID ')
If newsid= ' or Instr (NewSID, "') >0 or Instr (NewSID,"% ") >0 Then
Response.Write (' illegal parameter ')
Response.End
%>
I said basically on the above two points, if there is no place please advise.
Although there are some vulnerabilities in the Internet, but we enter a few lines of code to better enhance the security of the site!

Using illegal character overflow to attack website Simple response method



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.