Common PHP Security vulnerabilities-cross-site, injection, and file inclusion

Source: Internet
Author: User
This script gives attackers the opportunity to execute any php code on your server. for example, if the script is added after the browser url? Module = http://example.com/my. When php receives this url, the value of the "$ module" variable in the script will be set.

1. be careful when using include. check whether the file exists locally to avoid security vulnerabilities.
For example:
Include $ module. '. php ';
?>
Assume that $ module is a global variable.
This script gives attackers the opportunity to execute any php code on your server. for example, if the script is added after the browser url? Module = http://example.com/my. When php receives this url, the value of the "$ module" variable in the script will be set to http://example.com/my. So it is dangerous to execute include in php ......
Solution: close the register_globals or include in php. ini and check whether it is correct.
If (file_exists ($ module. '. php ')){
Include $ module. '. php ';
}
?>
Php. ini contains a setting. After open_basedir is set, only php scripts under the specified directory and subdirectory are executed.
If you use php to read a directory or file other than open_basedir, an error is reported.
Insufficient permissions. generally, virtual host providers are set to/tmp and/home.
2. run the script across sites.
Simply put, attackers can execute some client scripts, such as js, on the user's browser side, and then steal users' cookies or other important data.
For example

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: info-contact@alibabacloud.com 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.