风炫安全web安全学习第三十四节课 文件包含漏洞防御

风炫安全web安全学习第三十四节课 文件包含漏洞防御

文件包含防御

  • 在功能设计上不要把文件包含的对应文件放到前台去操作

  • 过滤各种../,https://, http://

  • 配置php.ini文件
    allow_url_fopen=off

    allow_url_include=off

    magic_quotes_gpc=on

  • 通过白名单策略
    topic.php,image.php

    file=topic.php

    $allow_file = [
       'topic.php',
       'image.php'
    ];
    if (in_array($_GET['file'], $allow_file)){
    
    }
    

参考:
http://blog.evalshell.com/2020/12/20/风炫安全web安全学习第三十四节课-文件包含漏洞防/

posted @ 2021-01-09 11:57  风炫安全  阅读(63)  评论(0编辑  收藏  举报