How To Detect And Prevent A Wordpress Spam Injection Attack

nth my WordPress blog was the victim of adetect software injections inserted into your site,
spam injection attack. I am the art director for ausually on a database level, via templates or
highly rated graphic design and website designplugins. This is part of the reason WordPress is
company. I have years of experience in websitesuch a target for these attacks. Plugins are what
design, WordPress Blog Design and I am securitymake WordPress so dynamic and cool, but they
minded in my approach to web development —are an open doorway for spam injection
I was still a victim of clever hacking. It can happensoftware. For obvious reasons we should all focus
to anyone and it is happening at an increasinglyour attention on prevention so that you don't
alarming rate. The worst part about thishave to deal with detection.
experience was that not only my WordPress blogWhat can I do to prevent a WordPress Spam
was attacked - my entire corporate website wasInjection Attack?
removed from Google SERPS. We were ranked inI'll start with the simplest things you can do to
the Google Top 10 for several coveted spotsprotect your WordPress blog or site from spam
such as; graphic design company, packaging designattacks first. . .
companies, brand identity company, and manyFirst: Update WordPress
more. Our site was completely out of GoogleUpdating WordPress is the easiest thing to do, so
search results for two weeks in which time wewhy not do it? I usually wait a short period of
lost countless leads. This experience absolutelytime after a new release to make sure the bug
sickened me! It also created way too many hoursfixes have been worked out. Please be aware
of work dedicated to repairing the hackersthat simply updating WordPress is NOT enough!
damage and recovering our website's GoogleSecond: Pick a good password
Rankings. During my research into fixing the spamPick a good password. Don't use the same
injection hackers damage I discovered that this ispassword on every site. If you're really diligent
a widespread problem with WordPress blogs. It'syou can also change your password regularly.
happening to thousands of people and it is notThird: Change the admin user name
limited to people using older versions ofThe default WordPress user name is "admin". This
WordPress.is just a guess, but I suspect that the majority of
Recovering from a WordPress Spam Injectionpeople never change this. Don't give any
attack is not fun, but you can regain your Googleinformation away. Hackers are clever, but like
Search Results after being hacked by a spamburglars they would rather move on to the easy
injection attack. If you've been compromised,score. You can change your admin by creating a
hopefully you have your website and WordPressnew user and then deleting the admin user. You'll
blog backed up. It can be a pretty tediousbe given the option to migrate posts to another
process to go through every file and folder onuser.
your server locating and deleting spam files. IFourth: Hide your WordPress Version Number
recommend backing up your WordPress postsDavid Kierznowski of blogsecurity.net lately
and completely removing all files and databasesreleased a simple plugin to hide your wordpress
from your server. Then do a complete freshinstallation version number.
upload of your website and a complete reinstall ofThe no version plugin is a simple plugin that will
WordPress.replace the version number with blanks, so
If you have already been removed from Googleanyone doing a view “page source” from
Search Results then you will want to notifythe browser on your site will not be able to see
Google immediately of what has happened. Theyour wordpress version.
best policy with Google is to be specific in yourFifth: Protect your plugins
explanations. You will need to make sure that youPlugins are the easy gateway way for hackers to
have removed all bad files from your server andaccess your blog. All WordPress files begin with
then contact Google again explaining what actions(wp-) by default so, hackers can quickly discover
you have taken to resolve the situation andwhich plugins you're using by going to /wp-content
submit your "request for reconsideration". In mostplugins/, if you haven't renamed your database
cases where a valid site has been hacked Googlefiles. A quick remedy to block a blank index.html
will restore their sites rankings within two weeks.file in the wp-content/plugins/ folder.
However, don't expect any notifications fromMore Complex Procedures:
Google on their progress of reevaluating yourFirst: Protecting your WP-Config file.
website or WordPress blog. I am writing thisThis file contains your database name, database
article in hopes that it will help anyone from havingusername and database password. Obviously, you
to go through that processs.don't want anyone to have access to something
What should you look for if you suspect athis valuable. If you don't feel comfortable making
WordPress Spam Injection Attack?changes to your config you may want to contact
The first thing you should look for is a list ofyour hosting company for help otherwise you can
spammy keywords showing up in your list ofadd the following code to your .htaccess file:
keywords located in your Google WebmastersPHP:
Tools. If you aren't using Google Webmaster1. # protect wpconfig.php
Tools then you should definitely look into this.2. {files wp-config.php}
When your site starts showing up in weird looking3. order allow,deny
search results, which can also be seen in Google4. deny from all
Webmaster Tools under search results for your5. {/files}
site, you need to act fast because at this pointSecond: Change your database names
Google will act fast to remove your site fromNote: do not attempt this unless you are
SERPS in order to protect others who may be atcomfortable with PHPMyAdmin and making
risk from visiting your website.changes to MySQL. If you are not comfortable
The key to detection is awareness. Be vigilant inwith this you should hire a professional to assist
monitoring your website and your website's stats.you.
Spam injections are a clever, effective form ofBegin by backing up your database!
hacking and show no outward signs of infection.Many people have problems with the database
However, If you do a Google Site Search fortable name prefix changing functionality of WP
spammy key words like; viagra} you will be ableSecurity Scan. You can manually change your
to see if your site is referencing spam keywords.database names following the instructions below.
You will not be able to see spam showing up on1. BACKUP your WordPress database to a sql file
your site. In order to physically see spam tags in- you can do this in "phpmyadmin".
your site you must go to the "cached" version of2. You should Deactivate your plugins as a
your web pages and view them in "text mode". Ifprecaution before proceeding. You can reactivate
you've been infected you will now be able to seethem after you have finished.
spam keywords, usually appearing as a footer.3. Make a copy of the .sql file you created, then
What does a Spam Injection Do?you can open the .sql file and use a text editor to
Spam Injection software hides spam keywordfind and replace all “wp_” prefix to
links in code that is usually encoded with a PHP“rename_”.
function that effectively scrambles html to be4. Now, drop all tables of your WordPress
decoded once safely embedded on your server,databases, but DO NOT drop the database.
database, etc. You won't see these files decoded,5. import the (.sql) file that you have just edited
but the Google Bot and other bots will wheninto your wordpress databases.
crawling your site! Once the Bots access the code6. Finish by editing your wp-config.php file and
the spam injection software has done it's work,change the $table_prefix = ‘wp_’; to
effectively stealing your search index to improve$table_prefix = ’something_’;
their own pagerank.I hope that this article will help someone avoid the
These spam injection hacks are very hard tofallout associated with a spam injection hack.