当前位置:WooYun >> 漏洞信息

漏洞概要 关注数(24) 关注此漏洞

缺陷编号:wooyun-2014-082365

漏洞标题:某建站系统文件包含+登陆伪造漏洞

相关厂商:凡诺广告传媒中心

漏洞作者: 路人甲

提交时间:2014-11-10 12:35

修复时间:2015-02-08 12:36

公开时间:2015-02-08 12:36

漏洞类型:SQL注射漏洞

危害等级:高

自评Rank:18

漏洞状态:未联系到厂商或者厂商积极忽略

漏洞来源: http://www.wooyun.org,如有疑问或需要帮助请联系 [email protected]

Tags标签:

4人收藏 收藏
分享漏洞:


漏洞详情

披露状态:

2014-11-10: 积极联系厂商并且等待厂商认领中,细节不对外公开
2015-02-08: 厂商已经主动忽略漏洞,细节向公众公开

简要描述:

123

详细说明:

http://www.mycodes.net/25/2089.htm
源码作者: 凡诺广告传媒中心 下载次数: 138500
官网http://www.pcfinal.cn/
百度关键词 程序开发:凡诺网络

QQ图片20141107142043.jpg


QQ图片20141107142109.jpg


案例说明;
http://www.wangluojiaoshi.com/admin/cms_login.asp
http://www.tjtongxun.com/admin/cms_login.asp
http://www.rj-bz.com/admin/cms_login.asp
http://www.jlsty.com/admin/cms_login.asp
http://www.texcrew.com/admin/cms_login.asp
http://www.51yyc.com/admin/cms_login.asp
http://www.baigonghuashi.cn/admin/cms_login.asp
http://www.cqxhy.com/admin/cms_login.asp
http://www.hd9168.com/admin/cms_login.asp
http://www.86229222.com/admin/cms_login.asp
http://www.wxftdz.com/admin/cms_login.asp
http://ci.zju.edu.cn/admin/cms_login.asp(可爱的浙江大学...)
还有相当多啊、

漏洞证明:

一般直接从数据库交互的地方看起
/admin/index.asp

<%
2
Response.Redirect("cms_login.asp")
3
%>


/admin/cms_login.asp

<!--#include file="../_system/conn.asp"-->
02
<!--#include file="../_system/library.asp"-->
03
<%
04
If rf("submit") = "管理登录" Then
05
Call null_back(rf("login_name"), "用户名不能为空!")
06
Call null_back(rf("login_password"), "密码不能为空!")
07
Call null_back(rf("login_verifycode"), "验证码不能为空!")
08
If CStr(Session("CheckCode")) <> CStr(Request.Form("login_verifycode")) Then
09
Call alert_href("验证码错误!","cms_login.asp")
10
End If
11
Set rs = ado_query("select * from cms_admin where a_enable = 1 and a_name='"&str_safe(request.Form("login_name"))&"' and a_password='"&md5(str_safe(request.Form("login_password")))&"'")
12
response.write "select * from cms_admin where a_enable = 1 and a_name='"&str_safe(request.Form("login_name"))&"' and a_password='"&md5(str_safe(request.Form("login_password")))&"'"
13
If Not rs.EOF Then
14
Response.Cookies("admin_check") = request.Form("login_name")
15
rs.close
16
set rs = nothing
17
response.redirect "cms_welcome.asp"
18
Else
19
rs.close
20
set rs = nothing
21
Call alert_href("错误提示:用户名或密码错误,请核对后重新输入!","cms_login.asp")
22
End If
23
End If
24
%>


可以看到输入点被str_safe处理过
找到包含文件,conn 和 library去寻找函数

Function str_safe(byval Str)
02
If IsNull(Str) Then Exit Function
03
Str = str_isafe(Str)
04
Str = Replace(Str, "<", "<")
05
Str = Replace(Str, ">", ">")
06
Str = Replace(Str, """", """)
07
str_safe = Str
08
End Function
09
Function str_editor(str)
10
If IsNull(Str) Then Exit Function
11
str = Replace(str, "&", "&")
12
str = Replace(str, "<", "<")
13
str = Replace(str, ">", ">")
14
str = Replace(str, """", """)
15
str_editor = str
16
End Function
17

18
'函数:SQL关键词过滤 用于获取含HTML标签的内容
19

20
Function str_isafe(byval Str)
21
If IsNull(Str) Then Exit Function
22
Str = Replace(Str, "select ", "select ", 1, -1, 1)
23
Str = Replace(Str, "insert ", "insert ", 1, -1, 1)
24
Str = Replace(Str, "update ", "update ", 1, -1, 1)
25
Str = Replace(Str, "delete ", "delete ", 1, -1, 1)
26
Str = Replace(Str, " and", " and ", 1, -1, 1)
27
Str = Replace(Str, "drop table", "drop table", 1, -1, 1)
28
Str = Replace(Str, "script", "script")
29
Str = Replace(Str, "*", "*")
30
Str = Replace(Str, "%", "%")
31
Str = Replace(Str, "'", "''")
32
str_isafe = Str
33
End Function


感觉过滤挺好的,好像没戏了,真心好像没戏了,我去,然后看到cookie验证的,看看后台能伪造登录不
于是来到
/admin/cms_welcome.asp看到包含了
<!--#include file="inc_global.asp"-->
<!--#include file="../_system/function.asp"-->
当我看到./_system/function.asp就无语了

<%
02
'==========获取当前账户相关信息==========
03
'response.write Request.Cookies("admin_check")
04
If inull(Request.Cookies("admin_check")) Then
05
Response.Redirect("index.asp")
06
End If
07
Set rs_gap = ado_query("select * from cms_admin where a_name = '"&Request.Cookies("admin_check")&"'")
08
If rs_gap.EOF Then
09
Response.Redirect("index.asp")
10
End If
11
admin_name = rs_gap("a_name")
12
'response.write admin_name
13
admin_truename = rs_gap("a_truename")
14
admin_penname = rs_gap("a_penname")
15
admin_purview = rs_gap("a_purview")
16
arr_admin_purview = Split(admin_purview, ",")
17
rs_gap.Close
18
Set rs_gap = Nothing


前面所有的函数,所有的判断都是狗屁,这里直接读cookie了,啥过滤没有
直接来到 /admin/cms_welcome.asp firebug一下 admin_check 为admin 我觉得一般不会改
就算改的话也可以继续构造语句,因为什么都没过滤
利用:
/admin/cms_welcome.asp
自己添加cookie admin_check的值为 admin 刷新即可越权访问后台
后台还可以直接getshell

修复方案:

1

版权声明:转载请注明来源 路人甲@乌云


漏洞回应

厂商回应:

未能联系到厂商或者厂商积极拒绝