Analysis of PHP dangerous functions

Source: Internet
Author: User
Full parsing of dangerous functions in PHP. Read the full parsing of dangerous functions in PHP. if you do not need to compile PHP, you must disable PHP parsing support in CLI mode. During PHP compilation, PHP parsing support in CLI mode must not be compiled unless otherwise required. You can use-disable-CLI during compilation. Once PHP in CLI mode is compiled, attackers may use this program to create a WEB Shell backdoor process or execute arbitrary code through PHP.
Phpinfo ()
Function description: outputs information about the PHP environment, related modules, and WEB environment.
Hazard Level: Medium
Passthru ()
Function description: Allows execution of an external program and echo output, similar to exec ().
Hazard level: High
Exec ()
Function description: Allows execution of an external program (such as a UNIX Shell or CMD command ).
Hazard level: High
System ()
Function description: Allows execution of an external program and echo output, similar to passthru ().
Hazard level: High
Chroot ()
Function description: it can change the working root directory of the current PHP process. it only works when the system supports CLI mode PHP, and this function is not applicable to Windows systems.
Hazard level: High
Scandir ()
Function description: lists files and directories in a specified path.
Hazard Level: Medium
Chgrp ()
Function description: change the user group to which the file or directory belongs.
Hazard level: High
Chown ()
Function description: change the owner of a file or directory.
Hazard level: High
Shell_exec ()
Function description: execute the command through Shell and return the execution result as a string.
Hazard level: High
Proc_open ()
Function description: execute a command and open the file pointer for reading and writing.
Hazard level: High
Proc_get_status ()
Function description: gets information about the processes opened with proc_open.
Hazard level: High
Error_log ()
Function description: Sends an error message to a specified location (file ).
Security Note: in some PHP versions, error_log () can be used to bypass PHP safe mode,
Execute any command.
Hazard level: low
Ini_alter ()
Function description: it is an alias function of the ini_set () function. its function is the same as that of ini_set. For more information, see ini_set ().
Hazard level: High
Ini_set ()
Function description: used to modify and set PHP environment configuration parameters.
Hazard level: High
Ini_restore ()
Function description: used to restore the PHP environment configuration parameters to their initial values.
Hazard level: High
Dl ()
Function description: loads a PHP external module while PHP is running (rather than starting.
Hazard level: High
Pfsockopen ()
Function description: establishes a socket persistent connection in the Internet or UNIX domain.
Hazard level: High
Syslog ()
Function description: you can call the system-layer syslog () function of a UNIX system.
Hazard Level: Medium
Readlink ()
Function description: returns the content of the target file to which the symbolic connection points.
Hazard Level: Medium
Symlink ()
Function description: creates a symbolic link in a UNIX system.
Hazard level: High
Popen ()
Function description: you can pass a command through the popen () parameter and execute the file opened by popen.
Hazard level: High
Stream_socket_server ()
Function description: establishes an Internet or UNIX server connection.
Hazard 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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.