风炫安全web安全学习第三十四节课 文件包含漏洞防御
文件包含防御
-
在功能设计上不要把文件包含的对应文件放到前台去操作
-
过滤各种../,https://, http://
-
配置php.ini文件
allow_url_fopen=offallow_url_include=off
magic_quotes_gpc=on
-
通过白名单策略
topic.php,image.phpfile=topic.php
$allow_file = [ 'topic.php', 'image.php' ]; if (in_array($_GET['file'], $allow_file)){ }
参考:
http://blog.evalshell.com/2020/12/20/风炫安全web安全学习第三十四节课-文件包含漏洞防/