{"id":597,"date":"2012-03-05T09:44:45","date_gmt":"2012-03-05T14:44:45","guid":{"rendered":"http:\/\/misc.wordherders.net\/?p=597"},"modified":"2012-03-08T07:23:39","modified_gmt":"2012-03-08T12:23:39","slug":"possible-fixes-for-recent-wordpress-hack","status":"publish","type":"post","link":"http:\/\/misc.wordherders.net\/?p=597","title":{"rendered":"Possible fixes for recent WordPress hack"},"content":{"rendered":"<p>UPDATE:<\/p>\n<p>While the instructions below can help remove the lines of code inserted into your php pages, it doesn&#8217;t necessarily remove the *exploit* that allowed such an incursion in the first place. \u00c2\u00a0What I&#8217;ve learned after the code re-appeared in the past 24 hours on ~7 blogs hosted (for reference, I&#8217;m on dreamhost):<\/p>\n<p>1. Delete all unused, old themes. \u00c2\u00a0The &#8220;blue kino&#8221; theme looks like a possible culprit, but just get rid of whatever you aren&#8217;t using, and upgrade the one you are.<\/p>\n<p>2. Update all plug-ins you are using, and delete the ones you are not.<\/p>\n<p>3. Make sure WordPress itself is up-to-date.<\/p>\n<p>4. Look for odd files that don&#8217;t fit. If you&#8217;ve been hacked, contact your host&#8211;they can run scripts to help you track these down. \u00c2\u00a0For example, on one site there was:<\/p>\n<pre>[domain name]\/wp-admin\/network\/verdiweston.php<\/pre>\n<p>and<\/p>\n<pre>[domain name]\/wp-admin\/user\/addiathoreau.php<\/pre>\n<p>&nbsp;<\/p>\n<p>5. Consider a database dump and re-install (I believe @wayne_graham might be planning a blog post to outline a clear process for this).<\/p>\n<p>Note: I&#8217;m hopeful these steps will work, but I&#8217;m also expecting to be surprised by a fresh round of cleaning (and full\u00c2\u00a0re-installations) tomorrow. \u00c2\u00a0So, caveat emptor.<\/p>\n<p>==<\/p>\n<p>ORIGINAL POST<\/p>\n<p>I&#8217;ve found the the Sucuri.net blog (<a href=\"http:\/\/blog.sucuri.net\/\">http:\/\/blog.sucuri.net\/<\/a>) an incredibly valuable resource when wordherder blogs have been hit with various hacks.\u00c2\u00a0 Recently, George&#8217;s <a href=\"http:\/\/workbook.wordherders.net\">workbook.wordherders.net<\/a> was hacked, and I was able to use the same script that Sucuri provided in a May 2010 posting to clean up the files.<\/p>\n<p>The hack puts one line of php code in each of your php files.\u00c2\u00a0 It begins with the following script:<\/p>\n<pre>&lt;?php \/**\/ eval(base64_decode(\"aWY....<\/pre>\n<p>&nbsp;<\/p>\n<p>Cleaning the site requires extraction of that php code from all pages in all directories for your WP installation.\u00c2\u00a0 The Sucuri solution uses SED to accomplish this.\u00c2\u00a0 If you want to make sure this is the hack that impacted you, you can check by either downloading one of your php files by ftp or SSH in to read one.\u00c2\u00a0 A very, very long line of php code should begin with that you see above.<\/p>\n<p>Here is an old Sucuri post from May 2010 where I downloaded the original fix (which I used to clean a hack in 2010):<br \/>\n<a href=\"http:\/\/blog.sucuri.net\/2010\/05\/simple-cleanup-solution-for-the-latest-wordpress-hack.html\">http:\/\/blog.sucuri.net\/2010\/05\/simple-cleanup-solution-for-the-latest-wordpress-hack.html<\/a><\/p>\n<p>The link to the file they provided is broken, so here&#8217;s the copy that I have (again, all credit to the original Sucuri post):<\/p>\n<p><a href=\"http:\/\/misc.wordherders.net\/wp\/wordpress-fix_php.txt\">http:\/\/misc.wordherders.net\/wp\/wordpress-fix_php.txt<\/a><\/p>\n<p>Follow the directions from the May 2010 post under the section &#8220;via web&#8221; &#8212; this same script worked in cleaning up the recent attack from last week on http:\/\/workbook.wordherders.net\/ (and also worked just now on my own site, which I had to clean before posting this).\u00c2\u00a0 Remember that you have to change the file name so to wordpress-fix.php<\/p>\n<p>Be patient&#8230;it can take a few seconds to run.\u00c2\u00a0 It will give you a notice when it is done.\u00c2\u00a0 Then go and check some of your php files to make sure it worked.<\/p>\n<p>&#8212;<\/p>\n<p>Another possible solution: in the comments feed from this Feb 2012 Sucuri post (<a href=\"http:\/\/blog.sucuri.net\/2012\/02\/malware-campaign-from-rr-nu.html\">http:\/\/blog.sucuri.net\/2012\/02\/malware-campaign-from-rr-nu.html<\/a>), Walker de Alencar provides this link to his github script rrnuVaccine:<\/p>\n<p><a href=\"https:\/\/github.com\/walkeralencar\/rrnuVaccine\">https:\/\/github.com\/walkeralencar\/rrnuVaccine<\/a><\/p>\n<p>&#8212;<\/p>\n<p>Good luck all!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>UPDATE:<\/p>\n<p>While the instructions below can help remove the lines of code inserted into your php pages, it doesn&#8217;t necessarily remove the *exploit* that allowed such an incursion in the first place. \u00c2\u00a0What I&#8217;ve learned after the code re-appeared in the past 24 hours on ~7 blogs hosted (for reference, I&#8217;m on dreamhost):<\/p>\n<p>1. Delete [&#8230;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-597","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"http:\/\/misc.wordherders.net\/index.php?rest_route=\/wp\/v2\/posts\/597","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/misc.wordherders.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/misc.wordherders.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/misc.wordherders.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/misc.wordherders.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=597"}],"version-history":[{"count":13,"href":"http:\/\/misc.wordherders.net\/index.php?rest_route=\/wp\/v2\/posts\/597\/revisions"}],"predecessor-version":[{"id":606,"href":"http:\/\/misc.wordherders.net\/index.php?rest_route=\/wp\/v2\/posts\/597\/revisions\/606"}],"wp:attachment":[{"href":"http:\/\/misc.wordherders.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=597"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/misc.wordherders.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=597"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/misc.wordherders.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=597"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}