Chinaunix首页 | 论坛 | 博客
  • 博客访问: 213346
  • 博文数量: 40
  • 博客积分: 316
  • 博客等级: 二等列兵
  • 技术积分: 840
  • 用 户 组: 普通用户
  • 注册时间: 2012-03-13 12:39
文章分类

全部博文(40)

文章存档

2014年(2)

2013年(28)

2012年(10)

分类: Python/Ruby

2013-01-04 01:29:15

short_open_tag     开启该选项,服务器支持 。 不开启,只能是。默认为off,改变之后
                                需重启web服务器。

allow_url_fopen    为off时, fopen('','r')会出错的。
                                                同样include,require,include_once,require_once等打开远程的文件时也会失败。eg:include(''),  但是include('/etc/passwd')是可以正常的

allow_url_include 开启可以url形式的伪协议,可以远程包含, 127.0.0.1/test.php?a=
                               不开启, 只能包含本地的文件, 127.0.0.1/test.php?a=/etc/passwd
                                                                           (如果有权限的话)
                                                     127.0.0.1/test.php?a=data:text/plain,alert('xss')
                                                             也不行。
eg:php://input
 16 if(1){
 17         $msg="POST /test.php?f=php://input HTTP/1.1\r\n";
 18         $msg.="Accept-Language: fr\r\n";
 19         $msg.="Content-Type: application/x-www-form-urlencoded\r\n";
 20         $msg.="Accept-Encoding: defalte\r\n";
 21         $msg.="User-Agent: Mozilla/4.0\r\n";
 22         $msg.="host: 127.0.0.1\r\n";
 23         $msg.="Content-length: 18\r\n";
 24         $msg.="Connection: Keep-Alive\r\n";
 25         $msg.="Cache-Control: no-cache\r\n";
 26         $msg.="\r\n";
 27         $msg.="\r\n";
 28 $fd = fsockopen('127.0.0.1', 80);
 29 fputs($fd,$msg);
 30 while(!feof($fd)){
 31         echo fgets($fd,1280);
 32 }      
 33 fclose($fd);
 34 }
 35 ?>
                                      note: 该选项只影响url中的伪协议形式,eg:即使为off,php文件中也可以用伪协议,只是url中不能用

open_basedir   将 PHP 所能打开的文件限制在指定的目录树,包括文件本身,可以有效的防止本地包含的攻击。
                           eg: open_basedir = /usr/local/apache2/htdocs
                                                 //php可以打开htdocs下的文件也可打开htdocs[随便什么附加]下的文件。
                                    open_basedir = /usr/local/apache2/htdocs/
                                                //如果以 ‘/’ 结束,则php只能访问htdocs下的文件。

display_error   为off是,错误和警告信息不显示在网页上。可以防止报路径等信息。
阅读(1538) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~