问候,我希望让我的小程序安全,以便潜在的恶意用户无法查看服务器上的敏感文件。
$path = "/home/gsmcms/public_html/central/app/webroot/{$_GET['file']}";
if(file_exists($path)) {
echo file_get_contents($path);
} else {
header('HTTP/1.1 404 Not Found');
}
在我的脑海中,我知道诸如“../../../../../../etc/passwd”之类的输入会很麻烦,但想知道我应该期待哪些其他恶意输入以及如何防止他们。