设为首页
加入收藏
站内地图
旧版入口
当前位置:首页 > 网站运营 > 建站心得

PHP木马攻击的防御之道

作者:佚名 出处: 时间:04-02 点击:

内容载入中...

1.防止跳出web目录  
  首先修改httpd.conf,如果你只允许你的PHP脚本程序在web目录里操作,还可以修改httpd.conf文件限制PHP的操作路径。比如你的web目录是/usr/local/apache/htdoCS,那么在httpd.conf里加上这么几行:  

  PHP_admin_value open_basedir /usr/local/apache/htdoCS
  

  这样,如果脚本要读取/usr/local/apache/htdoCS以外的文件将不会被允许,如果错误显示打开的话会提示这样的错误:

  Warning: open_basedir restriction in effect. File is in wrong directory in

  /usr/local/apache/htdoCS/open.PHP on line 4

  等等。

  2.防止PHP木马执行webshell

  打开safe_mode,

  在,PHP.ini中设置

  disable_functions= passthru,exec,shell_exec,system  

  二者选一即可,也可都选  

  3.防止PHP木马读写文件目录  

  在PHP.ini中的

  disable_functions= passthru,exec,shell_exec,system  

  后面加上PHP处理文件的函数

  主要有

  fopen,mkdir,rmdir,chmod,unlink,dir

  fopen,fread,fclose,fwrite,file_exists


收藏本文:
】【打印页面】【推荐给朋友】【关闭窗口
推荐信息