欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

PHP 木馬攻擊的防御設(shè)置方法

 更新時間:2009年10月11日 13:33:47   作者:  
本文通過介紹一些技巧介紹了針對PHP木馬攻擊的防御之道,通過這些方面您能夠更好的防范木馬程式。
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木馬執(zhí)行webshell
  打開safe_mode,
  在,php.ini中配置
  disable_functions= passthru,exec,shell_exec,system
  二者選一即可,也可都選
  3、防止php木馬讀寫文檔目錄
  在php.ini中的
  disable_functions= passthru,exec,shell_exec,system
  后面加上php處理文檔的函數(shù)
  主要有
  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木馬拿我們沒轍了,遺憾的是這樣的話,利用文本數(shù)據(jù)庫的那些東西就都不能用了。
  假如是在windos平臺下搭建的apache我們還需要注意一點,apache默認運行是system權(quán)限,這很恐怖,這讓人感覺很不爽.那我們就給apache降降權(quán)限吧。
  net user apache fuckmicrosoft /add
  net localgroup users apache /del
  ok.我們建立了一個不屬于任何組的用戶apche。
  我們打開電腦管理器,選服務(wù),點apache服務(wù)的屬性,我們選擇log on,選擇this account,我們填入上面所建立的賬戶和密碼,重啟apache服務(wù),ok,apache運行在低權(quán)限下了。

  實際上我們還能夠通過配置各個文檔夾的權(quán)限,來讓apache用戶只能執(zhí)行我們想讓他能干的事情,給每一個目錄建立一個單獨能讀寫的用戶。這也是當(dāng)前很多虛擬主機提供商的流行配置方法哦,但是這種方法用于防止這里就顯的有點大材小用了。

相關(guān)文章

最新評論