Home  >  Article  >  Backend Development  >  Full analysis of dangerous functions in PHP_PHP tutorial

Full analysis of dangerous functions in PHP_PHP tutorial

WBOY
WBOYOriginal
2016-07-15 13:25:31742browse

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 executing an external program and echoing the output, Similar to exec().

Danger Level: High

exec()

Function Description: Allows execution of an external program (such as UNIX Shell or CMD command, etc.).

Danger Level: High

system()

Function Description: Allows executing an external program and echoing the output, Similar to passthru().

Danger level: High

chroot()

Function description: Can change the working root directory of the current PHP process, Only works if the system supports CLI mode PHP, and this function does not work on 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 a file or directory.

Danger level: High

shell_exec()

Function description: Execute the command through Shell and use the execution result as String returned.

Danger level: High

proc_open()

Function description: Execute a command and open the file pointer for reading Fetch and write.

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 and
execute arbitrary commands.

Danger level: low

ini_alter()

Function description: It is an alias function of the ini_set() function. The function is the same 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 value.

Danger level: High

dl()

Function description: While PHP is running (not starting ) to load a PHP external module.

Danger level: High

pfsockopen()

Function description: Establish a socket persistent connection in the Internet or UNIX domain .

Danger level: High

syslog()

Function description: Can call the system layer syslog() of UNIX system function.

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 a UNIX system.

Danger level: High

popen()

Function description: A command can be passed through the parameters of popen() , and execute 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 when PHP is running environment. 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.

Danger Level: High


www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/446667.htmlTechArticleWhen compiling PHP, if there is no special need, it must be prohibited to compile and generate PHP parsing support for CLI command line mode. Can be compiled using --disable-CLI. Once compiled to generate CLI mode P...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn