I just started my research on PHP. I have some personal opinions on the most common PHP vulnerability files:
1. involved functions include, require, include_once, and require_once
Their usage is not described in detail here, of course, the most likely to be used is include. This will improve the execution method of the include function. After the include function contains a file, it will continue to be executed if an error occurs, and require will stop execution after an error occurs. So that the physical path is leaked. You may think that it is no big deal to disclose the physical path, but such information can sometimes cause fatal security problems. Okay. Continue to include the vulnerability. If you want to concentrate the vulnerability into the simplest sentence, it is best to do the following:
$ A = $ _ Get ["ID"];
Include ("$ ");
The hacker only needs to construct a special URL address and keep $ A behind it.CodeTo obtain the webshell of a website.
2. Essence
In essence, the filtering of include functions is not strict. In fact, this is the simplest and most common vulnerability in PHP. Because it is simple, it is also the most prone to problems, or even exceeds the database injection. The essence is that PHP's include function is really good. Just include it and save dozens of lines of code. Today, when building a high-performance WEB Website, the popularity of the include function naturally increases.
3. Solution
Perform unified processing on the included functions. Especially in large-scale project development, functions that contain functions are inevitably called, so we need to have a unified method to process them (that is, to strictly filter the functions that contain them ). 1. Use the judgment function to complete the error information so that the viewer cannot obtain the detailed information of the contained file (Note: local and remote inclusion are available here, you can search for the solution to remote file inclusion by Google.) 2. Add an extension to the file that contains the file, that is, include ("$ "". TXT "). In this case, a TXT is added to the end of variable.
Note: PHP language learning has just begun. please correct me if you have any mistakes.