Title: ASP ewebeditor v3.8 Column Directory Vulnerability (other version for test)
Vulnerability file: asp/browse.asp
Vulnerability Generation:
Sub Initparam ()
stype = UCase (Trim (Request.QueryString ("type"))) sstylename = Trim (Request.QueryString ("style")) scusdir = Trim (Request.QueryString ("Cusdir")) dim I, astyleconfig, bvalidstyle bvalidstyle = False for i = 1 to Ubound (Astyle) astyleconfig = Split (Astyle (i), "| | |") if Lcase (sStyleName) = Lcase ( Astyleconfig (0)) Then bvalidstyle = True exit for end If next if BValidStyle = False Then Outscript ("alert (' Invalid Style. ')") end If sbaseurl = Astyleconfig ( ) Nallowbrowse = CLng (Astyleconfig ()) ncusdirflag = CLng ( Astyleconfig ()) if nallowbrowse <> 1 Then outscript ("Alert" (' Do not allow browse! ') ") &nbSp; end If if Ncusdirflag <> 1 Then scusdir = "" else scusdir = Replace (Scusdir, "", "/") if Left (sCusDir, 1) = '/"or left ( Scusdir, 1) = "." Or Right (scusdir, 1) = "." Or InStr (Scusdir, "./") > 0 or InStr (Scusdir, "/.") > 0 Or InStr (scusdir, "//") > 0 Then scusdir = "" else &NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBsp; if Right ( Scusdir, 1 <> "/" Then Scusdir = Scusdir & "/" end If end If end If suploaddir = astyleconfig (3) if Left (Suploaddir, 1) <> "/" Then suploaddir = ".. /"& Suploaddir &nbsP; end If select Case Sbaseurl case "0" scontentpath = Astyleconfig case "1" scontentpath = Relativepath2rootpath (Suploaddir) case "2" scontentpath = RootPath2DomainPath (Relativepath2rootpath (Suploaddir)) end Select suploaddir = suploaddir & Scusdir scontentpath = Scontentpath & Scusdir select case Stype case "FILE" sallowext = "" case "MEDIA" sallowext = "rm|mp3|wav|mid| Midi|ra|avi|mpg|mpeg|asf|asx|wma|mov " case" FLASH sallowext = "SWF" case Else sallowext = "Bmp|jpg|jpeg|png|gif" end Select scurrdir = Suploaddir sdir = Trim (Request ("dir")) ' 1. Suppose dir=. /' 2. Suppose dir=...//' 3. Suppose dir=...../// &Nbsp; sdir = Replace (Sdir, "", "/") ' Filter 1 sdir = Replace (Sdir, "... /"," "") ' Filter 2 ' 1. Here it is filtered. sdir = Replace (Sdir, "./", "") ' Filter 3 ' 2 to here also be power up ' 3 to be here. /Now. More fun to spare! Like a lot of CMS this filtered. [/color] if sdir <> "" Then if Checkvaliddir (Server.Mappath (SUploadDir & sdir) = True Then scurrdir = suploaddir & Sdir & "/" else sdir = "" end If end If End Sub