Answer the question
In order to leave comments, you need to log in
Chmod via web script?
There is a web server on Apache and PHP, isp. Not long ago it was hacked through vp. As a result, a very interesting script appeared there. With the help of a script, you can scroll through dericots, if the open_basedir parameter of the Apache does not limit it, then in general throughout the entire server. As a result, it becomes clear that this is an important parameter) 2nd why ah .. through it you can change the chmod rights to any files, upload, download, rename, and so on. Even if it has rights 444.. under any user.
How does it work? How to protect yourself from such a thing in the future? Tips in this situation, what to clean?. TP DC throws up his hands. :(
Answer the question
In order to leave comments, you need to log in
Unfortunately, protection against such attacks can add inconvenience to the development and testing of scripts / sites, but you can get used to it. I do this:
1) set the "open_basedir" variable on each site to the user's directory or folder with the site. For each site, I set the values \u200b\u200bthrough the php-fpm pool config.
If php works as an apache module, then this is done in the virtual host config with the following lines:
php_admin_value open_basedir "/var/www:/tmp"
php_admin_value disable_functions "popen, pclose, exec, passthru, shell_exec, system, proc_open, proc_close, mail, symlink"
disable_functions = "get_defined_constants,apache_get_modules,virtual,getmyinode,apache_get_version,apache_getenv,ini_restore,-openlog,-syslog,highlight_file,show_source,symlink,-ini_get_all,-phpinfo,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,exec,shell_exec,system,passthru,proc_open,popen,proc_close,proc_get_status,proc_nice,proc_terminate,leak,listen,chown,chgrp,apache_note,apache_setenv,closelog,debugger_off,debugger_on,define_sys,getmyuid,getmypid,diskfreespace,dl,posix_ctermid,posix_getcwd,posix_getegid,posix_geteuid,posix_getgid,posix_getgrgid,posix_getgrnam,posix_getgroups,posix_getlogin,posix_getpgid,posix_getpgrp,posix_getpid,posix,_getppid,posix_getpwnam,posix_getpwuid,posix_getrlimit,posix_getsid,posix_getuid,posix_isatty,posix_kill,posix_mkfifo,posix_setegid,posix_seteuid,posix_setgid,posix_setpgid,posix_setsid,posix_setuid,posix_times,posix_ttyname,posix_uname,expose_php,curl_exec,curl_multi_exec,-parse_ini_file,eval,link,putenv,-pack,gzinflate,gzuncompress"
<IfModule mpm_itk_module>
AssignUserId user1 user1
</IfModule>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question