ningleesherry 发表于 2017-3-26 12:45:56

PHP文件包含(include)致命漏洞

  假如你的网站目录下有个这样的文件:
<?php
$file=$_GET['f'];
$file=str_replace(".","",$file);
include($file.".jpg");

你会觉得存在致命漏洞么,比如我想让最后一句变成 include(test.php);你觉得有可能吗?
其实很简单,除了.用于标识文件扩展名之外,还可以用 “,地址栏输入 ?f=test”php%00 就可以达到目的了,%00是ascii码为0的字符,在这里会产生截断,而 test”php,被include当成了test.php了。
页: [1]
查看完整版本: PHP文件包含(include)致命漏洞