Server sending spam from disabled sites/backscatter

7 posts / 0 new
Last post
#1 Wed, 08/13/2014 - 18:31
ChromeNewbie

Server sending spam from disabled sites/backscatter

Hi

Firstly, I'm really sorry if this has been dealt with before; if it has, please point me in the right direction.

Basically, a few months ago a few of sites on our server started getting acripts uploaded to them. Usually, these scripts have been removed within a maximum of 6 hours. Immediately after finding these scripts I check the Virtualmin Sys Info page and occasionally the affected sites have been running the HOST command at ridiculous CPU usages. I haven't seen this happening receently

But, last week I got a warning that the server was creating backscatter spam. I'm really not too familiar with this, but I made sure with several online tools and the server isn't an open relay. I'm really confused

The main problem, though, is that several site have suddenly started sending spam. I got a complaint about mail not being delivered and found the mail queue was 30,000 emails strong, all linked to the domains that have had previous issues. Most of the senders are not in the users table for having accounts. I managed to find a command that cleared the mail from the offending sites, but an attempt to flush the mail queue had no effect and the outgoing spam is building up

I run maldet with hourly updates and a 6 hour scan cron. I also have Clam which auto-updates and runs a scan once a day. I have also run chkrootkit

I am really stuck here because I've just started a new job and am only trying to help out my ex-boss but I'm getting a lot of flak for this and it is really stressing me out

Any help would be greatly appreciated. Really

Thanks in advance

Dan

Wed, 08/13/2014 - 22:36
andreychek

Howdy,

It sounds like you're doing all the right things, but these spammers can be, well, sneaky.

My suspicion is that either they know about a hole in one of your websites, or that they're accessing an account on your server.

What you may want to try is to review the email headers for one of the messages in your outgoing mail queue. When doing that, any of the headers could be helpful, but in particular check out the "Received" headers. They can assist in showing where the email is coming from.

With that, you may then be able to link the time in the "Received" header with the activity on your website, or with users logged into your server. However, it should also point you towards which site/user is responsible.

Feel free to post the header information here if you'd like a hand dissecting what's in there.

-Eric

Fri, 08/15/2014 - 14:08
ChromeNewbie

Hi Eric

Thank you for your advice. Here are the headers of one of the offending emails

To   sadiay_9@hotmail.com, janiya9607@att.net, donna.cb@tiscali.co.uk, jesuspenajr@yahoo.com, steven_macbeth@mac.com, treejelly@hotmail.com, hotmale_dude81@yahoo.com, enk@farsinet.com, reddy@namdhariseeds.com, gotb3@cox.net, lovesky5603@yahoo.com, tnecniv84@aol.com, fam-corydonk@ofir.dk, rositalagos@hotmail.com, chances1109@yahoo.co.uk, jonpga@aol.com, aguesinexee@dslextreme.com, georgiaandjimmy@bellsouth.net, p.f.hall@btinternet.com, cabsmith21@yahoo.com, nkemegbe@yahoo.co.uk, elzarcoguti69@yahoo.com, jwallace@excaliburfunds.com, john_chaleve_nathan@yahoo.com
Subject     I want you to suck out all the juices you put in me with y....
X-PHP-Originating-Script    1100:odfd.php

I can find and kill the scripts but I have a few questions:

1) How come maldet and Clam missed this (there are a few other files doing the same)

2) How do I get postfix to not send unless there is an actual valid user sending (rather than the script making stuff up)

3) The mail queue is stalled; how can I get it running again? I've tried flushing the queue but to no avail

I'm sorry it took me so long to reply; Just started a new job and am helping out my old one

I really do very much appreciate any and all help with this; people are getting very angry with me

Thanks

Dan

Fri, 08/15/2014 - 14:39
andreychek

Howdy,

How come maldet and Clam missed this (there are a few other files doing the same)

Those apps can find a lot of malware, but not all of it.

How do I get postfix to not send unless there is an actual valid user sending (rather than the script making stuff up)

I haven't tried these settings before, but you could try looking into the Postfix options "smtpd_reject_unlisted_sender " and "reject_unlisted_sender". You can read about those here:

http://www.postfix.org/postconf.5.html

The mail queue is stalled; how can I get it running again? I've tried flushing the queue but to no avail

Hmm, what do you mean by it being stalled? Are you seeing an error of some sort?

Here are the headers of one of the offending emails

That only appears to be a few of the headers, not all of them... though based on that you may want to look for the file "odfd.php" on your system, it appears that is what was used for sending those emails.

-Eric

Fri, 08/15/2014 - 16:20
ChromeNewbie

Hi Eric

Thanks for your prompt response. I get the maldet and Clam issues; I'm just a bit panicky

I identified the odfd.php header (after your prompt to check them; something I should've already done) and have deleted it. I also found another script and deleted that too

I suppose the next thing to check is the cron jobs.

Oh, when I say the mail queue has stalled, I mean that no mail is not going out at all; I've tried flushing the queue but nothing changes. The mail queue remains the same (nothing gets sent)

Also, do you have any pointers on the backscatter issue (I am researching this)? I am sorry for asking so much but the timing of this is really horrible

Many thanks

Dan

Fri, 08/15/2014 - 17:38
andreychek

In regards to your mail queue -- you may want to run "mailq", and look for any errors/warnings that show up next to messages in the queue.

You may also want to review the email logs in /var/log/maillog or /var/log/mail.log to look for further clues.

-Eric

Sat, 08/16/2014 - 16:35
ChromeNewbie

Hi Eric

Thanks for your help. Your prompt to check the headers allowed me to identify the offending scripts and made me think about using find command to find and delete the offending scripts. A friend found a queue clearing command:

WARNING: THIS WILL DELETE ALL EMAILS FOR A DOMAIN IN THE QUEUE

mailq | grep senderhostname | awk '{ print $1'} | postsuper -d -

Replace senderhostname with your offending domain

Again, thanks Eric!

Dan

Topic locked