Imagine a PHP toy application is vulnerable to including an absolute local file, for example.
<?php include($_GET['action']);
I tried the following query to use it:
POST /?action=php://input HTTP/1.1 Host: XXXXXXXXXXXXXXXXX Content-Length: 3 foo
This effectively performs include('php://input'); with the request body foo , so I expect it to print foo . However, I get the following error:
<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 />
What is the problem? Is this a PHP security feature? If so, can anyone point out the crucial part of the PHP source code that mitigates this?
source share