A php Trojan is actually a php file written by a PHP program. it can perform any read/write operations on the file and upload and download the database, A perfect website file management system. the following section summarizes some common PHP Trojan attacks... a php Trojan is actually a php file written by a PHP program. it can perform any read/write operations on the file and upload and download the database, it is a perfect website file management system. the following section summarizes some common methods to defend against PHP Trojan attacks.
1. prevent jumping out of the web Directory
First modify httpd. conf. if you only allow your php script program to operate in the web directory, you can also modify httpd. the conf file limits the php operation path. for example, if your web directory is/usr/local/apache/htdocs. add the following lines in conf:
Php_admin_value open_basedir/usr/local/apache/htdocs
In this way, files other than/usr/local/apache/htdocs to be read by the script will not be allowed. 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 executing webshell
Enable safe_mode and set it 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, and system are followed by php file processing functions, mainly including:
Fopen, mkdir, rmdir, chmod, unlink, dir fopen, fread, fclose, fwrite, file_exists closedir, is_dir, readdir. opendir fileperms. copy, unlink, delfile // it 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
Okay, it's done. we have no choice but to use the php Trojan. Unfortunately, those things that use the text database won't be available.
If apache is built on the windos platform, we still need to note that apache runs the system permission by default, which is terrible, which makes people feel uncomfortable. let's drop apache permissions.
net user apache fuckmicrosoft /addnet localgroup users apache /del
OK. We have created a user apche that does not belong to any group.
Open the computer manager, select a service, click the apache service attribute, select log on, select this account, fill in the account and password created above, 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 execute what we want it 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.
Phprm.com reminds you: if you do not understand these configurations, we can use a dongle or sell coffee to set a website directory. php files cannot be written, so that php files cannot be uploaded due to bugs, at the same time, I will not introduce the restrictions on some extraction operations here. you will find some relevant tutorials on this site.
Tutorial link:
Reprint at will ~ However, please keep the tutorial address★