?
Solved

I was hacked - apache -webhosting

Posted on 2010-08-18
15
Medium Priority
?
1,405 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 1000 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
Learn how to optimize MySQL for your business need

With the increasing importance of apps & networks in both business & personal interconnections, perfor. has become one of the key metrics of successful communication. This ebook is a hands-on business-case-driven guide to understanding MySQL query parameter tuning & database perf

 

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 1000 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 1000 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

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!

Question has a verified solution.

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

When it comes to showing a 404 error page to your visitors, you do not want that generic page to show, and you especially do not want your hosting provider’s ad error page to show either. In this article, I will show you how to enable the custom 40…
Meet the world's only “Transparent Cloud™” from Superb Internet Corporation. Now, you can experience firsthand a cloud platform that consistently outperforms Amazon Web Services (AWS), IBM’s Softlayer, and Microsoft’s Azure when it comes to CPU and …
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Suggested Courses

771 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