LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 01-12-2016, 06:29 AM   #1
cov
Member
 
Registered: Apr 2005
Location: Durban
Posts: 436

Rep: Reputation: 30
Website smtp compromised: what steps to take?


I have a website that I'm getting a lot of smtp traffic from.

Quote:
Originally Posted by /var/log/mail.info
Jan 12 12:26:35 mccrystal postfix/cleanup[57378]: EB60066211: hold: header Received: by mccrystal (Postfix, from userid 33)??id EB60066211; Tue, 12 Jan 2016 12:26:35 +0000 (UTC) from local; from=<adrienne_norris@mccrystal.co.za>
Jan 12 12:26:35 mccrystal postfix/cleanup[57378]: EB60066211: message-id=<49d0e2c45cfc2b4c03e3137bc7b597b2@mccrystal.co.za>
Jan 12 12:26:35 mccrystal postfix/pickup[57236]: EFACF66212: uid=33 from=<adrienne_norris@mccrystal.co.za>
Jan 12 12:26:35 mccrystal postfix/cleanup[57431]: EFACF66212: hold: header Received: by mccrystal (Postfix, from userid 33)??id EFACF66212; Tue, 12 Jan 2016 12:26:35 +0000 (UTC) from local; from=<adrienne_norris@mccrystal.co.za>
Jan 12 12:26:35 mccrystal postfix/cleanup[57431]: EFACF66212: message-id=<371220b3c366429d29fb198cfb7e2c6e@mccrystal.co.za>
I have been advised to shut it down and start afresh from backups.

How can I be sure that the new installation won't have just the same problems? Can I restore it on the same server? The server IP has been blacklisted and I'm reluctant to just make it somebody else' problem.

There are 2 websites on the server, one a Joomla 2.5 installation and the compromised website is a Joomla 3.0 site.

The server is a VPS running Debian 7.
 
Old 01-12-2016, 10:45 AM   #2
POSIX
LQ Newbie
 
Registered: Jan 2016
Posts: 9

Rep: Reputation: Disabled
Is the domain itself blacklisted, or just the IP address? Getting rid of a blacklist infraction is harder than it's worth. I agree that you shut it down and start over again to be honest. And buy an SSL certificate for the new site.

If you want to try, here is a concise guide to get it unblocked: http://whatismyipaddress.com/blacklist-removal

Good luck!
 
Old 01-12-2016, 11:17 AM   #3
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Abingdon, VA
Distribution: Catalina
Posts: 9,374
Blog Entries: 37

Rep: Reputation: Disabled
Joomla! 3.4.8 Released.
 
Old 01-15-2016, 02:09 PM   #4
cov
Member
 
Registered: Apr 2005
Location: Durban
Posts: 436

Original Poster
Rep: Reputation: 30
If I type 'mailq' I get a list of mail coming through:

Quote:
028EC29BFF* 729 Mon Jan 4 20:11:27 accredit@jasonsugarman.co.uk
xxxxxxx@yahoo.com
713A868735* 1862 Mon Jan 11 01:09:12 shannon_ramsey@mccrystal.co.za
xxxxxxx@gmail.com
11A9E24855* 752 Mon Jan 4 17:07:20 inner-directed@blomand.ent
xxxxxxx@salespoint.dealerconnection.com
D1ACF22774* 1447 Thu Jan 7 16:54:42 bobbie_walsh@mccrystal.co.za
xxxxxxx@yahoo.com
A52DB66C77* 2417 Fri Jan 8 16:13:25 allison_moore@mccrystal.co.za
xxxxxxx@hotmail.es
9BBEC2C1EE* 700 Mon Jan 4 21:09:13 jerseys@casso.com
xxxxxxx@yahoo.com
DC05C2FFF2* 753 Mon Jan 4 23:17:41 snappers@peoplesfinancial.net
xxxxxxx@yahoo.com
A0EC82B5B6* 951 Mon Jan 4 20:51:04 meander@dunnbt23.freeserve.co.uk
xxxxxxx@videotron.ca
8890624553* 1382 Fri Jan 8 00:20:42 marion_ballard@mccrystal.co.za
petko1979@yahoo.com
201266627D* 2058 Mon Jan 11 13:32:58 eileen_flores@mccrystal.co.za
xxxxxxx@gmail.com
2F40D22581* 814 Mon Jan 4 16:23:46 kinky@discountireco.com
xxxxxxx@comcast.net
0A01B3161D* 820 Tue Jan 5 00:06:05 engagingly@gdca.com
xxxxxxx@yahoo.com
73DC12BB17* 691 Mon Jan 4 21:04:16 parrots@ca-pc.com
xxxxxxx@yahoo.com
0CD0366FBF* 2048 Wed Jan 13 15:11:42 candace_strickland@mccrystal.co.za
xxxxxxx@live.com.mx
when I ran something like: postcat -vq 730FA253B0|grep X-PHP-Originating-Script I got

