PHP常常因为它可能允许URLS被导入和执行语句被人们指责事实上这件事情并不是很让人感到惊奇因为这是导致称为Remote URL Include vulnerabilities的php应用程序漏洞的最重要的原因之一 因为这个原因许多安全研究人员建议在phpini配置中禁用指向allow_url_fopen不幸的是许多推荐这种方法的人并没有意识到这样会破坏很多的应用并且并不能保证%的解决remote URL includes以及他带来的不安全性 通常用户要求在他们使用其他的文件系统函数的时候php允许禁止URL包含和请求声明支持 因为这个原因计划在PHP中提供allow_url_include在这些讨论之后这些特性在php 中被backported现在大多数的安全研究人员已经改变了他们的建议只建议人们禁止allow_url_include 不幸的是allow_url_fopen和allow_url_include并不是导致问题的原因一方面来说在应用中包含本地文件仍然是一件足够危险的事情因为攻击者经常通过sessiondata fileupload logfiles等方法获取php代码……… 另一方面allow_url_fopen和allow_url_include只是保护了against URL handles标记为URL这影响了http(s) and ftp(s)但是并没有影响php或date(new in php) urls这些url形式都可以非常简单的进行php代码注入
Example : Use php://input to read the POST data <?php // Insecure Include // The following Include statement will // include and execute everything POSTed // to the server include "php://input"; ?> Example : Use data: to Include arbitrary code <?php // Insecure Include // The following Include statement will // include and execute the base encoded // payload Here this is just phpinfo() include "data:;basePDwaHAgcGhwaWmbygpOz+"; ?> 把这些放到我们的运算里面将会非常明显的发现既不是url_allow_fopen也不是url_allor_include 被保障这些只是因为过滤器很少对矢量进行过滤能够%解决这个URL include vulnerabilities的方法是我们的Suhosin扩展 |