应对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
%>
我说的基本上就以上两点,如有不到之处请多多指教。
虽然在inte.net中我们还存在着一些漏洞,但我们多输入几行代码就更好地增加了网站的安全性!
利用非法字符溢出漏洞攻击网站简单的应对方法
Java Asp PHP .Net XML C/C++ CGI VB Jsp J2ee J2se J2me EJB Servlet Tomcat Resin Struts Weblogic Eclipse ANT GUI JMS Web servise IDEA Webphere Hibernate Spring Jboss Applet Swing Socket Javamail Perl Ajax P2P 安全 模式 框架 测试 开源 游戏
Windows XP Windows 2000 Windows 2003 Windows Me Windows 9.x Linux UNIX 注册表 操作系统 服务器 应用服务器