donglei1699 2011-05-06 08:20
浏览 117
已采纳

Apache中auto_prepend_file的安全风险?

I've implemented a PHP auto_prepend_file in Apache's httpd.conf file to password protect every page on the server. Let's assume the the prepended file is properly coded and secured. Are there any serious security risks to using an auto_prepend_file method? I'm worried this opens up some sort of cross scripting attack or access can spoofed. Thanks for the help :)

In httpd.conf:

php_value auto_prepend_file "path/to/application/auth/include/secure.inc"
  • 写回答

2条回答 默认 最新

  • doulu1907 2011-05-06 08:25
    关注

    As long as your script die() s properly if the user is not authenticated (also after header() redirects, very important!) there is no fundamental problem I can see with this.

    The manual doesn't give much reason to worry either (emphasis mine):

    The file is included as if it was called with the require() function, so include_path is used.

    just be careful to always use an absolute path to avoid glitches with relative paths.

    The only attack that I can think of is injecting a .htaccess file somewhere underneath the directory root that cancels the INI setting by setting

    php_value auto_prepend_file none
    

    so you should be careful not to accept file names for uploaded files from the user without filtering, for example.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 抖音咸鱼付款链接转码支付宝
  • ¥15 ubuntu22.04上安装ursim-3.15.8.106339遇到的问题
  • ¥15 求螺旋焊缝的图像处理
  • ¥15 blast算法(相关搜索:数据库)
  • ¥15 请问有人会紧聚焦相关的matlab知识嘛?
  • ¥15 网络通信安全解决方案
  • ¥50 yalmip+Gurobi
  • ¥20 win10修改放大文本以及缩放与布局后蓝屏无法正常进入桌面
  • ¥15 itunes恢复数据最后一步发生错误
  • ¥15 关于#windows#的问题:2024年5月15日的win11更新后资源管理器没有地址栏了顶部的地址栏和文件搜索都消失了