Community Forums
Connect with us on LinkedIn
+ Reply to Thread
Results 1 to 12 of 12
  1. #1
    Member
    Join Date
    Sep 2003
    Posts
    11

    Default URGENT: How do you prevent users from executing system calls with php/perl scripts ?

    Hi everyone

    The topic pretty much says everything. Is there a way to prevent users(customers) from executing system calls with php or cgi scripts ? is it even possible ?

    a friend of mine wrote a little c program which simply uses all available ram and uploaded it via ftp (just as a client could do). and startet it via php. i had to request a manual reboot of my box, since i wasn't able to stop the script. absolutely nothing worked anymore. (i wasn't even able to login as root via ssh, because there wasn't enough memory available for this process)

    so...is there a solution for this ? i don't want anyone to be able to execute shell commands, if shell access is disabled for his/her account.

    thanks for any help

    guschi

  2. #2
    cPanel Partner NOC cPanel Partner NOC Badge
    Join Date
    Jun 2003
    Posts
    647

    Default

    You can put "exec" and any other functions you would like to disable in this line :

    Code:
    ; This directive allows you to disable certain functions for security reasons.
    ; It receives a comma-delimited list of function names. This directive is
    ; *NOT* affected by whether Safe Mode is turned On or Off.
    disable_functions =

  3. #3
    Member
    Join Date
    Sep 2003
    Posts
    11

    Default

    great ! thank you so much. now i can sleep peaceful

  4. #4
    cPanel Partner NOC cPanel Partner NOC Badge
    Join Date
    Jun 2003
    Posts
    647

    Default

    I failed to mention, this belongs in your php.ini, although you might have figured that out

  5. #5
    Member
    Join Date
    Sep 2003
    Posts
    11

    Default

    yep figured it out myslef ... but what i couldn't figure out....which php.ini is the "used" one ?

    /usr/lib/php.ini
    /usr/local/lib/php.ini
    /usr/local/cpanel/3rdparty/etc/php.ini
    /usr/local/cpanel/3rdparty/lib/php.ini


    i would guess it's /usr/lib/php.ini ...right ?

  6. #6
    cPanel Partner NOC cPanel Partner NOC Badge
    Join Date
    Jun 2003
    Posts
    647

    Default

    The best way to find out is to do a php info page.

    Code:
    <?php info()>
    It'll tell you which one is used..

  7. #7
    Member
    Join Date
    Sep 2003
    Posts
    11

    Default

    *lol stupid me....should have figured that out myself

    thanks again

  8. #8
    Member
    Join Date
    Aug 2003
    Posts
    39

    Default

    That or use this app:

    http://www.rfxnetworks.com/prm.php

    Shut down any program/script that takes up more then an allowed percentage of cpu or memory.

    That lets me sleep even better.

  9. #9
    Member casey's Avatar
    Join Date
    Jan 2003
    Location
    If there is trouble, it will find me
    Posts
    2,336

    Default

    Originally posted by GetWired
    That or use this app:

    http://www.rfxnetworks.com/prm.php

    Shut down any program/script that takes up more then an allowed percentage of cpu or memory.

    That lets me sleep even better.
    Very cool. Are the default values okay for shared servers?
    In particular, I notice that fantastico updates use quite a bit of resources for about 2 minutes. I don't want fantastico getting broken...
    Last edited by casey; 02-15-2004 at 05:14 AM.

  10. #10
    Member
    Join Date
    Mar 2003
    Posts
    160

    Default

    I heard that the user can upload a php.ini to there home directory and php will use that. Not sure if it is true or not but I think I read that in a phpsuexec post somewhere.

  11. #11
    Member casey's Avatar
    Join Date
    Jan 2003
    Location
    If there is trouble, it will find me
    Posts
    2,336

    Default

    Originally posted by rsaylor
    I heard that the user can upload a php.ini to there home directory and php will use that. Not sure if it is true or not but I think I read that in a phpsuexec post somewhere.
    It is true if you are using phpsuexec. If you are using the apache module, then they cannot do that, although they can change a few settings with a .htaccess file in that case.

  12. #12
    Member
    Join Date
    Aug 2003
    Posts
    39

    Default

    You can add fantastico or any other program on the safelist if you're worried about it being killed.

    I never had a problem with it, so i'd say just leave it as it is unless you get problems. Default values are fine.

Similar Threads & Tags
Similar threads

  1. Replies: 4
    Last Post: 08-26-2011, 09:12 PM
  2. how do you usesuphp and prevent overriding system php.ini?
    By Kaydiddle in forum cPanel and WHM Discussions
    Replies: 1
    Last Post: 04-06-2009, 04:35 PM
  3. Perl errors while executing scripts
    By mystikzen in forum cPanel and WHM Discussions
    Replies: 1
    Last Post: 05-30-2006, 08:00 AM
  4. Problems with executing perl-scripts
    By Freehen in forum cPanel and WHM Discussions
    Replies: 12
    Last Post: 06-12-2004, 11:13 PM
  5. Problem executing linked php scripts
    By gflamerich in forum cPanel and WHM Discussions
    Replies: 0
    Last Post: 11-08-2003, 01:29 PM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube