The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Symlink files in my server.

Discussion in 'Security' started by YasIT, May 31, 2014.

  1. YasIT

    YasIT Active Member

    Joined:
    Jan 3, 2014
    Messages:
    38
    Likes Received:
    0
    Trophy Points:
    6
    cPanel Access Level:
    Root Administrator
    Hello.
    On my server I've applied the following settings:

    Code:
    
    Disable php.ini for users.
    safe_mode on 
    disable_functions:
    ir_a_bajo,phpinfo,disk_free_space,disk_total_space,php_uname,symlink,shell_exec,exec,proc_close,proc_open,popen,pclose,system,dl,passthru,escapeshellarg,escapeshellcmd,readfile,posix_access,posix_ctermid,posix_errno,posix_get_last_error,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_initgroups,posix_isatty,posix_kill,posix_mkfifo,posix_mknod,posix_setegid,posix_seteuid,posix_setgid,posix_setpgid,posix_setsid,posix_setuid,posix_strerror,posix_times,posix_ttyname,posix_uname
    
    open_basedir :
    /home/:/usr/lib/php:/usr/local/lib/php:/tmp:/home2/:/usr/lib/php:/usr/local/lib/php:/tmp:/home3/:/usr/lib/php:/usr/local/lib/php:/tmp:/home4/:/usr/lib/php:/usr/local/lib/php:/tmp
    
    safe_mode_gid on
    enable_dl off
    suhosin enabled by easy apache.
    fix all warning in CSF.
    permisson /usr/bin/perl set 700
    permisson /bin/ln set 700
    Handler php set SuPHP
    php 5.3.27
    
    
    But the hacker can bypass and symlink in my server.
    Please help.
    Thank.
     
  2. quizknows

    quizknows Well-Known Member

    Joined:
    Oct 20, 2009
    Messages:
    942
    Likes Received:
    57
    Trophy Points:
    28
    cPanel Access Level:
    DataCenter Provider
  3. YasIT

    YasIT Active Member

    Joined:
    Jan 3, 2014
    Messages:
    38
    Likes Received:
    0
    Trophy Points:
    6
    cPanel Access Level:
    Root Administrator
    my webserver LiteSpeed.

    This post for apache!
     
  4. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,854
    Likes Received:
    675
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    Hello :)

    Please note the LiteSpeed web server is a third-party application that is not natively supported by cPanel. You may find more information or advice regarding their product's security directly from their support team or forums:

    LiteSpeed Support Forums

    Thank you.
     
  5. Felipe M.

    Felipe M. Member

    Joined:
    Jun 6, 2014
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    Hello

    If you have PHP 5 Handler "suphp" enabled in your server
    Please make file named .htaccess in your home directory with this content suPHP_ConfigPath /usr/local/lib/php.ini
    Or put file directly
    Hackers can't bypass your php.ini directives with this file


    Note: If you see abnormally symlinks in your users public_html, you can change permission of /bin/ln to chmod 700 (chmod 700 /bin/ln)
    Hackers can't make syminks and pass to other users or folders.

    Thanks
     
  6. quizknows

    quizknows Well-Known Member

    Joined:
    Oct 20, 2009
    Messages:
    942
    Likes Received:
    57
    Trophy Points:
    28
    cPanel Access Level:
    DataCenter Provider
    Even with /bin/ln restricted they can just upload a .zip with a symlink to / in it. That offers little actual protection.

    Bypassing php.ini is also not hard with SuPHP.

    I recommend looking into seeing if cloudlinux and cagefs plays nicely with litespeed or not.
     
  7. Felipe M.

    Felipe M. Member

    Joined:
    Jun 6, 2014
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    Not possible bypass symlinks with rar or zip file, because permission are 700 in server.

    Litespeed is not secured but very fastest with php, the best way is activate cagefs with jailed shell for all users and make hardening to your server.

    I recommend too use Anti Malware Plugin for WHM or ConfigServer eXploit Scanner (cxs)
    and search all PHPshells or malware in your server

    Thanks
     
  8. quizknows

    quizknows Well-Known Member

    Joined:
    Oct 20, 2009
    Messages:
    942
    Likes Received:
    57
    Trophy Points:
    28
    cPanel Access Level:
    DataCenter Provider
    Yes, it is possible to bypass even with ln set to 700. On your own workstation/server without restriction, make a symlink and tar it:
    Code:
    local_computer:~$ ln -s / testlink.txt                          #create symlink
    local_computer:~$ tar -cvzpf test.tar.gz testlink.txt       #add to .tar
    testlink.txt
    local_computer:~$ tar -tvzpf test.tar.gz                       #list tar content
    lrwxrwxrwx unpriv/unpriv         0 2014-06-08 00:11 testlink.txt -> /
    
    (upload as normal user to server, ftp or whatever)
    
    unpriv@server.com [~/public_html]# tar -xvzf test.tar.gz  #extract tar
    unpriv@server.com [~/public_html]# ls -alrt                   #list dir
    
    -rw-r--r--  1 unpriv unpriv   119 Jun  8 00:13 test.tar.gz
    lrwxrwxrwx  1 unpriv unpriv     1 Jun  8 00:14 testlink.txt -> //
    
    There you have it, I never used the ln binary on the server, and my normal user has a symlink to root.
     
    #8 quizknows, Jun 7, 2014
    Last edited: Jun 8, 2014
Loading...

Share This Page