php://input allow_url_include,php allow_url_include的应用和解释_PHP教程
因?yàn)檫@個(gè)原因,許多安全研究人員建議在php.ini配置中禁用指向allow_url_fopen。不幸的是,許多推薦這種方法的人,并沒有意識(shí)到,這樣會(huì)破壞很多的應(yīng)用并且并不能保證100%的解決remote URL includes以及他帶來的不安全性。
通常,用戶要求在他們使用其他的文件系統(tǒng)函數(shù)的時(shí)候,php允許禁止URL包含和請(qǐng)求聲明支持。
因?yàn)檫@個(gè)原因,計(jì)劃在PHP6中提供allow_url_include。在這些討論之后,這些特性在php5.2.0 中被backported?,F(xiàn)在大多數(shù)的安全研究人員已經(jīng)改變了他們的建議,只建議人們禁止allow_url_include。
不幸的是,allow_url_fopen和allow_url_include并不是導(dǎo)致問題的原因。一方面來說在應(yīng)用中包含本地文件仍然是一件足夠危險(xiǎn)的事情,因?yàn)楣粽呓?jīng)常通過sessiondata, fileupload, logfiles,...等方法獲取php代碼………
另一方面allow_url_fopen和allow_url_include只是保護(hù)了against URL handles標(biāo)記為URL.這影響了http(s) and ftp(s)但是并沒有影響php或date(new in php5.2.0) urls.這些url形式,都可以非常簡(jiǎn)單的進(jìn)行php代碼注入。
Example 1: 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 2: Use data: to Include arbitrary code
<?php
// Insecure Include
// The following Include statement will
// include and execute the base64 encoded
// payload. Here this is just phpinfo()
include "data:;base64,PD9waHAgcGhwaW5mbygpOz8+";
?>
把這些放到我們的運(yùn)算里面將會(huì)非常明顯的發(fā)現(xiàn)既不是url_allow_fopen也不是url_allor_include 被保障。這些只是因?yàn)檫^濾器很少對(duì)矢量進(jìn)行過濾。能夠100%解決這個(gè)URL include vulnerabilities的方法是我們的Suhosin擴(kuò)展.
http://www.bkjia.com/PHPjc/321717.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/321717.htmlTechArticle因?yàn)檫@個(gè)原因,許多安全研究人員建議在php.ini配置中禁用指向allow_url_fopen。不幸的是,許多推薦這種方法的人,并沒有意識(shí)到,這樣會(huì)破壞...
總結(jié)
以上是生活随笔為你收集整理的php://input allow_url_include,php allow_url_include的应用和解释_PHP教程的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: java fileupload 文件_j
- 下一篇: php jsonp 设置,php 输出