When compiling PHP, if there is no special need, it must be prohibited to compile and generate PHP parsing support in CLI command line mode. Can be compiled using --disable-CLI. Once PHP in CLI mode is compiled and generated, the program may be used by intruders to establish a WEB Shell backdoor process or execute arbitrary code through PHP.
phpinfo()
function description: Output PHP environment information and related module, WEB environment and other information.
Danger level: Medium
passthru()
Function Description: Allows to execute an external program and echo the output, similar to exec().
Danger level: High
exec()
function description: Allows the execution of an external program (such as UNIX Shell or CMD command, etc.).
Danger level: High
system()
Function Description: Allows to execute an external program and echo the output, similar to passthru().
Danger level: High
chroot()
function description: It can change the working root directory of the current PHP process. It can only work when the system supports CLI mode PHP, and this function is not applicable to Windows systems.
Danger level: High
scandir()
function description: List files and directories in the specified path.
Danger level: Medium
chgrp()
function description: Change the user group to which a file or directory belongs.
Danger level: High
chown()
function description: Change the owner of the file or directory.
Danger level: High
shell_exec()
function description: Execute the command through the Shell and return the execution result as a string.
Danger level: High
proc_open()
Function Description: Execute a command and open the file pointer for reading and writing.
Danger level: High
proc_get_status()
Function Description: Get information about the process opened using proc_open().
Danger level: High
error_log()
function description: Send error information to the specified location (file).
Security note: In some versions of PHP, error_log() can be used to bypass PHP safe mode.
Execute arbitrary commands.
Danger level: Low
ini_alter()
function description: It is an alias function of the ini_set() function and has the same function as ini_set(). See ini_set() for details.
Danger level: High
ini_set()
Function Description: Can be used to modify and set PHP environment configuration parameters.
Danger level: High
ini_restore()
Function Description: Can be used to restore PHP environment configuration parameters to their initial values.
Danger level: High
dl()
function description: Load a PHP external module while PHP is running (not when starting).
Danger level: High
pfsockopen()
Function Description: Establish a persistent socket connection in the Internet or UNIX domain.
Danger level: High
syslog()
function description: The system layer syslog() function of the UNIX system can be called.
Danger level: Medium
readlink()
function description: Returns the contents of the target file pointed to by the symbolic link.
Danger level: Medium
symlink()
function description: Create a symbolic link in the UNIX system.
Danger level: High
popen()
function description: A command can be passed through the parameters of popen() and executed on the file opened by popen().
Danger level: High
stream_socket_server()
Function Description: Establish an Internet or UNIX server connection.
Danger level: Medium
putenv()
Function Description: Used to change the system character set environment when PHP is running. In PHP versions earlier than 5.2.6, you can use this function to modify the system character set environment, and then use the sendmail command to send special parameters to execute the system SHELL command.
Hazard level: high