Word Press - Someone wrote to index.php

Posted on 2015-02-07
Last Modified: 2015-02-09
I was visiting a website I created in WordPress.  When I went to, I got this javascript alert:
"your site may be victim of hackers we offer a solution can contact us"

after downloading the site files, I see that index.php has been physically changed to include this code at the very top:
alert('your site may be victim of hackers we offer a solution can contact us')

I removed it and the site is back to normal.

What I'm wondering is, how can someone write to index.php?  Are there security settings I should've been aware of?
I'm using a theme I made - only the second one I've ever done, but I don't know how that would open up WordPress to a hacker.

No other sites on my server seem to be affected (including WordPress sites).

Any suggestions on things I can do to make sure this hack doesn't happen again?  I'm sure it will...

Question by:slightlyoff
  • 3
  • 2
LVL 70

Accepted Solution

Jason C. Levine earned 250 total points
ID: 40596307
What I'm wondering is, how can someone write to index.php?  Are there security settings I should've been aware of?

Sort of.  What happened is your hosting is compromised or you have vulnerability in a plugin or theme file that is being exploited.

I've written an in-depth article on this:

Assisted Solution

by:Alicia St Rose
Alicia St Rose earned 250 total points
ID: 40597814
You might want to sign up for services. They are WordPress friendly! They will monitor your site and stamp out anything they find right when it's starts to happen.

They got rid of some crazy Viagra links that wouldn't die from one of my client's sites.

Author Closing Comment

ID: 40598319
Thank you for the help!  I'll take a look at Securi - I downloaded and installed the plugin so we'll see how that goes.
I appreciate the info as well!
Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

LVL 70

Expert Comment

by:Jason C. Levine
ID: 40598424
Sucuri's plugin does very little by itself.  You would be better off with WordFence...

Author Comment

ID: 40598430
I'll take a look at that one as well.  Thanks for the heads up.  I might use the service Sucuri offers as well - but being that this was my first theme - I wanted to really know what I missed (if it's my theme that's causing the leak)...  very annoying.  

Thanks again for the help!!!
LVL 70

Expert Comment

by:Jason C. Levine
ID: 40598448
Might be your theme, but if you hand-coded it yourself then it's more likely a plugin or a folder/file permission set too high. If you altered an existing theme, it might be there.

If you are willing to pay for Sucuri's service, then the plugin and the service get a lot more awesome.

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
WP WooCom Prob 7 68
remove background quote mark from widget 6 50
WordPress Nightmare 30 47
wordpress on root is limiting my .htaccess 404.php options 4 25
Like there are many different versions of Wordpress, there are also a handful of related side projects WordPress users should be familiar with.   All of these projects are open source and GPL licensed, which means there are few restrictions to us…
I want to start by talking about the use of plug-ins for WordPress. I started a web-site for a company I was working for a few years ago; I had extremely basic knowledge of HTML. I am a Graphic Designer by trade so I invited the opportunity as a cha…
This video teaches viewers how to create their own website using cPanel and Wordpress. Tutorial walks users through how to set up their own domain name from tools like Domain Registrar, Hosting Account, and Wordpress. More specifically, the order in…
The purpose of this video is to demonstrate how to exclude a particular blog category from the main blog page. This is can be used when a category already has its own tab, or you simply want certain types of posts not to show up on the main blog. …

785 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