Koozali.org: home of the SME Server

spam mails from the serevr

Offline davidS

  • ****
  • 80
  • +0/-0
spam mails from the serevr
« on: January 18, 2013, 03:14:48 PM »
Hello Friends
A month ago, someone hacked my websites on the server, all of my sites are based on Joomla.
i managed to replace all the damaged files and all my websites are working normally.
 But still they manage to send hundreds of spam emails  from the server out, I tried every possible way that  there is in the sme  forum, I followed many posts but with no luck.
I can see a lot of "post in the " httpd_access log " and I know from witch ibay they are but after cleaning it I see the next day from another so I am lost and I need an expert help.
Is there Someone please who can help me ?
my server is now a spammer because of.
Thanks David

Offline janet

  • *****
  • 4,812
  • +0/-0
Re: spam mails from the serevr
« Reply #1 on: January 18, 2013, 04:14:52 PM »
sibony88

Quote
i managed to replace all the damaged files and all my websites are working normally.

It sounds like you repaired the hacked server.
There may be many hidden rogue scripts or back door hacks still on your server.

You really need to reinstall the server OS & reinstall contribs so your server is clean.
Then restore the data from a backup, but you need to be careful that the backup does not contain hacks.

I'd also ask were you keeping all copies of Joomla up to date ?
Were you keeping all copies of other contribs & web apps up to date ?
Were you running the latest sme server OS with updates ?
Were/are you still using insecure access methods eg ftp ?
Have you correctly secured the ibays ? (eg against shared tmp folders cross hacking etc)
Please search before asking, an answer may already exist.
The Search & other links to useful information are at top of Forum.

Offline Stefano

  • *
  • 10,894
  • +3/-0
Re: spam mails from the serevr
« Reply #2 on: January 18, 2013, 04:57:22 PM »
A month ago, someone hacked my websites on the server, all of my sites are based on Joomla.
i managed to replace all the damaged files and all my websites are working normally.

a hacked machine can't be repaired, must be reinstalled from scratch

Offline davidS

  • ****
  • 80
  • +0/-0
Re: spam mails from the serevr
« Reply #3 on: January 18, 2013, 05:44:06 PM »
Mary and stefano  thank you for the quick replay, i really appreciate it. 
for your questions, the server and the joomla are up to date and the ftp is now close to outside local only.
If you can explain to me how or what is secured the ibays (eg against shared tmp folders cross hacking etc)  ? please
 think I will reinstall the server , my only concern is that the backup will be also hacked .
Any suggestions ?

Offline janet

  • *****
  • 4,812
  • +0/-0
Re: spam mails from the serevr
« Reply #4 on: January 19, 2013, 12:50:56 AM »
sibony88

Quote
for your questions, the server and the joomla are up to date and the ftp is now close to outside local only.

Just out of interest, were the various installs of Joomla "up to date" when the original hack occurred ?
Also was your server "up to date" when the original hack occurred ?
Also were ALL other apps or contribs  (not just web apps/contribs) also "up to date" when the original hack occurred ?

Did you actually determine the exact nature of the attack, ie did you identify a vulnerability in Joomla, or PHP version or something else etc etc ? Was there published information about this vulnerability & what it does to systems ?
Keep in mind that one vulnerability may interact with another vulnerability to allow access to a hacker, so "all parts" of "everything" must be kept up to date.

As mentioned previously, the hacker(s) may have left numerous "back doors" on your system, so if you remove one problem (eg update Joomla), they can then use other exploits still on your system. These can be & usually are hidden in or amongst system files, so that is why it is important to reinstall your server OS and reinstall contribs etc.


Quote
If you can explain to me how or what is secured the ibays (eg against shared tmp folders cross hacking etc)  ?

In particular the open base dir restriction issue where a common tmp folder is specified for all ibays & PHP contribs, but there may be other issues eg wrong permissions on folders & files, inappropriate settings (from a security point of view) both for the ibay & the contrib within the ibay, and ensure that ONLY strong passwords are used for ANY & ALL passwords on your system
http://wiki.contribs.org/PHP#Open_basedir_restriction

There was a recent (in the last few weeks) forum thread discussion about pros & cons of the php tmp files, so check that, but essentially every contrib should use seperate php tmp files only within that contribs application files path & therefore not accessible to any other contrib or user etc. In my opinion the wiki article needs improvement as it specifies a common /tmp folder, been too busy to make any changes myself just yet.


Quote
think I will reinstall the server, my only concern is that the backup will be also hacked .

There is no magic answer here, finding out when the ORIGINAL hack occurred can give you a timeline to see if older backups were not affected (ie infected).
The hacker may have gained access before it became apparent to you as non functional sites etc, so you really need to go back in time and restore from a known good (ie clean) backup, assuming of course you have retained old backups (which is a highly recommended thing to do). Affa helps a lot in this regard, but it is really a function of your backup policy & regime.

It maybes best that you only partially enable all sites on your server, ie turn on one Joomla website only, and see if hacking or errant emails/spam still occurs. After a while (a day or two or three) turn on other sites (one by one, not all at the same time) and observe system behaviour.

If you restored some sort of exploit from a backup, then the above approach may help you identify it.
The problem is the hacker may have again corrupted your whole system with only one exploit being allowed to operate (ie coming from your restored backup).
In your current case it sounds like there is still an exploit residing on your repaired system.

You really have to be very careful in these situations, or you will just end up with another corrupted server and have to go through the whole process again.

It may be a a case of rebuilding your server slowly, one contrib at a time, and using selective restore, ie after reinstalling a fresh OS, then reinstall the Joomla contrib for one site into one ibay, restore (via dump or whatever) the database for that site from the backup, and then see if the new server and the first new site works OK. When all is good, do the same with the next site etc.

It will depend on your situation, whether you have older (known good) backups to restore from etc, BUT you MUST reinstall a clean OS (ie overwrite any existing install) and reinstall all contribs & apps etc, that's the only way to ensure a "clean" server.
Please search before asking, an answer may already exist.
The Search & other links to useful information are at top of Forum.

Offline davidS

  • ****
  • 80
  • +0/-0
Re: spam mails from the serevr
« Reply #5 on: January 19, 2013, 06:15:46 PM »
 :-) Thank you
I will start working on it, I have a lot of work..... :???: