Answer the question
In order to leave comments, you need to log in
How to find out which PHP script created a file?
Ubuntu Server 14.04 system, Apache2, PHP and more. A virus has got into the system, some of the scripts periodically creates new scripts that send spam from the server. Is it possible to trace which script creates these files?
Answer the question
In order to leave comments, you need to log in
you can try this:
Search for files with the line "mail("
or put maldet , or clamav , or
search for php files changed in the last dayfind /var/www -type f -name '*.php' -mtime -1
Have you looked at the logs of the mail server itself? /var/log/ and there already, depending on how your server is installed.
I don't know the default options.
To quickly "shut up" the question, put on all files and directories that should not be changed the immutable attribute using chattr. This eliminates the ability to create or modify a file on disk until privileges are elevated to root. In the directories where temporary files are written, set .htaccess to prevent any files from being interpreted as executable.
php_flag engine 0
AddType "text/html" .php .cgi .pl .fcgi .fpl .phtml .shtml .php2 .php3 .php4 .php5 .asp .jsp
and forbid changing the file itself using immutable: -A OUTPUT -o br0 -p tcp -m state --state ESTABLISHED,RELATED -j ACCEPT
-A OUTPUT -o br0 -m state --state NEW -p tcp -m tcp --dport 25 -d 127.0.0.1 -j ACCEPT
-A OUTPUT -o br0 -m state --state NEW -p tcp -m tcp --dport 25 -m owner --gid-owner mail -j ACCEPT
-A OUTPUT -o br0 -m state --state NEW -p tcp -m tcp --dport 25 -m owner --uid-owner root -j ACCEPT
-A OUTPUT -o br0 -m state --state NEW -p tcp -m tcp --dport 25 -m owner --uid-owner smfs -j ACCEPT
-A OUTPUT -o br0 -m state --state NEW -p tcp -m tcp --dport 25 -j LOG --log-uid --log-prefix "Reject outgoing SMTP "
-A OUTPUT -o br0 -m state --state NEW -p tcp -m tcp --dport 25 -j REJECT --reject-with icmp-admin-prohibited
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question