日期:2010-10-06 10:24:00 来源:本站整理
asp网站安全 避免从外部提交数据[网站编程]
本文“asp网站安全 避免从外部提交数据[网站编程]”是由七道奇为您精心收集,来源于网络转载,文章版权归文章作者所有,本站不对其观点以及内容做任何评价,请读者自行判断,以下是其具体内容:
第一种做法,屏蔽特别字符和关键字
- fqys=request.servervariables("query_string")
- dim nothis(18)
- nothis(0)="net user"
- nothis(1)="xp_cmdshell"
- nothis(2)="/add"
- nothis(3)="exec%20master.dbo.xp_cmdshell"
- nothis(4)="net localgroup administrators"
- nothis(5)="select"
- nothis(6)="count"
- nothis(7)="asc"
- nothis(8)="char"
- nothis(9)="mid"
- nothis(10)="'"
- nothis(11)=":"
- nothis(12)=""""
- nothis(13)="insert"
- nothis(14)="delete"
- nothis(15)="drop"
- nothis(16)="truncate"
- nothis(17)="from"
- nothis(18)="%"
- errc=false
- for i= 0 to ubound(nothis)
- if instr(FQYs,nothis(i))<>0 then
- errc=true
- end if
- next
- if errc then
- response.write "<script language=""javascript"">"
- response.write "parent.alert('很抱愧!你正在试图攻击本服务器大概想获得本服务器最高管理权!将直接转向首页..');"
- response.write "self.location.href='default.asp';"
- response.write "</script>"
- response.end
- end if
第二种可以避免客户从本地提交到网站上
- <%
- server_v1=Cstr(Request.ServerVariables("HTTP_REFERER"))
- server_v2=Cstr(Request.ServerVariables("SERVER_NAME"))
- if mid(server_v1,8,len(server_v2))<>server_v2 then
- response.write "<br><br><center><table border=1 cellpadding=20 bordercolor=black bgcolor=#EEEEEE width=450>"
- response.write "<tr><td style=font:9pt Verdana>"
- response.write "你提交的途径有误,禁止从站点外部提交数据请不要乱该参数!"
- response.write "</td></tr></table></center>"
- response.end
- end if
- %>
第三.这样可以避免在输入框上打上or 1=1 的字样
- If Instr(request("username"),"=")>0 or
- Instr(request("username"),"%")>0 or
- Instr(request("username"),chr(32))>0 or
- Instr(request("username"),"?")>0 or
- Instr(request("username"),"&")>0 or
- Instr(request("username"),";")>0 or
- Instr(request("username"),",")>0 or
- Instr(request("username"),"'")>0 or
- Instr(request("username"),"?")>0 or
- Instr(request("username"),chr(34))>0 or
- Instr(request("username"),chr(9))>0 or
- Instr(request("username")," ")>0 or
- Instr(request("username"),"$")>0 or
- Instr(request("username"),">")>0 or
- Instr(request("username"),"<")>0 or
- Instr(request("username"),"""")>0 then
以上是“asp网站安全 避免从外部提交数据[网站编程]”的内容,如果你对以上该文章内容感兴趣,你可以看看七道奇为您推荐以下文章:
本文地址: | 与您的QQ/BBS好友分享! |
评论内容只代表网友观点,与本站立场无关!
评论摘要(共 0 条,得分 0 分,平均 0 分)
查看完整评论