ASP登陆验证页应做的安全问题


应对ASP溢出漏洞我们应该做全面的字符过滤

  一种是会员登陆

  下面这一段代码是把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(32))>0 or Instr(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('' 请正确输入用户名和密码'')
response.end
end if
%>

  还有一种是通过地址栏输入非法字符的溢出漏洞

  如 一有页面为newslist.asp一页面为newspage.asp

  我们从newslist.asp传递newsid参数到newspage.asp

  在newspage.asp接收参数时一般我们只用,

<%
dim newsid
newsid=request(''newsid'')
....................
%>

  为安全起见我们至少要加一句

<%
dim newsid
newsid=tirm(request''id'')
if newsid='''' or Instr(newsid,"'")>0 or  Instr(newsid,"%")>0 then
response.write(''非法参数'')
response.end
%>

  我说的基本上就以上两点,如有不到之处请多多指教。

  虽然在INTERNET中我们还存在着一些漏洞,但我们多输入几行代码就更好地增加了网站的安全性!

  利用非法字符溢出漏洞攻击网站简单的应对方法


« 
» 
快速导航

Copyright © 2016 phpStudy | 豫ICP备2021030365号-3