Quote:
regular_text: X-PHP-Originating-Script: 33:model43.php(1970) : eval()'d code
I was able to locate the model43.php file which was in ~/public_html/wp-content/plugins/cache

I removed the 'wp-content' directory and it's contents (this is a Joomla installation). I also found thousands of html files in the root directory with names like "001320-Cartier-watches-xxxx.html", etc which I also removed.

I then rebooted.

I had expected that running the mailq command would show an empty queue, but it doesn't appear that there is any let up in the spam coming through.

However, the calling script is no longer referenced.

postcat -vq 73DC12BB17 gives:

Quote:
postcat: name_mask: all
postcat: inet_addr_local: configured 2 IPv4 addresses
postcat: inet_addr_local: configured 2 IPv6 addresses
*** ENVELOPE RECORDS active/73DC12BB17 ***
message_size: 691 625 2 0 691
message_arrival_time: Mon Jan 4 21:04:16 2016
create_time: Mon Jan 4 21:04:16 2016
named_attribute: log_ident=73DC12BB17
named_attribute: rewrite_context=local
sender: parrots@ca-pc.com
named_attribute: log_client_name=localhost
named_attribute: log_client_address=127.0.0.1
named_attribute: log_client_port=42576
named_attribute: log_message_origin=localhost[127.0.0.1]
named_attribute: log_helo_name=awcabcfb
named_attribute: log_protocol_name=ESMTP
named_attribute: client_name=localhost
named_attribute: reverse_client_name=localhost
named_attribute: client_address=127.0.0.1
named_attribute: client_port=42576
named_attribute: helo_name=awcabcfb
named_attribute: protocol_name=ESMTP
named_attribute: client_address_type=2
named_attribute: dsn_orig_rcpt=rfc822;xxxxxxx@yahoo.com
original_recipient: xxxxxxx@yahoo.com
recipient: xxxxxxx@yahoo.com
*** MESSAGE CONTENTS active/73DC12BB17 ***
regular_text: Received: from awcabcfb (localhost [127.0.0.1])
regular_text: by mccrystal (Postfix) with ESMTP id 73DC12BB17
regular_text: for <xxxxxxx@yahoo.com>; Mon, 4 Jan 2016 21:04:16 +0000 (UTC)
regular_text: Message-ID: 001a01c4f069$5535cf96$3916bb3a@parrots@ca-pc.com
regular_text: From: "Levitra Last" <parrots@ca-pc.com>
regular_text: To: xxxxxxx@yahoo.com
regular_text: Subject: Cialis Generic Levitra conventional
regular_text: Date: Mon, 4 Jan 2016 23:04:16 +0200
regular_text: MIME-Version: 1.0
regular_text: Content-Transfer-Encoding: quoted-printable
regular_text: Content-Type: text/plain; charset="UTF-8"
regular_text:
regular_text: http://zgjazb.com/sirree
regular_text: Cialis!
regular_text: Generic Levitra
regular_text: Generic Levitra is an FDa-approved oral prescription medication for the tre=
regular_text: atment of erectile dysfunction (ED) in men.
regular_text: Levitra Last
regular_text:
*** HEADER EXTRACTED active/73DC12BB17 ***
named_attribute: notify_flags=1
original_recipient: mailarch@localhost
done_recipient: mailarch@localhost
*** MESSAGE FILE END active/73DC12BB17 ***

Last edited by cov; 01-15-2016 at 02:25 PM.
 
Old 01-15-2016, 02:33 PM   #5
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=15, FreeBSD_12{.0|.1}
Posts: 6,269
Blog Entries: 24

Rep: Reputation: 4206Reputation: 4206Reputation: 4206Reputation: 4206Reputation: 4206Reputation: 4206Reputation: 4206Reputation: 4206Reputation: 4206Reputation: 4206Reputation: 4206
Quote:
Originally Posted by cov View Post
I removed the 'wp-content' directory and it's contents (this is a Joomla installation). I also found thousands of html files in the root directory with names like "001320-Cartier-watches-xxxx.html", etc which I also removed.

I then rebooted.

I had expected that running the mailq command would show an empty queue, but it doesn't appear that there is any let up in the spam coming through.
That is why you MUST take that server offline!

There is not a single file that can be cleaned or removed. There are likley thousands and others which you have not yet identified which are capable of writing yet more...

So long as that machine remains online you will never clean it up and it will continue to delive SPAM.

Shut it down. If you need to do forensics then do them with it off line. Otherwise wipe it down, reinstall from the OS up and be sure that it is properly configured and uppdated before returning it to servce.
 
Old 01-15-2016, 02:37 PM   #6
cov
Member
 
Registered: Apr 2005
Location: Durban
Posts: 436

Original Poster
Rep: Reputation: 30
I've shut the postfix server down.

I don't want to stop the apache server down as it has other sites running on it.
 
