• Our team is looking to connect with folks who use email services provided by Plesk, or a premium service. If you'd like to be part of the discovery process and share your experiences, we invite you to complete this short screening survey. If your responses match the persona we are looking for, you'll receive a link to schedule a call at your convenience. We look forward to hearing from you!
  • We are looking for U.S.-based freelancer or agency working with SEO or WordPress for a quick 30-min interviews to gather feedback on XOVI, a successful German SEO tool we’re looking to launch in the U.S.
    If you qualify and participate, you’ll receive a $30 Amazon gift card as a thank-you. Please apply here. Thanks for helping shape a better SEO product for agencies!
  • The BIND DNS server has already been deprecated and removed from Plesk for Windows.
    If a Plesk for Windows server is still using BIND, the upgrade to Plesk Obsidian 18.0.70 will be unavailable until the administrator switches the DNS server to Microsoft DNS. We strongly recommend transitioning to Microsoft DNS within the next 6 weeks, before the Plesk 18.0.70 release.
  • The Horde component is removed from Plesk Installer. We recommend switching to another webmail software supported in Plesk.

Disable shell command from PHP for all domains?

J

j Zim

Guest
It seems that a customer was able to upload a php file into the /tmp directory and then call a sh command (php <name of its file.php>) to execute the script.

At the moment I have no idea from what domain this is done but as a quick fix I would like to disable the possibility to execute sh/shell command for all my customers using PHP script.

Is that possible changing the php5.ini file or doing it this way I'll have some trouble with Plesk or other admin script (like phpmyadmin, etc.)?

Thanks in advance for your help.
JZ
 
Last edited by a moderator:
in php.ini edit this line

;disable_functions =

to

disable_functions =exec,passthru,shell_exec,system,proc_open,popen,curl_exec,curl_multi_exec,parse_ini_file,show_source

or any other restriction you want to apply.
 
Ivalics,
Thanks for your reply. I know the "disable_functions" config, I posted my question to know if it can cause some trouble to admin interface like plesk, phpmyadmin, etc. Did you setup your Plesk server this way?
Regards,
 
Yes, we use like this. Better to have like this, then to allow some exec functions. still can be avoided, but for that also exist ASL with mod_security.
 
Thanks for this additional info, php.ini config changed! Could you let me know what you mean with "ASL with mod_security"? Additional setup/config on a website based to allow exec for certain domains?
 
I just got a call from a customer... webmail cannot send email! Looks like horde is using popen to use sendmail. I cannot get horde working changing its config, so I had to remove popen from disable_functions.
 
Yes, popen can create issues with webmail, I know there is a workaround, but I cannot remember where I saw.
 
Breun was the one who posted the answer. He said to edit /etc/psa-horde/horde/conf.php (Plesk 8) or /etc/psa/webmail/horde/horde/conf.php (Plesk 9 and, I assume Plesk 10?)

1) Change $conf['mailer']['type'] from 'sendmail' to 'smtp'
2) Add the following line:
$conf['mailer']['params']['host'] = 'localhost';

In this way, horde will use SMTP and no longer needs popen to be enabled.

Faris.
 
I did the suggested changes but I'm still gettin error about sendmail! Seems like my changes are ignored. What do I need to restart after the changes are done? I did a "service apache2 restart".
 
Back
Top