Get your server issues fixed by our experts for a price starting at just 25 USD/Hour. Click here to register and open a ticket with us now!

Author Topic: Finding spam sending PHP scripts on your server  (Read 1146 times)

0 Members and 1 Guest are viewing this topic.

vichithrakumart

  • Guest
Finding spam sending PHP scripts on your server
« on: March 08, 2018, 10:40:02 pm »
By simply adding the following 2 lines into your php.ini then you can track down pretty much any outgoing spam using PHP

Code: [Select]
mail.add_x_header = On
mail.log = /var/log/phpmail.log

The first one adds a header to all outgoing email. You may or may not want this one as it will give out information about your setup and config (eg uids, script locations), you also are probably not receiving the spam so its not much help too you.

The second line logs the entire lot to a log file. It's important to make sure that log file is owner and writeable by the webserver, and that it is being rotated by logrotate also.

With these in place your emails will have the following headers

Code: [Select]
X-PHP-Originating-Script: 519:rcfpyezf.php(1189) : runtime-created function(1) : eval()'d code(1) : eval()'d code
The 519 is the UID, the rcfpyezf.php  was the script sending the spam

You can also check phpmail.log for more information.