Old 01-15-2016, 02:42 PM   #7
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=15, FreeBSD_12{.0|.1}
Posts: 6,269
Blog Entries: 24

Rep: Reputation: 4206Reputation: 4206Reputation: 4206Reputation: 4206Reputation: 4206Reputation: 4206Reputation: 4206Reputation: 4206Reputation: 4206Reputation: 4206Reputation: 4206
Quote:
Originally Posted by cov View Post
I've shut the postfix server down.

I don't want to stop the apache server down as it has other sites running on it.
Then it is very unlikely that you will be able to clean it up as the script corruption and control come in via http.

It will be very difficult to reinstall the OS and all software while keeping apache running.

Last edited by astrogeek; 01-15-2016 at 02:43 PM.
 
Old 01-15-2016, 02:51 PM   #8
cov
Member
 
Registered: Apr 2005
Location: Durban
Posts: 436

Original Poster
Rep: Reputation: 30
Yes. It will, won't it?

Ok. I suppose it has to be done.
 
Old 01-15-2016, 02:57 PM   #9
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=15, FreeBSD_12{.0|.1}
Posts: 6,269
Blog Entries: 24

Rep: Reputation: 4206Reputation: 4206Reputation: 4206Reputation: 4206Reputation: 4206Reputation: 4206Reputation: 4206Reputation: 4206Reputation: 4206Reputation: 4206Reputation: 4206
Sorry to be the bearer of bad news...

When you reinstall be sure to use and keep updated the Joomla frameworks, do not reuse backups until you have verified them to be clean (also somewhat difficult to do with certainty), and be sure the VPS is adequately protected by firewall and well considered configuration.

Wish there was another way but the advantage is to the SPAMMERS on today's internet.
 
Old 01-15-2016, 03:01 PM   #10
cov
Member
 
Registered: Apr 2005
Location: Durban
Posts: 436

Original Poster
Rep: Reputation: 30
The site in question has a backup from early last year which I'm pretty certain is clean and I suspect it's the last time any changes were made.

The other sites *seem* to be clean without any suspicious files.
 
Old 01-16-2016, 11:22 PM   #11
cov
Member
 
Registered: Apr 2005
Location: Durban
Posts: 436

Original Poster
Rep: Reputation: 30
Ok, I've downloaded and installed maldet:
https://www.rfxn.com/projects/linux-malware-detect/

THis identified 2 php scripts which I have removed.

I've brought the server back up and so far the mailq is within acceptable limits.

I'm going to keep a close eye on it, but it seems to be behaving. I'm not sure if this will obviate a need for a complete wipe, but so far it looks very hopeful.
 
Old 01-17-2016, 12:05 AM   #12
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=15, FreeBSD_12{.0|.1}
Posts: 6,269
Blog Entries: 24

Rep: Reputation: 4206Reputation: 4206Reputation: 4206Reputation: 4206Reputation: 4206Reputation: 4206Reputation: 4206Reputation: 4206Reputation: 4206Reputation: 4206Reputation: 4206
Quote:
Originally Posted by cov View Post
Ok, I've downloaded and installed maldet:
https://www.rfxn.com/projects/linux-malware-detect/

THis identified 2 php scripts which I have removed.
I would be very surprised if that solves the problem, but do not want to seem overly negative.

Quote:
Originally Posted by cov View Post
I've brought the server back up and so far the mailq is within acceptable limits.

I'm going to keep a close eye on it, but it seems to be behaving. I'm not sure if this will obviate a need for a complete wipe, but so far it looks very hopeful.
Define "acceptable limits"... is it still sending SPAM, but less than before? The only acceptable limit for a spambot is zero.

Please do monitor it closely and keep us updated.
 
Old 01-17-2016, 12:15 AM   #13
descendant_command
Senior Member
 
Registered: Mar 2012
Posts: 1,876

Rep: Reputation: 643Reputation: 643Reputation: 643Reputation: 643Reputation: 643Reputation: 643
Just because it's not sending via your mail server doesn't mean it's not still sending spam (or being used for other purposes).
Without being VERY sure when/how it was compromised and EXACTLY what changes were made and that you have undone ALL of them and closed the original vector(s) I would still be VERY suspect of it.
One might imagine an insurance company not being pleased to discover the server their clients interact with is owned by "someone else".
 
1 members found this post helpful.
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Want steps to enable smtp authentication in postfix bittus Linux - Newbie 1 12-10-2009 12:26 PM
joomla website compromised ? farslayer Linux - Security 14 12-29-2008 10:45 PM
Fedora Core 2 Mail server ssl and smtp configuration steps harish_neo Linux - Networking 4 10-13-2004 10:46 AM
likelihood of being compromised by visiting a suspicious website TheOneAndOnlySM Linux - Security 5 06-28-2004 04:38 PM
Gnome.org website compromised Capt_Caveman General 6 03-24-2004 07:14 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 08:42 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration