我想知道空字节注入在PHP7中是否仍然是一个问题?
如果空字节注入在PHP7中是可利用的,那么我如何防止它?
谢谢。
发布于 2018-08-18 06:08:47
我不能完全确定是否所有相关函数都在PHP7中得到了修复。
file_exists has been fixed for sure。
在任何情况下,您都可以通过事先验证而不是盲目接受用户数据来防止它:
<?php
$file = $_GET['file'];
// Whitelisting possible values
switch ($file) {
case 'main':
case 'foo':
case 'bar':
include '/home/wwwrun/include/'.$file.'.php';
break;
default:
include '/home/wwwrun/include/main.php';
}
?>
有关更多信息,请参阅http://www.php.net/manual/en/security.filesystem.nullbytes.php
https://stackoverflow.com/questions/51903253
复制相似问题