首页 | 注册 | 登录 | 搜索 | 标签 | 关于

PHP木马攻击的防御

1.防止php木马执行webshell

  打开safe_mode,

  在,php.ini中设置

  disable_functions= passthru,exec,shell_exec,system  

  二者选一即可,也可都选  

2.防止php木马读写文件目录  

  在php.ini中的

  disable_functions= passthru,exec,shell_exec,system  

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

  主要有

  fopen,mkdir,rmdir,chmod,unlink,dir

  fopen,fread,fclose,fwrite,file_exists

  closedir,is_dir,readdir.opendir

  fileperms.copy,unlink,delfile

  即成为

  disable_functions= passthru,exec,shell_exec,system,fopen,mkdir,rmdir,chmod,unlink,dir

  ,fopen,fread,fclose,fwrite,file_exists

  ,closedir,is_dir,readdir.opendir

  ,fileperms.copy,unlink,delfile

  ok,大功告成,php木马拿我们没辙了,^_^

  遗憾的是这样的话,利用文本数据库的那些东西就都不能用了。 

上一篇 :今天事还真多哦
下一篇 :测试你的杀毒软件到底多能干

本文链接:http://www.amxku.net/archives/435/

网友评论

http://www.cnibs.com/
by dd on 2006-04-05, 22:36 引用 #1
防止php木马

防止php木马
首先修改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






  closedir,is_dir,readdir.opendir






  fileperms.copy,unlink,delfile






  即成为






  disable_functions= passthru,exec,shell_exec,system,fopen,mkdir,rmdir,chmod,unlink,dir






  ,fopen,fread,fclose,fwrite,file_exists






  ,closedir,is_dir,readdir.opendir






  ,fileperms.copy,unlink,delfile






ok,大功告成,php木马拿我们没辙了,^_^


需要注意的是,上面的排列方式不要更改,改后可能会出错。个人觉得一般不用这些设置,NFTS的目录设置权限应该可以达到以上效果,本人对PHP没有什么研究,如果有错误的话请高手指点.
by je on 2006-04-10, 15:31 引用 #2

发表评论

评论内容: