Forum Moderators: phranque

Message Too Old, No Replies

Website security: how to stop the front page being hacked?

         

dedhed9

3:29 pm on Sep 15, 2006 (gmt 0)

10+ Year Member



The index page of one of my sites got hacked & changed the other day, the first time it's happened to me. Needless to say the host was no help and knows nothing about security measures.

How can I stop this happening again? On this particular site, there are no scripts running at all - it's totally flat html, with a reasonably strong password on the admin FTP and the control panel - but no doubt there are loopholes somewhere.

This must be a huge issue now, but since it didn't happen to me before, I never researched solutions. What's the answer?

stajer

4:10 pm on Sep 15, 2006 (gmt 0)

10+ Year Member



There are only a few possibilities here. Let me go over them in order of probability (the first ones are the most probable):

1. Does someone have access to your logins? Do you use public computers? Do you login to your site over unsecured wifi connections? Did you lose a laptop or cell phone with the information? In any case - change your passwords.

2. Even though you site in only flat html, did your webhost setup your account with default installed scripts? Those scripts may have been compromised or exploited? Do you have a /cgi-bin folder? Why? This is more likely than the ones that follow because hackers can exploit these scripts in mass - they don't target your site in particular, they look for any sites with these scripts running.

3. Google the text that the hacker put on your homepage - sometimes that will reveal the exploit.

4. Check your logs - especially your ftp logs. Looks for unusual activity from an IP - especially large amounts of traffic from one ip.

5. Are you sure all they did was change your homepage? Did they setup their own login? Did they install any scripts or pages in your directory? If you are running a dedicated server - did they install any software on your machine? Did they use the access on one machine to compromise another that is networked (ie. db or file servers).

6. Depending on the sensitivity of the information, you should consider the machine permantly compromised and move your site to another machine.

7. Good time to consider your backup - what would you have done if the hacker had deleted all your files? Do you have a full recent copy? How long would it take to recover?

pixeltierra

4:35 pm on Sep 15, 2006 (gmt 0)

10+ Year Member



>Needless to say the host was no help and knows nothing about security measures.

Hate to state the obvious here: get a new host. Fast.

That's the major reason I don't run my own servers. The security aspect alone is a full-time job. That's what you pay them for.

dedhed9

12:10 pm on Sep 16, 2006 (gmt 0)

10+ Year Member



Thanks for the suggestions stajer. Pixeltierra: I've got a feeling the response would be the same from many - if not most - hosting companies.

Stajer: I don't think the login is compromised, but it's easy to change the password, so I've done that. There are none of my scripts running, but there are 4 in the cgi-bin - don't know what they are: cgiecho, cgiemail, entropybanner.cgi, and randhtml.cgi. I deleted the hacker's page, so I can't remember any text on it - it was a Moroccan hacker who put up an anti-George Bush page. My webhosting on this site is a cheap package and the logs don't have origin IP's, except for the first part of the octet to identify main referral countries etc. I don't know if any other changes were made, but I can't see any. My site is only a simple marine data source for trade and DIY boat engineering, so it's not financially important; I've got a full recent backup always ready, that only takes a couple of minutes to FTP up.

However, I look after several other people's sites, including an ecommerce site with 8,000 pages - so I'd really like to know more about the security aspect, and how people with major sites prevent hacking. On the other hand, this important site is hosted with people who do look after their customers.

Thanks for your help.

Marcia

12:32 pm on Sep 16, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I had a site hacked last week, the whole thing! I caught it right away so I immediately nuked the files so s/e crawlers wouldn't catch the other pages, and then checked to find out that that server has open DNS.

I moved the site to my reseller account with a different provider and changed nameservers at the registrar within 15 minutes of finding it.

I was chatting with the manager at my hosting company the site is now moved to, and he says it's most often a case of finding holes, and scripts that are running are often the weak spot - even just using PHP includes.

He suggests *never* running scripts with their usual name, but changing them to some unique name of your own invention. Also, protecting directories if there's no index page so they can't be accessed in a browser (like the includes, image and cgi-bin folders) - which can be done easily through cpanel, which is what I use.

stajer

4:13 pm on Sep 16, 2006 (gmt 0)

10+ Year Member



It was probably one of those 4 default install scripts. Google the script name and the word exploit and you will probably find out how it was done. In any case, if you are not using those scripts, delete them.

Even if you logs don't show you the full IP, they will show you what pages/actions were taken on your site. Look at the logs for the 24 hours before you discovered the hack - look for any abnormal activity. You won't discover who did it, but you will see how it was done.

incrediBILL

8:19 pm on Sep 16, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I've got a feeling the response would be the same from many - if not most - hosting companies.

Absolutely not!

You sound like you're hosting with some clowns that don't even know how to check a server for vulnerable scripts.

Who in their right might would risk losing hundreds of customers hosting on a server over one customer making the server vulnerable?

A decent host would immediately examine all the scripts customers have installed and see where the vulnerability was and suspend the account until the customer corrected the error.

As someone else mentioned, another reason to have your own dedicated server.

the logs don't have origin IP's

That's not cheap hosting, that's stupid hosting.

dedhed9

1:23 am on Sep 17, 2006 (gmt 0)

10+ Year Member



I now believe the exploit involves one of the host's pre-installed cgi mail scripts, so I've deleted them. At the same time the Moroccan hackers did mine, a Turkish hacker, Iskorpitx, set 'a new world record' of around 30,000 sites hacked & the front pages changed. See info at: <url removed>

This was either a vulnerability in windows IIS (according to the host) or an .asp mail script exploit (which seems more likely). Windows servers are not known for their security...

I do have a cgi form-mail script running on one site, but I use a more secure version than Matt Wright's original script.

Googling the Moroccan's exploit, I was quite amused to see a bank's site was down for 7 hours while they checked their site out. Mine was down 2 minutes while I put the front page back.

You can find mega sites with info on firewalls (like Bluetack), and more than you ever wanted to know about securing your own PC; now I'm looking for the same kind of info on securing a website. I don't think it's a great idea to leave it all to the host - inevitably they won't cover everything. Many people seem to be using custom security solutions on their sites - you can see this on some BBs, which are no doubt more vulnerable to the script kiddies.

More research is needed here...

[edited by: tedster at 3:15 am (utc) on Sep. 17, 2006]