I'm wondering whether my architecture poses a security risk. Details:

  • The whole website is not ROOT owned but still, the APACHE user used instead has some pretty advanced permissions.

  • I have a folder "user_files" that may hold any kind of user files. For example, a ksh unix file.

  • My php.ini disables the exec php function (as well as some other sensitive functions)

My question is simple yet bears 2 aspects:

  1. could somebody execute the uploaded script?
  2. what is the magnitude of the risk? If the script is executed by apache I guess the maximum it could do is to delete all apache owned files of the server, right?

You disabling php's exec functions may help lock down php scripts from calling other scripts, such as the ksh script you describe. However, unless you disable users being able to upload php scripts, they could call damaging functions from php ( unless you disabled ALL of those too ).

If you can disable all dynamic scripts from being interpreted by apache for the users_files directory, you may be safer, but disable some of the functionality you desire for your users.

Depending on your distribution, and software you feel like installing and maintaing, I can think of one options.

Enable Apache's suEXEC features, so any non php, and other mod_language scripts run under another user account. Using php via a cgi interface, which if you can get php-fpm, would make running certain scripts as a separate user easier.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.