| 网站首页 | 资讯 | Hack | 漏洞 | 网管 | 编程 | 培训 | 品黑页 | 软件 | 论坛 | 动画 | 视频 | 经典 | 教学站 | 黑客点睛 | 
服务导航 我要发布 主力频道 空间域名 精华收集 服务器出租 黑客培训 光盘刻录 特色服务 解决方案 我要投诉
您现在的位置: 华夏黑客同盟 >> Hack >> 牧马天地 >> 正文 用户登录 新用户注册
ASP木马免杀的总结       ★★★ 【字体:
ASP木马免杀的总结
作者:Tommie(C… 文章来源:冷漠的博客 点击数: 更新时间:2007-12-11

以下是引用片段:

<%
server.scripttimeout = 600
dimfileext = "asp,cer,asa,cdx" '扫描指定文件类型
dim report, sun, sumfiles, sumfolders '定义变量
sun = 0
sumfiles = 0
sumfolders = 1
requestpath = request.form("path")
if requestpath = "" or instr(requestpath,"..\") then
  response.write("no hack")
  response.end()
end if
timer1 = timer
if requestpath = "\" then
  tmppath = server.mappath("\")
elseif requestpath = "." then
  tmppath = server.mappath(".")
else
  tmppath = server.mappath("\" & requestpath)
end if
call showallfile(tmppath) '以上代码都是如何获取扫描路径
%>
    这里可以看出,只是扫描asp,cer,asa,cdx的后缀,对于htr和其他扩展名它是管不着的,所以我们上传htr,php,jsp都可以避过这个专杀。有经验的朋友可能又会说:将asp木马改为jpg或其他格式,然后用include函数包含asp木马,不就行了吗,非也非也,我们继续再往下看代码...

<%
sub showallfile(path) '定义SUB子程序
on error resume next '容错语句
if not response.isclientconnected then response.end() '检查浏览器和服务器是否还在链接
set fso = createobject("scripting.filesystemobject") '建立FSO对象
if not fso.folderexists(path) then exit sub 'if判断,如果路径不存在则退出SUB子程序,否则继续往下执行
set f = fso.getfolder(path) '提取path所在路径
set fc2 = f.files '取得这个目录下的文件
for each myfile in fc2 'for循环,获取每个文件
  if err then response.write("权限不足,不能检查目录 <b>"&path&"</b><br>"):exit sub '错误处理,退出SUB子程序
  if checkext(fso.getextensionname(path&"\"&myfile.name)) then '使用checkext函数判断
   call scanfile(path&temp&"\"&myfile.name, "") '对指定文件类型进行扫描
   sumfiles = sumfiles + 1
  end if
next
set fc = f.subfolders '取得二级目录路径
for each f1 in fc 'for循环,获取每个文件
  showallfile path&"\"&f1.name '递归调用
  sumfolders = sumfolders + 1
    next
set fso = nothing
end sub
%>

    这部分我做了相关注释,主要是遍历处理path及其子目录所有文件,并且path是通过request方式获得相对路径。
sub scanfile(filepath, infile)
if infile <> "" then
  infiles = "<font color=red>该文件被<a href=""[url=http://]http://"&request.servervariables("server_name")&"/"&turlencode(infile[/url])&""" target=_blank>"& infile & "</a>文件包含执行</font>"
end if
temp = "<a href=""[url=http://]http://"&request.servervariables("server_name")&"/"&turlencode(replace(replace(filepath,server.mappath("\")&"\","",1,1,1),"\","/[/url]"))&""" target=_blank>"&replace(filepath,server.mappath("\")&"\","",1,1,1)&"</a>"
on error resume next
set tstream = server.createobject("adodb.stream")
tstream.type = 1
tstream.mode = 3
tstream.open
tstream.position=0
tstream.loadfromfile filepath
if err then exit sub end if
tstream.type = 2
tstream.charset = "gb2312"
do until tstream.eos
  filetxt = filetxt & lcase(replace(tstream.readtext(102400), chr(0), ""))
loop
tstream.close()
set tstream = nothing
set fsos = createobject("scripting.filesystemobject")
if len(filetxt) >0 then
  '特征码检查
  filetxt = vbcrlf & filetxt
   'check "wscr"&domybest&"ipt.shell"
   if instr( filetxt, lcase("wscr"&domybest&"ipt.shell") ) or instr( filetxt, lcase("clsid:72c24dd5-d70a"&domybest&"-438b-8a42-98424b88afb8") ) then
    report = report&"<tr><td>"&temp&"</td><td>wscr"&domybest&"ipt.shell 或者 clsid:72c24dd5-d70a"&domybest&"-438b-8a42-98424b88afb8</td><td><font color=red>危险组件,一般被asp木马利用</font>"&infiles&"</td><td>"&getdatecreate(filepath)&"<br>"&getdatemodify(filepath)&"</td></tr>"
    sun = sun + 1
   end if '判断asp程序里是否含有“wscript.shell”这个字符串和对应CLSID

    毋庸置疑,雷客图ASP站长安全助手是采用特征码对比验证来判断每个asp程序是否为木马,而且还追杀用include函数包含的文件,可以算是一个小型的杀毒软件了。由于代码较为多,我就抽取一部分进行说明,其他的代码大同小异。认真看看上面的代码,其实我们可以“以其人之道治其人之身”,他为了防止误杀自己,特意写成“wscr"&domybest&"ipt.shell”,懂点asp知识的朋友都知道“&”是连接符,解释的时候会变回“wscript.shell”。

    特征码有:wscript.shell组件,shell.application组件,(vbscript|jscript|javascript).encode,eval函数,Execute函数,ExecuteStatement函数,createtextfile函数,opentextfile函数,savetofile函数,save&saveas函数,run函数,exec函数,shellexecute函数,create函数。

   最后多嘴一句,如果想用加密技术改变特征字符是行不通的,因为程序还会检查程序是否被加密,一般asp程序是不会加密的。

     二、实战

     如果是2003服务器则可以建立一个"nohack.asp"这样的文件夹,然后把asp木马改为非asp格式扔进这个目录里,可以避过专杀,而2000服务器可以采用添加应用程序扩展的方法,这两个都很简单,不会的朋友详见百度。我们来修改特征字符,用记事本打开asp木马,“编辑”-“替换”,例如wscript.shell可以改为wscript"&Tommie&".shell,shell.application改为sh"&T&"el"&o&"l."&m&"application,改好后“全部替换”,然后再修改下一处特征。

上一页  [1] [2] [3] [4] 

责任编辑:朱倩  联系方式  Email:朱倩
电话:51228163
  • 上一篇黑客:

  • 下一篇黑客:
  • (只显示最新5条。评论内容只代表网友观点,与本站立场无关!)
    姓 名:
    * 游客填写  ·注册用户
    主 页:
    评 分:
    1分 2分 3分 4分 5分
    评论内容:
    验证码: *
  • 请遵守《互联网电子公告服务管理规定》及中华人民共和国其他各项有关法律法规。
  • 严禁发表危害国家安全、损害国家利益、破坏民族团结、破坏国家宗教政策、破坏社会稳定、侮辱、诽谤、教唆、淫秽等内容的评论 。
  • 用户需对自己在使用本站服务过程中的行为承担法律责任(直接或间接导致的)。
  • 本站管理员有权保留或删除评论内容。
  • 评论内容只代表网友个人观点,与本网站立场无关。
  • 最新hack更新
    最新推荐资讯
    相关黑客
    安全检测网站实例图解
    网上不多见的免杀技巧
    菜鸟必懂木马连接原理
    隐形木马在系统中启动
    分享木马免杀技术经验
    社会工程学拿导航站
    木马技术发展趋势回顾
    DBO权限日志备份一句
    社会工程学拿导航站
    查杀模式和木马免杀方案
    最新会员软件
    最新推荐视频
    最新推荐动画

    Copyright @ 2005 77169.Net Inc. All rights reserved. 华夏黑客同盟 版权所有
    北京市电信通提供网络带宽

    mailto:webmaster@77169.net
    咨询QQ号:836982 / 59280880
    联系站长 QQ38588913
    热线电话: 86-10-67634029/676229433
    京ICP证041431号