PHP백도어 / 웹쉘 방지

안녕하세요? WEBPD.NET 서버운영팀입니다.

1.httpd.conf 파일을 수정하여 php프로그램이 특정폴더에서 벗어나는것을 방지. 만약 웹폴더가 /home/user/public_html 이라면 httpd.conf 파일에 아래와같은 한줄을 추가한다.

 

 php_admin_value open_basedir /home/user/public_html

 

이렇게 되면 만약 php프로그램이 /home/user/public_html 폴더를 벗어나려면 아래와같은 에러가 발생한다.

Warning: open_basedir restriction in effect. File is in wrong directory in /home/user/public_html/file.php on line 6

 

 2, PHP백도어의 Webshell 실행을 제한

   php.ini 파일에서 safe_mode 를 on 으로 설정한다. 혹은 아래와같이 disable_functions 옵션에 passthru, exec, shell_exec, system 함수를 넣어준다.

 

   disable_functions= passthru,exec,shell_exec,system

 

 3, PHP백도어의 폴더 쓰기/읽기 제한

   php.ini파일에 아래와같은 금지함수들을 추가한다.

 

 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

Was this answer helpful? 3 Users Found This Useful (3 Votes)