{"id":65,"date":"2008-05-01T22:13:29","date_gmt":"2008-05-02T03:13:29","guid":{"rendered":"https:\/\/lowtek.ca\/roo\/?p=65"},"modified":"2008-06-10T22:58:06","modified_gmt":"2008-06-11T03:58:06","slug":"wordpress-exploit","status":"publish","type":"post","link":"https:\/\/lowtek.ca\/roo\/2008\/wordpress-exploit\/","title":{"rendered":"WordPress Exploit"},"content":{"rendered":"<p>I recently upgraded to WordPress 2.5 &#8211; and in the process of doing so, I noticed something funky with my older 2.3.3 installs claiming to be 2.5 already.  I thought it was odd &#8211; but didn&#8217;t immediately come across anyone having reported strangeness here and so I just ignored it.<\/p>\n<p>Now that 2.5.1 is out, I thought I&#8217;d go upgrade again.  Well, after the upgrade I was still having the dashboard tell me that I needed to upgrade.  Odd.  This time a web search did uncover information that was relevant.<\/p>\n<p>Details on the <a href=\"http:\/\/codex.wordpress.org\/User:Here\/Exploits\/wp-info\" target=\"_self\">wp-info.txt exploit<\/a> are interesting.  It seems to me that several problems are being lumped into the one discussion, but I found some helpful advice to help clean things up from the links provided there.<\/p>\n<p>Symptoms:<\/p>\n<ul>\n<li> Presence of wp-info.txt<\/li>\n<li> Displayed version changed without upgrading.<\/li>\n<li> Database modifications<\/li>\n<li> New files ending in _new, _old, .pngg, .jpgg, .giff appearing inside writable directory<\/li>\n<\/ul>\n<p><!--more-->What is odd &#8211; is that the problem was pretty widespread on my system, based on the number of files that I had to remove \/ modify this feels very much like a &#8216;worm&#8217; type attack that continues to re-insert itself.  I certainly found files that had been multiply modified.  (Memo to self &#8211; dig deeper when we see backups of strange files that shouldn&#8217;t change).<\/p>\n<p>My first step was to punt the bogus files.<\/p>\n<pre><code>find . -name *_old* -exec rm '{}' \\;\r\nfind . -name *_new.php* -exec rm '{}' \\;\r\nfind . -name *.giff -exec rm '{}' \\;\r\nfind . -name *.jpgg -exec rm '{}' \\;\r\nfind . -name *.pngg -exec rm '{}' \\;\r\nfind . -name wp-info.txt -exec rm '{}' \\;\r\n<\/code><\/pre>\n<p>There will also be some &#8216;magic goo&#8217; inserted into of many of your .php files.  You should be able to locate them by doing the following at the root of my web structure:<\/p>\n<pre><code>grep -ri _wp_debugger *\r\n<\/code><\/pre>\n<p>I simply edited out the offending lines manually.<\/p>\n<p>It also seems that any file that matches<\/p>\n<pre><code>grep -ri qwerty *\r\n<\/code><\/pre>\n<p>is bogus as well, and needs to be removed.<br \/>\nThen it was time to dig into the databases.  Lucky me, all of my wordpress installs had been hit by this so that meant walking more than one database.<\/p>\n<p>The first thing to check is the active plugins.  It seems that part of the exploit installs a hidden plugin that you need to edit the database to see and remove.  The normal wordpress plugin view will not show you.<\/p>\n<pre><code>SELECT * FROM wp_options WHERE option_name = 'active_plugins';\r\n<\/code><\/pre>\n<p>If you do have an entry that is clearly not one of the plugins you intend to have running, you need to clear things out.  Mine looked something like &#8220;..\/..\/wp-content\/uploads\/2007\/05\/colour_temp_3_old.jpg&#8221;.  Which sort of explains what is going on with all those bogus files we removed before.<\/p>\n<p>The following SQL will disable all plugins<\/p>\n<pre><code>UPDATE wp_options SET optionvalue=\"\" where option_name=\"active_plugins\";\r\n<\/code><\/pre>\n<p>Once you do this &#8211; go back and re-enable any plugins you do want running.<\/p>\n<p>Another issue is the inclusion of a phantom user &#8220;WordPress&#8221;.  Again this requires database spelunking as the normal wordpress UI will not show you this malformed user.  Use the following SQL to look at the user table.<\/p>\n<pre><code>SELECT * FROM wp_users;\r\n<\/code><\/pre>\n<p>In my case &#8211; the user id attached to the bogus user was 8.  So  was able to delete the row using:<\/p>\n<pre><code>DELETE from wp_users WHERE id=8;\r\n<\/code><\/pre>\n<p>At this point, my 2.5.1 upgrade stopped telling me that I needed to upgrade to 2.5.1 &#8211; so I may still have some problems lurking, but I think I&#8217;ve  cleared out the bulk of the problem.  What a mess.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I recently upgraded to WordPress 2.5 &#8211; and in the process of doing so, I noticed something funky with my older 2.3.3 installs claiming to be 2.5 already. I thought it was odd &#8211; but didn&#8217;t immediately come across anyone having reported strangeness here and so I just ignored it. Now that 2.5.1 is out, &hellip; <a href=\"https:\/\/lowtek.ca\/roo\/2008\/wordpress-exploit\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;WordPress Exploit&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[],"class_list":["post-65","post","type-post","status-publish","format-standard","hentry","category-computing"],"_links":{"self":[{"href":"https:\/\/lowtek.ca\/roo\/wp-json\/wp\/v2\/posts\/65","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lowtek.ca\/roo\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lowtek.ca\/roo\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lowtek.ca\/roo\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lowtek.ca\/roo\/wp-json\/wp\/v2\/comments?post=65"}],"version-history":[{"count":0,"href":"https:\/\/lowtek.ca\/roo\/wp-json\/wp\/v2\/posts\/65\/revisions"}],"wp:attachment":[{"href":"https:\/\/lowtek.ca\/roo\/wp-json\/wp\/v2\/media?parent=65"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lowtek.ca\/roo\/wp-json\/wp\/v2\/categories?post=65"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lowtek.ca\/roo\/wp-json\/wp\/v2\/tags?post=65"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}