This article is a mirror article of machine translation, please click here to jump to the original article.

View: 9719|Reply: 1

Full parsing of dangerous functions in PHP

[Copy link]
Posted on 12/14/2015 10:34:33 PM | | |
When compiling PHP, if there is no special need, it is necessary to prohibit the compilation of PHP parsing support that generates CLI command-line patterns. You can use –disable-CLI at compile time. Once PHP is compiled to generate CLI patterns, it can be exploited by an intruder to set up a WEB Shell backdoor process or execute arbitrary code via PHP.
phpinfo()
Function description: Output PHP environment information and related modules, WEB environment and other information.
Hazard level: Medium
passthru()
Function description: Allows an external program to be executed and echoes output, similar to exec().
Hazard level: high
exec()
Function description: Allows the execution of an external program (such as UNIX Shell or CMD commands, etc.).
Hazard level: high
system()
Function description: Allows an external program to be executed and echoed output, similar to passthru().
Hazard level: high
chroot()
Function description: It can change the working root directory of the current PHP process, and it can only work if 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 a 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 commands through the 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: Get information about the process opened using proc_open().
Hazard level: high
error_log()
Function description: Send error messages to specified locations (files).
Safety note: In some versions of PHP, you can use error_log() to bypass PHP safe mode,
Execute arbitrary commands.
Hazard level: low
ini_alter()
Function description: It is an alias function of the ini_set() function, which has the same function as ini_set(). See ini_set() for details.
Hazard level: high
ini_set()
Function description: It can be used to modify and set PHP environment configuration parameters.
Hazard level: high
ini_restore()
Function description: Can be used to restore PHP environment configuration parameters to their initial values.
Hazard level: high
dl()
Function description: Load a PHP external module during PHP runtime, not at startup.
Hazard level: high
pfsockopen()
Function Description: Establish a socket persistent connection to an Internet or UNIX domain.
Hazard level: high
syslog()
Function Description: Calls the system-level syslog() function of the UNIX system.
Hazard level: Medium
readlink()
Function Description: Returns the content of the target file to which the symbol connection points.
Hazard level: Medium
symlink()
Function Description: Create a symbolic link in a UNIX system.
Hazard level: high
popen()
Function description: You can pass a command through the parameters of popen() and execute the file opened by popen().
Hazard level: high
stream_socket_server()
Function Description: Establish an Internet or UNIX server connection.
Hazard level: Medium
putenv()
Function description: Used to change the system character set environment while PHP is running. In PHP versions earlier than version 5.2.6, this function can be used 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





Previous:Thread multithreading The important role of IsBackground for threads
Next:Very useful comparative library functions, a little vague when learning, find out and share with everyone
Posted on 9/24/2019 1:30:17 PM |
Thank you landlord.
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com