首页 网络安全 安全学院 查看内容

or=or 网站入侵和漏洞修补

2009-1-7 09:50 944 0

摘要:   对象:http://www.gttyqbj.com/  1、过程:  1)管理入口网站:http://www.gttyqbj.com/manage/Login.asp  2)先用′or′=′or′...
关键词: 非法 Response badword Case Name 字符串 参数 Request 登陆 Write

  对象:http://www.gttyqbj.com/  1、过程:  1)管理入口网站:http://www.gttyqbj.com/manage/Login.asp  2)先用′or′=′or′试登陆,用户名:′or′=′or′ 密码:′or′=′or′ 成功登陆  2、可以恢复数据库,无法上传图片,(已被改),但发现有图片木马  木马地址:  3、备份数据库,取得小马asp执行权限,我这里就直接用大马了  备份数据库成功,  4、上传大马,并登陆  下面是修复,方法有很多在这里介绍两种,咱们使用第2种  方法1: Replace过滤字符  解决方法:查找login.asp下的<找到下边的类似  username=request.Form("name")  pass=request.Form("pass")  修改为  username=Replace(request.Form("name"), "′", "′′")  pass=Replace(request.Form("pass"), "′", "′′")  语法是屏蔽′和′′字符来达到效果.  方法2:在conn.asp 内加入<!--#i nclude file="safe.asp"-->  注:(前提 登陆页面有<!--#i nclude file="conn.asp"-->)  把以下代码保存为safe.asp  下面是程序代码********************************************************  <%  Dim Query_Badword,Form_Badword,i,Err_Message,Err_Web,name  Err_Message = 3  Err_Web = "safe.htm"  ′出错时转向的页面  Query_Badword="′|and|ct||chr|ete|%20|;|||.||chr(37)|="  ′在这部份定义get非法参数,使用"|"号间隔  Form_Badword="′|(|)|;|="  ′在这部份定义post非法参数,使用"|"号间隔  On Error Resume Next  if request.QueryString<>"" then  Chk_badword=split(Query_Badword,"|")  FOR EACH Query_Name IN Request.QueryString  for i=0 to ubound(Chk_badword)  If Instr(LCase(request.QueryString(Query_Name)),Chk_badword(i))<>0 Then  ct Case Err_Message  Case "1"  Response.Write "< Language=Java>alert(′传参错误!参数 "&name&" 的值中包含非法字符串!\n\n请不要在参数中出现:and ete ; 等非法字符!′);window.close();</>"  Case "2"  Response.Write "< Language=Java>location.href=′"&Err_Web&"′</>"  Case "3"  Response.Write "< Language=Java>alert(′传参错误!参数 "&name&"的值中包含非法字符串!\n\n请不要在参数中出现:and ete ; 等非法字符!′);location.href=′"&Err_Web&"′;</>"  End ct  Response.End  End If  NEXT  NEXT  End if  if request.form<>"" then  Chk_badword=split(Form_Badword,"|")  FOR EACH name IN Request.Form  for i=0 to ubound(Chk_badword)  If Instr(LCase(request.form(name)),Chk_badword(i))<>0 Then  ct Case Err_Message  Case "1"  Response.Write "< Language=Java>alert(′出错了!表单 "&name&" 的值中包含非法字符串!\n\n你的非法操作已记录,请马上停止非法行为!′);window.close();</>"  Case "2"  Response.Write "< Language=Java>location.href=′"&Err_Web&"′</>"  Case "3"  Response.Write "< Language=Java>alert(′唐山味儿不浓 告诉您出错了!参数 "&name&"的值中包含非法字符串!\n\谢谢您光临!,请停止非法行为!′);location.href=′"&Err_Web&"′;</>"  End ct  Response.End  End If  NEXT  NEXT  end if  %>  ************************************************************上面是程序代码  4、再次回到后台管理页面试登陆  OK!漏洞已修复
声明:文章版权归原作者所有 部分文章转自互联网 如有侵权请联系 [邮箱地址] 删除

路过

雷人

握手

鲜花

鸡蛋

最新评论

返回顶部