加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > PHP教程 > 正文

为什么include(‘php:// input’)不起作用?

发布时间:2020-12-13 18:00:52 所属栏目:PHP教程 来源:网络整理
导读:想象一下,玩具 PHP应用程序容易受到绝对本地文件包含的影响,例如 ?php include($_GET['action']); 我尝试了以下请求来利用它: POST /?action=php://input HTTP/1.1Host: XXXXXXXXXXXXXXXXXContent-Length: 3foo 这有效地执行include(‘php:// input’);请
想象一下,玩具 PHP应用程序容易受到绝对本地文件包含的影响,例如
<?php include($_GET['action']);

我尝试了以下请求来利用它:

POST /?action=php://input HTTP/1.1
Host: XXXXXXXXXXXXXXXXX
Content-Length: 3

foo

这有效地执行include(‘php:// input’);请求body foo,所以我希望它打印foo.但是,我收到以下错误

<br />
<b>Warning</b>:  include(php://input): failed to open stream: operation failed in <b>XXXXXXXXXXXXXXXXX</b> on line <b>12</b><br />
<br />
<b>Warning</b>:  include(): Failed opening 'php://input' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in <b>XXXXXXXXXXXXXXXXXXX</b> on line <b>12</b><br />

这是什么问题?这是PHP安全功能吗?如果是这样,有人可以指向缓解此问题的PHP源代码的负责部分吗?

我在 Gustek的帮助下找到了答案.显然php://输入属于allow_url_include的重写,而例如php:// filter不是:

Restricted by allow_url_include: php://input,php://stdin,php://memory and php://temp only.

资料来源:Docs for php:// URL handler

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读