Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Possible Duplicate:
My server's been hacked EMERGENCY

I just discovered that my site has, I believe, been hacked. Along with a couple of other sites on my host. If you go to the bottom of the site you'll see an iframe. I don't know what that is, it shouldn't be there.

I deleted all the code from my site and it's still there.

I checked htaccess thinking maybe someone added auto_append. Nothing.

Any clue as to how else something can be added to the bottom of my site?

I'm currently downloading some log files to look through.

share|improve this question

marked as duplicate by Iain Sep 30 '12 at 18:50

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

    
Are you using a CMS or anything else where the admin features may not be locked down? Could be a permissions problem but it's hard to say without more information. I may be pointing out the obvious but password protecting admin directories is always a safe way to go. –  rich Jun 5 '09 at 1:22

7 Answers 7

First thing to do is alert your hosting company. They will be able to look at logs you don't have access to.

Secondly: I see your using Wordpress. You need to:
-Check and see if Wordpress is up2date
-Check and make sure that all of your Wordpress Plugins are also up2date

If any of the above are not up2date, you need to check and see if the version you are running has a known vulnerability. (Check the software's site, etc)

Start going through your webroot to find any out of place files. Make sure to look in temp dirs also.

If it is found to be a bad hack, you will want to restore from a known good backup.

This should get you started in the right direction.

Anapologetos

**Edit: Please Ignore / Thumb Down XTZ's answer. It is reactionary and dangerous, not to mention inaccurate.

share|improve this answer
    
hosting company alerted. hopefully theyll be able to see how they got in. –  Galen Jun 5 '09 at 2:27
    
If you want more info about the pdf exploits it looks like you are hosting, check out the internet storm center's posts over the past while on them: google.com/… –  Josh Brower Jun 5 '09 at 2:57
    
haha yeah ill ignore him. earlier i had a download box popup that tried to make me download a pdf. i was curious what that was. thank you –  Galen Jun 5 '09 at 3:14

If they were able to edit php.ini, I believe they could add a footer to every PHP page (which obviously, you wouldn't see in your own code). Make a test.php file and see if it still happens.

share|improve this answer
    
it's not happening on every php file –  Galen Jun 5 '09 at 2:05
1  
try viewing the source of a hacked page and grepping your home directory for some of footer. –  Mike Conigliaro Jun 5 '09 at 2:10
    
yeah i've been grepping. i found it in a couple of sites, but i cant figure out why i cant remove it! –  Galen Jun 5 '09 at 2:15
    
i don't know what you mean when you say you cant remove it. does it prevent you from editing the file, or does it just come back after you remove it? maybe there's a process scanning for files with well known names? did you try running chkrootkit? –  Mike Conigliaro Jun 5 '09 at 2:44

I went to the site in question, it tried to install a trojan like:

http://www.martinsecurity.net/2008/09/04/analyzing-a-malicious-pdf-trojpdfjs-a/

Loading a malicious PDF file with JavaScript. Viewing the code, it also looks very similar. Probably should be avoided unless you've locked down your computer. As for solutions, I think contacting your hosting company, as Anapologetos said, would be the essential first step.

share|improve this answer
    
i thought i got rid of the bad code. akdslfjlasdkfj;akfds –  Galen Jun 5 '09 at 3:23
    
You might have; I was originally looking at this when it was on SO, took me awhile to learn about de-obfuscating JS to find what it was. –  Todd Gardner Jun 5 '09 at 3:38
    
ok, thanks. i appreciate your help –  Galen Jun 5 '09 at 3:40

Aren't WordPress pages, like those of most CMSes, generated from a database?

If so, here's the dirty little secret of open-source CMSes, PHP, and shared web hosting: on many shared hosting servers, everyone's PHP scripts run with the same privileges (i.e. with the UID and GID of the Apache daemon).

This means that, if PHP can read your scripts, it can read the scripts of every other customer on the server. And vice versa.

But, many open-source CMSes store high-privilege database credentials in their PHP scripts. Drupal does this; Joomla does this; I haven't looked at the WordPress source but I'd be surprised if it didn't do this.

In short: It's extremely likely that fully-privileged access to your WordPress database is within trivial reach of every other user who shares the server with you.

I sort of hate to write that in bold but I feel like I've been banging my head against a wall with this issue for a few months now, during which time I've run into two, possibly three apparently-reputable hosting companies that use this setup, and just can't be bothered by the enormous security problem it presents.

share|improve this answer

What is that JavaScript code in your page source after the closing HTML tag?

Also I would get the extenstion that hides your WordPress version from the page source since it shows it as a meta tag (<meta name="generator" content="WordPress 2.7.1" />), for example, I can see you're running "WordPress 2.7.1" (which is the current version :claps:) but once a expoilt for that is found people will be able to search for it.

Also check the other files that your WordPress installation uses. I know that it can inculde and require (won't show up in page source since they are PHP based) from other files and I know that extenstions/themes can also do so make sure those are up to date.

Also check to see what extensions and themes are installed/enabled and get rid of any you don't know.

share|improve this answer
    
that javascript is the hack. i jsut dont know how to remove it –  Galen Jun 5 '09 at 2:18

Answering these questions should help you find the solution.

  • Is there a proxy between you and the server?
  • Have you ruled out browser plugins adding something?
  • Have you ruled out malware on your workstation?
  • Have you tried retrieving the page with telnet/netcat instead of using a browser?
  • Is this a server you maintain? You mention other sites, do they also have this problem?
  • What is the contents of the iframe?
share|improve this answer

(I don't have enough reputation, otherwise I would just post this as a comment, but...)

I went to the website, with Kaspersky Anti-Virus with very high security settings, and Kaspersky had to block a few attempts at hidden installations..

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.