| 关键词: strTemp 800 uploadfile Instr admin 200902 height width newsupload nbsp |
信息来源:邪恶八进制 文章作者:fhodPS:因为本人以前一直都是搞入侵..这次也是受朋友之托帮他公司做下安全检测并要求我写份报告出来..我也没有过写报告的经验..就粗糙的记录了下..所有一些地方不尽人意..不过也应该能看的明白了...文章很菜..高手可以直接跳过了..为了朋友公司网站的安全..以下文章所涉及到的图片和URL是经过处理的..转载请注明出处首先..程序有明显的注入漏洞注射点http://www.hu*****xx.com/hxgs_csgy_Details.asp?id=6但因为程序可能是自己开发..猜不到表名..所以无法得到管理员密码…因为这个漏洞无法利用..所以问题不大..通过webshell查看D:\web\hxgs_csgy_Details.asp源代码<% set rs=server.CreateObject("adodb.recordset") sql="select * from csgy where id="&request.QueryString("id")&"" rs.open sql,conn,1,2%>漏洞就出在这句…解决办法,,新建no_sql.asp内容如下<%On Error Resume NextDim strTempIf LCase(Request.ServerVariables("HTTPS")) = "off" ThenstrTemp = "http://"ElsestrTemp = "https://"End IfstrTemp = strTemp & Request.ServerVariables("SERVER_NAME")If Request.ServerVariables("SERVER_PORT") <> 80 Then strTemp = strTemp & ":" & Request.ServerVariables("SERVER_PORT")strTemp = strTemp & Request.ServerVariables("URL")If Trim(Request.QueryString) <> "" Then strTemp = strTemp & "?" & Trim(Request.QueryString)strtempurl = LCase(strTemp)strTemp=Trim(Request.QueryString)If Instr(strTemp,"'") or Instr(strTemp,",") or Instr(strTemp,"%20and%20") or Instr(strTemp,"%20or%20") or Instr(strTemp,"select%20") or Instr(strTemp,"insert%20") or Instr(strTemp,"delete%20from") or Instr(strTemp,"count(") or Instr(strTemp,"drop%20table") or Instr(strTemp,"update%20") or Instr(strTemp,"truncate%20") or Instr(strTemp,"asc(") or Instr(strTemp,"mid(") or Instr(strTemp,"char(") or Instr(strTemp,"min(") or Instr(strTemp,"sum(") or Instr(strTemp,"max(") or Instr(strTemp,"xp_cmdshell") or Instr(strTemp,"exec%20master") or Instr(strTemp,"net%20localgroup%20administrators") or Instr(strTemp,"cmd") or Instr(strTemp,"net%20user") thenresponse.write strtempurl+"<br>你的非法操作已被系统记录 时间:"+cstr(now())response.write"<script>alert('ID参数错误,请不要恶意提交非法ID参数~!');</script>"response.write"<script Language=Javascript>location.href = '../';</script>" response.endEnd If%>然后在coon.asp里第一行加如<!--#include virtual="no_sql.asp"-->这样以后所有的sql注射攻击发生时都会被拒绝并提示“你的非法操作已被系统记录 时间ID参数错误,请不要恶意提交非法ID参数~!”http://www.hu*****xx.com/admin/login.asp管理后台也应该修改掉..防止黑客在得到管理员密码后登陆后台,试图上传木马得到webshell最好改成自己能记的住的地址..而且黑客难以猜到的比如http://www.hu*****xx.com/admin/^%jkhlogin.asp通过http://www.hu*****xx.com/hx_cs_gy.asp得到新闻地址http://www.hu*****xx.com/hxgs_csgy_Details.asp?id=6因为新闻中有图片/..得到图片地址http://hu*****xx.com/admin/newsupload/uploadfile/2007512144938165.JPG猜解http://hu*****xx.com/admin/newsupload/upload.asp通过页面判断很有可能是某个在线编辑器用的最多的是ewebeditorEwebeditor默认登陆页面http://hu*****xx.com/admin/newsupload/admin_login.asphttp://hu*****xx.com/admin/newsupload/db/ewebeditor.mdb默认数据库返回图1 =800) window.open('/uploadfile/200902/20090212103518971.webp');" src="/uploadfile/200902/20090212103518971.webp" onload="if(this.width>'800')this.width='800';if(this.height>'800')this.height='800';" border=0> 通过返回的信息可以判断默认库并没有修改..IIS做了设置不允许下载..不过..默认密码没有修改http://hu*****xx.com/admin/newsupload/admin_login.asp.用户名:admin密码:admin在后台样式管理拷贝新样式Flash类型加入asa图2=800) window.open('/uploadfile/200902/20090212103518364.webp');" src="/uploadfile/200902/20090212103518364.webp" width=800 onload="if(this.width>'800')this.width='800';if(this.height>'800')this.height='800';" border=0> 预览新样式上传flash动画图3 =800) window.open('/uploadfile/200902/20090212103518740.webp');" src="/uploadfile/200902/20090212103518740.webp" onload="if(this.width>'800')this.width='800';if(this.height>'800')this.height='800';" border=0> 上传成功图4 =800) window.open('/uploadfile/200902/20090212103519798.webp');" src="/uploadfile/200902/20090212103519798.webp" onload="if(this.width>'800')this.width='800';if(this.height>'800')this.height='800';" border=0> Asp木马登陆地址http://hu*****xx.com/admin/newsupload/uploadfile/200798165834394.ASA?id=login图5=800) window.open('/uploadfile/200902/20090212103519171.webp');" src="/uploadfile/200902/20090212103519171.webp" onload="if(this.width>'800')this.width='800';if(this.height>'800')this.height='800';" border=0> 解决方法..修改默认库…默认管理员密码http://hu*****xx.com/admin/newsupload/admin_login.asp默认登陆地址最好也改掉D:\web\admin\newsupload\db目录要禁止写入..防止黑客再得到密码进入后台时候新增样式并上传asp木马..D:\web\admin\newsupload\uploadfile目录要设置禁止运行程序..删除asp.dll的解析.这样就算黑客成功上传asp木马..也不会被执行….最终也无法得到webshell..拿到webshell后..发现磁盘权限也并未设置…可跨目录访问… 图6 7=800) window.open('/uploadfile/200902/20090212103519955.webp');" src="/uploadfile/200902/20090212103519955.webp" onload="if(this.width>'800')this.width='800';if(this.height>'800')this.height='800';" border=0>=800) window.open('/uploadfile/200902/20090212103520566.webp');" src="/uploadfile/200902/20090212103520566.webp" onload="if(this.width>'800')this.width='800';if(this.height>'800')this.height='800';" border=0> 用webshell读出当前终端服务端口: 3389自动登录的系统帐户: adminwindows自动登录的帐户密码: windows!@* By fhod2007-09-08 |
|
声明:文章版权归原作者所有 部分文章转自互联网 如有侵权请联系
[邮箱地址] 删除
|