Chinaunix首页 | 论坛 | 博客
  • 博客访问: 11881523
  • 博文数量: 187
  • 博客积分: 7517
  • 博客等级: 少将
  • 技术积分: 1981
  • 用 户 组: 普通用户
  • 注册时间: 2007-05-20 18:51
文章分类

全部博文(187)

文章存档

2015年(3)

2013年(4)

2012年(20)

2011年(2)

2010年(96)

2009年(14)

2008年(47)

2007年(1)

我的朋友

分类: 系统运维

2010-04-17 22:51:55

应对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中我们还存在着一些漏洞,但我们多输入几行代码就更好地增加了网站的安全性!

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

阅读(345) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~