• Hello. I’ve read all of the WordPress anti-hacking sites I can find but my sites keep getting hacked. The only thing affected is the main index.php file. I’ve even set the file to read-only and it still keeps getting changed. Can someone give me some pointers on this?

    It’s running on my personal Windows 2008 R2 box with the latest version of PHP for Windows and the latest WordPress site with IIS 7. None of the other non-Wordpress sites on my box are being affected. Thanks for any help.

Viewing 15 replies - 1 through 15 (of 21 total)
  • You say, “I’ve read all of the WordPress anti-hacking sites I can find.” It might help if you say what you’ve tried so far. For example:

    * Do you have a user called “admin”? If so, changing that to something else is the biggest thing you can do to prevent hacking.
    * Have you changed the password for WordPress, your database, and your FTP to different strong ones?
    * Have you installed “Limit login attempts” and “Ban” plugins, and started banning IP addresses as soon as you receive notice that they have attempted to log in too many times?

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    Ask your hosting providers to help you.

    Thread Starter Computerflake

    (@computerflake)

    Andrew, I think you missed the part about me being my own host.

    Here’s what we’ve done so far and the results. It may not be a hacking issue.

    We’ve changed the ftp passwords and the WP passwords to something insanely complex.
    We’ve gotten rid of the admin account names.
    I haven’t done the Ban plugins because I haven’t heard about those. I’ll check it out.
    I’ve checked the IIS permissions and they are set according to the documentation I’ve read.

    DAILY the site starts throwing a HTTP Error 500 (Internal Server Error): An unexpected condition was encountered while the server was attempting to fulfill the request. I restore from tape and they site starts to work again so I know it isn’t a database issue. I restore it with the default user permissions so I don’t think it’s a permission issue.

    The guy that maintains the sites on the box says the index.php files are being overwritten with a php line that redirects to another site. No other files seem to be affected. It will work for days and then start throwing this code until the restore is done.

    Any ideas or help would be greatly appreciated.

    The guy that maintains the sites on the box says the index.php files are being overwritten with a php line that redirects to another site.

    In indication of malware.

    Thread Starter Computerflake

    (@computerflake)

    I’ve scanned the box twice with Symantec and Malwarebytes and both come back clean.

    Generally malware detection tools detect only malicious codes that are identified offenders. They rarely report adware or injected links to other sites because they appear as innocent as any other normal links your site has or you may yourself publish. You can generally identify them with the presence of strange scripts that keeps on adding such links, even at some specified times, days, or even rotate links (as in ads).

    @computerflake

    Just thinking out loud here, but were there any clues in the activity logs for the periods prior to the repeated appearance of the 500 error?

    Have you been able to save a copy of the corrupted site directory and run a comparison against the known good copy of the directory just to make sure that the only difference really is just the index.php file (think PHP shell), or was the determination with regard to the affected files made by casual/visual observation only?

    Have you considered the possibility of an untrusted plugin or questionable theme that’s been installed by a user on that particular site? Those items may be worth taking a closer look at.

    Just tossing out ideas…

    Thread Starter Computerflake

    (@computerflake)

    I don’t see how it could be a plugin because it’s happening to several sites and they all use different plugins.

    Here’s what I’ve found out:
    It’s definitely a hack of some sort. It added a base64_decode statement to the index.php files. I can remove the code but the site starts giving a 500 internal server error. To make the error go away and start the site back up, I have to restore the wp-includes folder from tape. Then the site comes back up and works fine.

    I’m restoring one of the damaged sites now (file by file!) and hope to find which file is causing the site to not start. That might give me some more ideas on what to do next.

    Thanks for all of the ideas. I really appreciate the help.

    Lots of eye openers and good general ideas in this codex page: Hardening WordPress I imagine you’ve probably covered most of them already. Shared server security and log monitoring can be a pretty tricky task. Good luck!

    Thread Starter Computerflake

    (@computerflake)

    Sure have with no luck. Apparently this hacker idiot has me on his cronjob list because all of those files were just overwritten again…like clockwork.

    Thread Starter Computerflake

    (@computerflake)

    I’ve narrowed it down a bit. When the hacker does his overwriting of the index.php file, I have to restore it and the functions.php file inside wp-includes before the site will come back online. The database doesn’t appear to be affected because restoring those two files will bring the site immediately back up. Not sure what to make of that.

    Thread Starter Computerflake

    (@computerflake)

    Turned out to be some kind of php malicious code. Nothing caught it. I had to compare the corrupt files with the good WP files from a fresh install (using Notepad++) and then sync the good files over the top of the bad files (using Synchromat) and the sites came back up cleanly. I’ve told the people who maintain the sites to be mindful of their php files before they upload them and it should keep it from coming back. Crazy stuff.

    I wanted to say I appreciate all of the help and ideas from you folks. You got me headed in the right direction and that led to a resolution. Thanks for sticking with me on this!

    Thread Starter Computerflake

    (@computerflake)

    It wasn’t a hacker as far as I can tell. The site was re-infecting itself. The code has been removed and I’ve hardened the site. It should be fine now. I’ve also read those sites until my eyes bled.

    The site was re-infecting itself.

    That’s called a hacker back door. ??

Viewing 15 replies - 1 through 15 (of 21 total)
  • The topic ‘Keep getting hacked’ is closed to new replies.