Why should certain PHP functions be blocked from executing on a hosting server?

As is well known, PHP is one of the most widely used web programming languages today. It is supported by a very large number of function libraries and extension modules, …
Because PHP is extended by functions that can interact with and execute directly against the host system, those functions carry real risk — and if system administrators do not take security seriously, the consequences can be severe.
Nearly all hosting providers worldwide are compelled to disable certain PHP functions for security reasons (malware distribution, local attacks, botnets, DoS, and similar risks) — these are functions that hosting providers around the world consider extremely dangerous.
To understand the issue, why these functions are blocked and which ones must be blocked, see the descriptions in the table below:

STTNameFeaturesDescription
1systemExecute an external program and display the outputsystem() behaves like the C version of the function: it executes the given command and returns the output. The system() call also attempts to flush the web server's output buffer automatically after each line of output if PHP is running as a server module. If you need to execute a command and have all data from the command passed straight back without interference, use the passthru() function.
2execRun an external programAllows an external program to be executed. Easily abused to escalate privileges and run malicious programs.
3shell_execExecutes a command through the shell and returns the complete output as a stringExecutes a command and returns the result as a string. Like exec, it is easily abused and exploited for malicious purposes.
4proc_closeCloses a process opened by proc_open() and returns that process's exit codeproc_close() is similar to pclose(), except that it works only on processes opened by proc_open(). proc_close() waits for the process to terminate and returns its exit code. If you have pipes open to that process, close them with fclose() before calling this function to avoid a deadlock — the child process may be unable to exit while the pipes are open.
5proc_get_statusGet information about a process opened by Proc_open ()proc_get_status() retrieves data about a process opened with proc_open().
6proc_niceChange the priority of the current processChanges the priority of the current process. This causes a resource escalation problem.
7popenOpen the process file handlepopen is similar to proc_open but is used less often.
8proc_terminateClose a process opened by Proc_openSignals a process (created with proc_open()) to terminate. proc_terminate() returns immediately and does not wait for the process to end, allowing you to terminate the process and move on to other work. You can poll the process (to check whether it has stopped) with proc_get_status(). This makes it easy for important running processes to be interrupted by this function, which can have serious consequences and create data security problems.
9escapeshellcmdEscape shell metacharactersescapeshellcmd() escapes any character in a string that could be used to trick a shell command into executing arbitrary commands. Use this function to ensure that data originating from user input is escaped before it is passed to exec(), system() or the backtick operator. The following characters are prefixed with a backslash: & # ; ` | * ? ~ < > ^ ( ) [ ] { } $ , \x0A and \xFF. Single and double quotes are escaped only when they are unpaired. On Windows, all of these characters plus % and ! are replaced with spaces.
10escapeshellcmdEscape a string used as a shell argumentescapeshellarg() adds single quotes around a string and quotes or escapes any existing single quotes, allowing you to pass a string directly to a shell function and have it treated as a single safe argument. Use this function to escape individual arguments to shell functions when those arguments come from user input. Shell functions include exec(), system() and the backtick operator. On Windows, escapeshellarg() replaces percent signs, exclamation marks (delayed variable substitution) and double quotes with spaces, and adds double quotes around the string.
11dlLoad a PHP extension at runtimeLoads the PHP extension given by the library parameter. Use extension_loaded() to test whether a given extension is available. This works for both built-in extensions and those loaded dynamically (either through php.ini or dl()).
12show_sourceReturns a file with its PHP syntax highlighted. The highlighting is applied using HTML tags.Prints or returns a syntax-highlighted version of the code in the given file, using the colors defined in PHP's built-in syntax highlighter. Many servers are configured to automatically highlight files with the .phps extension. For example, viewing example.phps will display the source of the file with syntax highlighting
13ini_alterThis function is an alias of: ini_set()Sets the value of the given configuration option. The option keeps this new value for the duration of the script and is restored when the script ends.
14virtualPerform an Apache subrequestPerform an Apache subrequest
15openlogOpens a connection to the system logger for a programOpens a connection to the system logger for a program
16mailSending mail without authenticationSending mail without authentication
17symlinkCreate a symbolic linkCreate a symbolic link

The table above lists the PHP functions that have been disabled (disable functions). So which PHP/Apache functions and modules are supported? The table below sets them out in detail:

STTApache ModulePHP Extention
1configlibc-client
2config-runtimepear
3develphp-bcmath
4mod-alt-passengerphp-bz2
5mod_bwlimitedphp-calendar
6mod_cachephp-cli
7mod_cgidphp-common
8mod_charset_litephp-curl
9mod_deflatephp-dba
10mod_envphp-devel
11mod_evasivephp-enchant
12mod_expiresphp-exif
13mod_file_cachephp-fileinfo
14mod_headersphp-fpm
15mod_hostinglimitsphp-ftp
16mod_http2php-gd
17mod_imagemapphp-gettext
18mod_lsapiphp-gmp
19mod_macrophp-iconv
20mod_mime_magicphp-imap
21mod_mpm_eventphp-intl
22mod_proxyphp-ioncube
23mod_proxy_fcgiphp-litespeed
24mod_proxy_httpphp-mbstring
25mod_proxy_wstunnelphp-mcrypt
26mod_remoteipphp-mysqlnd
27mod_reqtimeoutphp-odbc
28mod_security2php-pdo
29mod_spelingphp-phalcon
30mod_sslphp-posix
31mod_substitutephp-soap
32mod_suexecphp-sockets
33mod_unique_idphp-sourceguardian
34mod_versionphp-suhosin
35mod_vhost_aliasphp-tidy
36Toolsphp-xml
37 php-zendguard
38 php-zip
39 runtime

Similar Posts