MiniBlog 3.0 漏洞网
一. 经典的上传漏洞
漏洞存在与upfile.asp
<!--#include file="include/conn.asp" -->
<!--#include file="include/const.asp" -->
<!--#include FILE="include/cb_upload.asp"-->
<%
dim filebleid,upload,formPath,formName,file,fileExt,filename,userface
filebleid=Caluoob.UserID
set upload=new upload_5xSoft ''建立上传对象
formPath=upload.form("filepath")
''在目录后加(/)
if right(formPath,1)<>"/" then formPath=formPath&"/"
for each formName in upload.file ''列出所有上传了的文件
set file=upload.file(formName) ''生成一个文件对象
if file.filesize<100 then
response.write "<font size=2>请先选择你要上传的图片 [ <a href=# onclick=history.go(-1)>重新上传</a> ]</font>"
response.end
end if
if file.filesize>51200then
response.write "<font size=2>图片大小超过了限制 [ <a href=# onclick=history.go(-1)>重新上传</a> ]</font>"
response.end
end if
fileExt=lcase(right(file.filename,4))
if fileEXT<>".gif" and fileEXT<>".jpg" then
response.write "<font size=2>文件格式不对 [ <a href=# onclick=history.go(-1)>重新上传</a> ]</font>"
response.end
end if
filename="face/"&filebleid&fileExt
userface=filebleid&fileExt
if file.FileSize>0 then ''如果 FileSize > 0 说明有文件数据
file.SaveAs Server.mappath(filename) ''保存文件
end if
Caluoob.Execute("update [cb_user] set userface='"&userface&"' where id="&filebleid)
set file=nothing
next
set upload=nothing
Response.redirect "settings.asp"
%>
漏洞核心代码是
if fileEXT<>".gif" and fileEXT<>".jpg" then
response.write "<font size=2>文件格式不对 [ <a href=# onclick=history.go(-1)>重新上传</a> ]</font>"
response.end
这里我问了几个人 我是认为 提交1.jpg.asa是可行的 但是 if fileEXT<>".gif" and fileEXT<>".jpg" 这句话很绝 直接kill了任何非gif和jpg的后缀 就连上传 .jpg+空格 也不行
这里就可以通过nc来上传了 哈~ 没错 就是截断~ 只要文件不超过51200kb就满足条件 我想没有什么马儿是超过51200kb的把~这里的目录可以自定义 所以又可以不截断得提交一个文件并新建一文件夹(这里大家都想到2003解析漏洞了把) 对 就是建立1.asp文件夹 随便上传一个马儿到里面 2003都会把他当成asp解析的
二。经典的注入
这系统多么精彩 啥注入都有、、 、post get cookies都有。。。
1.过滤不严:
过滤方面 程序员还是想到了 但是不完整 造成我们可以构造语句去突破 哈哈。
以下是do.asp代码
<%
Dim id,myrs,model,myfreinds
model=Replace(Request.QueryString("m"),"'","''")
id=Replace(ValidInteger(Request("in")),"'","''")
看到model变量如何过来的把 。。 简单用个replace函数把'过滤了 但是。。。我们还可以提交 ; 嘛
还有在admin_reing.asp里面:
Dim Action,model,rs,ingid
Action=Request("action")
model=CheckStr(Request("model"))
ingid=CheckStr(Request("ingid"))
action变量直接提交到服务端 危险。。
这里的model变量不一样了 不是之前那个do.asp的用get提交了 可是今次多了一个函数Checkstr过滤他们。。 俺们先不要绝望 我们去function.asp看看这个函数怎么写的:
'------------------------------------
Function CheckStr(ChkStr)
Dim Str:Str=ChkStr
If IsNull(Str) Then
CheckStr = ""
Exit Function
End If
Str = Replace(Str, "&", "&")
Str = Replace(Str,"'","'")
Str = Replace(Str,"""",""")
CheckStr=Str
End Function
'------------------------------------
过滤也不严 绕过之,。。 又一注入
三。经典的cookies注入。 我们看看: (CB_admin.asp里面)
AdminName=Request.cookies(CookieName&"CaluoobAdmin")("AdminName")
AdminWord=Request.cookies(CookieName&"CaluoobAdmin")("AdminWord")