How to curb PHP Trojan attack _php Tutorial

Source: Internet
Author: User
As we all know, surfing on the internet must withstand the virus, Trojan attacks, and protect our clean surfing environment. Here, you will learn

1. Prevent jumping out of the web directory

PHP Trojan Attack Defense first modifies the httpd.conf, if you only allow your PHP script to operate in the Web directory, you can also modify the httpd.conf file limit php operation path. For example, if your web directory is/usr/local/apache/htdocs, then add a few lines to the httpd.conf:

Php_admin_value Open_basedir/usr/local/apache
/htdocs

This way, if the script is to read files other than/usr/local/apache/htdocs will not be allowed, if the error display opens, it will prompt such an error:

Warning:open_basedir restriction in effect. File is in wrong directory in

/usr/local/apache/htdocs/open.php on line 4

Wait a minute.

2, prevent PHP trojan attack execution Webshell

Open Safe_mode, set in, php.ini

disable_functions= Passthru,exec,shell_exec,system

Choose either one, or you can choose

3, prevent PHP Trojan attack read and write files directory

In php.ini disable_functions= Passthru,exec,shell_exec,system after the addition of PHP processing file functions, mainly:

Fopen,mkdir,rmdir,chmod,unlink,dir

Fopen,fread,fclose,fwrite,file_exists

Closedir,is_dir,readdir.opendir

Fileperms.copy,unlink,delfile

That becomes

disable_functions= Passthru,exec,shell_exec,system,fopen,mkdir,rmdir,chmod,unlink,dir

, fopen,fread,fclose,fwrite,file_exists

, Closedir,is_dir,readdir.opendir

, Fileperms.copy,unlink,delfile

OK, it's done, PHP Trojan take us out of the way, unfortunately, the use of the text database of those things can not be used.

If the Apache is built under the WinDOS platform, we also need to note that Apache default operation is the system permissions, which is very scary, it makes people feel very uncomfortable. So let's give Apache permission to drop it.

NET user Apache Fuckmicrosoft/add

net localgroup users Apache/del

Ok. We have created a user apche that does not belong to any group.

We open the Computer Manager, select the service, point to the properties of the Apache service, we choose Log on, select the account, we fill in the accounts and passwords established above, restart the Apache service, Ok,apache run under the low authority.

In fact, we can also set individual folder permissions, so that Apache users can only do what we want it to do, to each directory to create a separate read and write users. This is also a popular configuration method for many current web hosting providers, but this kind of PHP Trojan Attack defense method is used to prevent this is a little bit overqualified.


http://www.bkjia.com/PHPjc/445979.html www.bkjia.com true http://www.bkjia.com/PHPjc/445979.html techarticle as we all know, surfing on the internet must withstand the virus, Trojan attacks, and protect our clean surfing environment. Here, you will learn to 1, prevent jumping out of the web directory PHP wood ...

  • 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.