Explore our in-depth
crafted by
skilled professionals!

Our Latest News, Advice and Thoughts

Find the Potential Spammer Account in cPanel/Exim

You are here:

On this tutorial we are able to verify how you can discover the potential spammer account in cPanel Exim mail server.

What’s Spam?

            In technical spam is an Unsolicited Industrial E-mail (UCE), means electronic mail messages despatched to a private machine with out the prior request.


Forms of Spam

1) Phishing spam

2) International financial institution spam

3) Get wealthy simply and shortly spam

4) Illicitly pirated software program

5) Newsgroup and discussion board spam


What are its Results?

Some results of spam

1) Fills your Inbox with numerous bounce again emails.

2) Reduces your Web velocity.

3) Steals helpful info like your bank card particulars and make contact with listing info.

4) Alters your search outcomes on search engine.


What occurs after the compromise?

The attacker places a PHP file on the server that acts as a part of a DDoS or a script that used to ship a ton of spam. No matter utility you’re utilizing to connect with electronic mail (Outlook, Thunderbird, and so forth.) and use that to start out spamming.

We all know that somebody on our server is spamming. We don’t know if it’s attributable to a script or if it’s as a result of somebody’s machine received attacked.


Let’s take a look at a command which is used to searches for all exterior logins

exigrep @ /var/log/exim_mainlog | grep _login | sed -n ‘s/.*_login:(.*)S=.*/1/p’ | type | uniq -c | type -nr -k1

The above script is used to exigrep by means of our electronic mail log and return any line containing an @ after which type, offers what number of situations are there.


Let’s verify which person/account has been hacked:

exigrep @ /var/log/exim_mainlog | grep U= | sed -n ‘s/.*U=(.*)S=.*/1/p’ | type | uniq -c | type -nr -k1

Utilizing this script, we received the person who’s sending probably the most electronic mail on the system. We will analyze that this person is producing spam.


Let’s monitor down the script

grep “cwd=” /var/log/exim_mainlog | awk ‘for(i=1;i<=10;i++)print $i’ | type |uniq -c| grep cwd | type -n | grep /dwelling/

Executing this command will verify the strains within the Exim log that incorporates the string “cwd”. It helps to search out the folder the place the spam is occurring.


Let’s verify the X-PHP-Script area

grep X-PHP-Script /var/spool/exim/enter/*/*-H | awk ‘print $3’ | type | uniq -c | type -nr

This can search the lively mail queue. It checks for the X-PHP-Script area within the header of the emails. This should be enabled in cPanel by default or it may be enabled in Whm. This above line offers which script despatched the e-mail.


Code Breakdown

The under line is used to search out most used mailing script’s location from the Exim mail log.

grep cwd /var/log/exim_mainlog | grep -v /var/spool | awk -F”cwd=” ‘print $2’ | awk ‘print $1’ | type | uniq -c | type -n


grep cwd /var/log/exim_mainlog

Use the grep command to find string “cwd” from the Exim mail log. This stands for present working listing

grep -v /var/spool

Grep with -v is used to Invert the sense of matching, To pick non-matching strains.That doesn’t present any strains that begin with /var/spool. As a result of /var/spool is the traditional Exim deliveries.

awk -F”cwd=” ‘print $2’ | awk ‘print $1’

Use the awk command with the -F separator set to “cwd=”, then print out the $2nd set of knowledge, then pipe that to the awk command once more. It solely prints out the $1st column, thereby we are able to get again the script path.

type | uniq -c | type -n

Filter the script paths by their identify, and rely them, type them once more in ascending order.


For those who want any additional assist please do attain our assist division.



Leave a Comment