Home > php教程 > php手册 > body text

php包含远程文件的解释和用法

WBOY
Release: 2016-06-06 19:46:30
Original
1311 people have browsed it

欢迎进入Linux社区论坛,与200万技术人员互动交流 >>进入 php中包含远程文件allow_url_include的解释和用法: PHP常常因为它可能允许URLS被导入和执行语句被人们指责。事实上,这件事情并不是很让人感到惊奇,因为这是导致称为Remote URL Include vulnerabil

欢迎进入Linux社区论坛,与200万技术人员互动交流 >>进入

  php中包含远程文件allow_url_include的解释和用法:

  PHP常常因为它可能允许URLS被导入和执行语句被人们指责。事实上,这件事情并不是很让人感到惊奇,因为这是导致称为Remote URL Include vulnerabilities的php应用程序漏洞的最重要的原因之一。

  因为这个原因,许多安全研究人员建议在php.ini配置中禁用指向allow_url_fopen。不幸的是,许多推荐这种方法的人,并没有意识到,这样会破坏很多的应用并且并不能保证100%的解决remote URL includes以及他带来的不安全性。

  通常,用户要求在他们使用其他的文件系统函数的时候,php允许禁止URL包含和请求声明支持。

  因为这个原因,计划在PHP6中提供allow_url_include。在这些讨论之后,这些特性在php5.2.0 中被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 php5.2.0) urls.这些url形式,都可以非常简单的进行php代码注入。

  例1: Use php://input to read the POST data

  

  // Insecure Include

  // The following Include statement will

  // include and execute everything POSTed

  // to the server

  include "php://input";

  ?>

php包含远程文件的解释和用法

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!