This article introduces some techniques to defend against PHP Trojan attacks. in these ways, you can better guard against Trojan programs. 1. to prevent jumping out of the web Directory, first correct httpd. conf. if you only promise your php script program to put this article in the web Directory, first introduce some techniques to defend against PHP Trojan attacks, in these aspects, you can better guard against Trojans.
1. prevent jumping out of the web Directory
First, modify httpd. conf. if you only want your php script to be held in the web directory, you can also modify the httpd. conf file to limit the php control path. For example, if your web directory is/usr/local/apache/htdocs, add the following lines in httpd. conf:
In this way, if the script is to read files other than/usr/local/apache/htdocs, it will not be agreed. if the error is displayed, the following error will be prompted:
Warning: open_basedir restriction in effect. File is in wrong directory in
/Usr/local/apache/htdocs/open. php on line 4
And so on.
2. prevent php Trojans from performing webshell
Enable safe_mode,
Set in, php. ini
Disable_functions = passthru, exec, shell_exec, system
Select either of them.
3. prevent php Trojans from reading and writing file directories
In php. ini
Disable_functions = passthru, exec, shell_exec, system
Okay, it's done. we have no choice but to use the php Trojan. Unfortunately, those things that use the text database won't work anymore.
If apache is built on the windos platform, we still need to pay attention to it. apache runs the system permission by default, which is terrible and unpleasant. let's drop apache permissions.
Net user apache *** microsoft/add
Net localgroup users apache/del
OK. We have created a user apche that does not belong to any group.
We open the computer controller, select the service, and click the apache service attribute. we select log on and select this account. we enter the account and password created above and restart the apache service, OK. apache runs under low permissions.
In fact, we can also set the permissions for each folder so that apache users can only perform what we want them to do, and create a single read/write user for each directory. This is also a popular configuration method for many VM providers, but this method is used to prevent the usage from being too small.
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