{"id":913,"date":"2013-01-16T00:20:55","date_gmt":"2013-01-16T05:20:55","guid":{"rendered":"http:\/\/www.alquier.org\/linfa\/work\/?p=913"},"modified":"2013-01-16T00:20:55","modified_gmt":"2013-01-16T05:20:55","slug":"blogs-hacked","status":"publish","type":"post","link":"http:\/\/www.alquier.org\/laurent\/sites\/2013\/01\/16\/blogs-hacked\/","title":{"rendered":"Blogs hacked!"},"content":{"rendered":"<p>Sometimes this past weekend I had the joy to find my wordpress instances dead with a Server error 500. All of them. At once.<\/p>\n<p>I first suspected an issue with the database, or maybe a server patch impacting PHP or WordPress, but a quick and helpful call to the helpdesk of my host confirmed that was not the case. The reality of the issue was more disturbing.<\/p>\n<p>Somehow, a malware had found its way into the server I am using to host the sites. It had installed new files, emptied by robots.txt file and added a base64 encoded block of text to about 1000 PHP files across the whole server.<br \/>\n<!--more--><\/p>\n<p><strong>Cleaning up malware-infected WordPress sites<\/strong><\/p>\n<p>The basics of a malware infected WordPress server are described in these resources:<br \/>\n* <a href=\"http:\/\/codex.wordpress.org\/FAQ_My_site_was_hacked\">FAQ My Site was Hacked (WordPress.com)<\/a><br \/>\n* <a href=\"http:\/\/www.stopthehacker.com\/2012\/06\/19\/cleaning-up-malware-infected-websites\/#.UPI30qGjf0s\">Cleaning up malware infected sites (stopthehacker.com)<\/a><\/p>\n<p>I found more details on this blog: <a href=\"http:\/\/blog.aw-snap.info\/\" title=\"Aw Snap\" class=\"broken_link\">Aw Snap<\/a>, including a <a href=\"http:\/\/blog.aw-snap.info\/p\/simple-script-to-find-base64decode-in.html\" class=\"broken_link\">handy script to track down base64 encoded blocks<\/a>.<\/p>\n<p>1. First step to clean up this mess was to copy server files locally using Goodsync (MacOs).<\/p>\n<p>2. Next step was to search for and remove this regular expression from all files (the search and replace using regular expressions in Coda was very useful).<\/p>\n[code]\\[\/code]\n<p>3. Looked for .htaccess files with rewrite rules (even though my ISP is using IIS)<\/p>\n<p>4. Tracked down and Delete suspect files (two suspect files were added to the root of the server and obfuscated with base64 encoding).<\/p>\n<p>5. Tracked down <a href=\"http:\/\/blog.vaultpress.com\/2011\/08\/02\/vulnerability-found-in-timthumb\/\">vulnerable instances of timthumb<\/a> and fixed them<\/p>\n<p>6. Got rid of old version of movable type. <a href=\"http:\/\/www.movabletype.org\/2013\/01\/movable_type_438_patch.html\">A Vulnerability was recently announced for old versions<\/a> &#8211; that coincidence was too suspect to ignore.<\/p>\n<p>7. Downloaded <a href=\"http:\/\/wordpress.org\/download\/\">clean wordpress install files<\/a> and replaced them in all wordpress instances<\/p>\n<p>8. Upload and synchronize clean files with Goodsync again<\/p>\n<p>9. Reinstall some themes and plugins if necessary. Some plugins required to save their configuration again as some files were lost with a fresh install of wordpress files.<\/p>\n<p>10. <a href=\"http:\/\/wordpress.org\/support\/topic\/how-to-create-a-wordpress-30-multisite-network-on-a-windows-server-using-sub-di\">Fixed rewrite mappings for Buddypress and WordPress multi sites<\/a>. In most cases it was enough to republish permalink structure to recreate webconfig files.<\/p>\n<p>Watch out for cached pages in browser that still appeared broken long after there were fixed!<\/p>\n<p>11. <a href=\"http:\/\/codex.wordpress.org\/Resetting_Your_Password\">Reset wordpress passwords<\/a>, along with database and FTP passwords for good measure.<\/p>\n<p>If anything, this painful experience gave me an occasion for a much needed cleanup of old files on the server and a renewed obsession for backing up my files more often.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Sometimes this past weekend I had the joy to find my wordpress instances dead with a Server error 500. All of them. At once. I first suspected an issue with the database, or maybe a server patch impacting PHP or WordPress, but a quick and helpful call to the helpdesk of my host confirmed that was not the case. The&hellip; <\/p>\n<p><a class=\"more-link\" href=\"http:\/\/www.alquier.org\/laurent\/sites\/2013\/01\/16\/blogs-hacked\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[2,123,1],"tags":[140,151,53,17],"class_list":["post-913","post","type-post","status-publish","format-standard","hentry","category-blog","category-tips","category-uncategorized","tag-hacked","tag-malware","tag-troubleshooting","tag-wordpress","xfolkentry","clearfix"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p8frwa-eJ","jetpack_likes_enabled":true,"jetpack-related-posts":[],"_links":{"self":[{"href":"http:\/\/www.alquier.org\/laurent\/sites\/wp-json\/wp\/v2\/posts\/913","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.alquier.org\/laurent\/sites\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.alquier.org\/laurent\/sites\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.alquier.org\/laurent\/sites\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.alquier.org\/laurent\/sites\/wp-json\/wp\/v2\/comments?post=913"}],"version-history":[{"count":0,"href":"http:\/\/www.alquier.org\/laurent\/sites\/wp-json\/wp\/v2\/posts\/913\/revisions"}],"wp:attachment":[{"href":"http:\/\/www.alquier.org\/laurent\/sites\/wp-json\/wp\/v2\/media?parent=913"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.alquier.org\/laurent\/sites\/wp-json\/wp\/v2\/categories?post=913"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.alquier.org\/laurent\/sites\/wp-json\/wp\/v2\/tags?post=913"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}