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 南大pa1 小游戏没有界面,并且报了如下错误,尝试过换显卡驱动,但是好像不行
  • ¥15 没有证书,nginx怎么反向代理到只能接受https的公网网站
  • ¥50 成都蓉城足球俱乐部小程序抢票
  • ¥15 yolov7训练自己的数据集
  • ¥15 esp8266与51单片机连接问题(标签-单片机|关键词-串口)(相关搜索:51单片机|单片机|测试代码)
  • ¥15 电力市场出清matlab yalmip kkt 双层优化问题
  • ¥30 ros小车路径规划实现不了,如何解决?(操作系统-ubuntu)
  • ¥20 matlab yalmip kkt 双层优化问题
  • ¥15 如何在3D高斯飞溅的渲染的场景中获得一个可控的旋转物体
  • ¥88 实在没有想法,需要个思路