Site hacked
-
Hi all,
I always keep my wordpress site up to date with the latest version of WordPress (recently updated to 4.2.1), same goes for my plugin and theme files. I also use a very strong password that follows all the recommendations.
Yet today, my site was hacked. My wp-admin and wp-content files were removed from the server, my .htaccess file was erased and replaced with just one line of code, and the offender configured my site to display their content. (Some fanatical religious group)
I have to wait until tomorrow for my hosting provider to restore the site. Very frustrating.
Any ideas on how this could have happened and where I should be looking to fix vulnerabilities, so it doesn’t happen again?
Thoughts?
-
You could have a vulnerability on your local machine, and it would be worth running some free scanners such as ESET and malwarebytes. Or the server could be the culprit if your site is on shared hosting (your hosts will have a better idea). Also, if you access your site through public wifi, this can allow your credentials to be compromised.
As you mention wp-content/wp-admin were removed, .htaccess wiped. This suggests access through the cPanel/WHM/FTP. Are your credentials also strong here? Do you use encryption through your FTP client?
Sometimes it’s just hard to know for sure, but it’s great to know you have the option to restore from a clean backup, and this can be good motivation to ramp up security to another level.
The codex has excellent advice on hardening WordPress:
http://codex.wordpress.org/Hardening_WordPressAlso, the security plugin ninja firewall gives you notifications when an admin level user is created/logs in, or a recently modified file is created/accessed, and also takes a snapshot of your system which you can the check later to know which files have been added/deleted/modified.
Finally, how about having your own backup plugin just in case your host ever has issues with their backups? Belt and braces as they say in the north of England π
Best wishes with getting back up and running again.
barnez, thank you for your very helpful response!
My site is on shared hosting, so a weakness on the server is something I’ll discuss with my hosting provider this morning.
I do not access my site through public wifi, but only from my home network. In fact, I had configured my wp-login so that it could only be accessed from my home IP address!
I have a copy of my site on my local drive (using MAMP) and a recent back-up of my content, but I’m so worried about hidden files or malware having been introduced that I prefer to let my provider restore from back-up.
Thanks so much for the free scanner & plugin recommendations. I will definitely check those out.
use plugins like ithemes security and BulletProof Security
use https://www.cloudflare.com/scan your pc with malwarebytes
Sounds like you have things pretty well covered, though it would be prudent to make sure these points are worked through, if you haven’t already:
– checking and removing any unknown administrator level users in the WordPress dashboard >> Users and/or in the database
– changing all passwords – WordPress dashboard/cPanel or WHM/MYSQL database
– change your salt keys in yourwp-config.phpfile to log out all existing usersThank you! I will address all of those points right away.
My hosting provider believes the exploit happened via a security vulnerability in the all-in-one SEO plugin, which was fixed via an update on April 20. However, I’m sure all my plugins were up to date….
I suppose the vulnerability may have exposed your site until the update was rolled out. Perhaps that was the entry point?
It sounds like you have a great host there, which is priceless in situations like this.
Also, scan your local computer for viruses/Trojans. A lot of times that’s where the problem is. Your personal computer gets hacked or you have a Trojan installed and they grab your password from there.
Don’t overlook that as another entry point.
@barnez, thank you, I feel somewhat more secure having made these changes. (My salt keys had vanished, it seems!) Would installing a plugin like WordFence be worthwhile? I had installed it a few weeks ago but since the latest WP upgrade promised “brute force protection” I later deleted it.
@salescart, I use a Mac running the latest version of Yosemite (10.10.3). I’ve read on Apple forums that anti-virus is not much use on Mac systems as they have built-in security processes. But now I’m not so sure. Do you have any recommendations?
FWIW, a strange visitor appeared in my web logs just before the attack. They spent around 30 minutes on the site, but logged pageviews only for my home page and this strange URL. (I had made no uploads at all in May, so it was not a legitimate URL).
i.e., the visitor path looked something like this:
www. mydomain.com
www. mydomain.com/wp-content/uploads/2015/05/qx.ph
www. mydomain.com
www. mydomain.com
www. mydomain.com
www. mydomain.com
www. mydomain.comI strongly suspect this visitor may have been the culprit.
Thankfully, everything has been restored now!
Glad that helped, and yes, you’re definitely more secure with those salt keys reinstated.
I wasn’t aware of any brute force protection with WordPress 4.2, and usually that requires a plugin such as Wordfence or iThemes. I don’t have any experience with iThemes, but know that Wordfence also carries out a daily scan that warns you of outdated plugins/themes/Wordpress core and any security threats it detects. This can be useful to give you additional peace of mind after a site being compromised.
Yep, that’s definitely very suspicious. Regarding the brute force protection, I’ve just remembered that your login is only accessible from your home IP. In that case, brute force protection would be unnecessary.
My mistake, it’s WP’s JetPack plugin that now offers a “Protect” module that claims to offer brute force protection. (Users can designate their IP address on a whitelist.) Clearly, it didn’t do much in this case…
4.2.1 was released to fix cross scripting
to figure out what files were/are infected zip up the site and run it via Virustotal (if under 200mb)
I would break the site down into smaller and smaller gtoups of files until I figured out the offending code.
The first thing you need to do is secure your hosting change your passwords, use lastpass to generate secure 16 character complex passwords.
If you use cPanel and have more than one site you are vulnerable from one site (under your login) affecting another. One of the reasosn I do not use cPanel).
I would install new wordpress on a new DB, then import the site bit by bit after I have verified all files.
I would not re-import the user, options and user meta files from old site.
Remember that once a hacker has access to your FTP they can get access to your files which themselves give access to your DB.
I know you are worried about this but doing this gives you technical ability to take ownership of problems.
I would get wordfence, the free version is probably enough, although the paid version does have the ability to prevent access to the admin page from specific countries. I have found that excluding China, Russia, Ukraine and Romania cut 99% of attempted hacks. Then I decided to only authorize actual countries I wanted to have access to the Admin.
From what you describe it seems that they managed to put a file on the public facing site, then they ran that URL to test it, it probably infects users and chances are they would spam people to visit that link which would infect their PC
For SEO use Yoast, better IMO anyway!.
@rickc4, Thanks for your great tips. I just scanned the URL of my website on Virustotal and it comes up clean (now that everything has been restored), but I will have to take a closer look at the individual files, just to be sure.
I’ve installed WordFence and hope it, along with the other recommendations in this thread, will help prevent another attack. (Hope it doesn’t place too much of a load on the server.)
Many thanks to everyone for the excellent suggestions. It’s been a learning experience!
The topic ‘Site hacked’ is closed to new replies.