17 Comments

  1. Ryan Rampersad ifupdown.com
    Posted September 6, 2009 at 12:34 am | Permalink

    Thanks for posting that query. I host blogs for others and because they’re infrequent bloggers, they rarely update. I updated their blog from 2.6.1 today to 2.8.4 and with your query, I verified that, luckily, they were safe.
    I tried to copy and paste the query directly but it had the line numbers copied in, so here it is in a single line: SELECT u.ID, u.user_login FROM wp_users u, wp_usermeta um WHERE u.ID = um.user_id AND um.meta_key = ‘wp_capabilities’ AND um.meta_value LIKE ‘%administrator%’;

    Thanks again.

    • Dougal dougal.gunters.org
      Posted September 6, 2009 at 12:45 am | Permalink

      Yeah, sorry about the formatting. I didn’t realize until too late that the syntax highlighter plugin that I’m using turns the code into a list in order to get the ability to (optionally) display line numbers.

  2. Anthony Galli hikari.ws
    Posted September 6, 2009 at 1:39 am | Permalink

    Thanks for the quick tip!

    Once I heard of it, I run to backup my databases and then all I wanted to know was how to find out if I was attacked.

    Well, my sites have only 1 user, and I saw it right from phpmyadmin :)

    I’m gonna update some plugins and then upgrade my other site.

  3. Muhammad Ali geekword.net
    Posted September 6, 2009 at 2:50 am | Permalink

    Hey Dougal, thnx for sharing this. I just wanted to ask you that, besides running this query, would viewing the users table confirm the same thing. Or Running the query would do the trick

    • Vladimir shinephp.com
      Posted September 6, 2009 at 9:45 am | Permalink

      Muhammad,
      Dougal’s SQL query shows you data from two tables simaltaneously. You will not see user right’s level from the single wp_users table. You need additionally check wp_user_meta table for admin right of every wp_users table record with the same id. To make it mannually when you have a lot of users is very time consuming, right? That’s why you need the query here.

  4. Orion Lukasik consciousmlmmarketing.com
    Posted September 6, 2009 at 4:18 pm | Permalink

    Thanks for the information Dougal,

    I’m somewhat new to wordpress, and blogging in general. Shortly after I put my blog online there was a new version available. I have a tendency to hold off on upgrades with the “If it ain’t broke, don’t fix it” attitude, but this time something told me the upgrade was a wise move.

    Thanks again for the support.

    ~ Orion

  5. Pat halpi.com
    Posted September 6, 2009 at 7:25 pm | Permalink

    I set up a new WP site 2 weeks ago and immediately upgraded to 2.8.4. Unfortunately, hackers got in anyway, set up a new front page and used that as a coverup to set up 2 bank phishing directories deep in the admin and plugins directories. The site has been redone and is, hopefully, more secure.

    Today, after reading about the new worm, I searched the rest of the sites I manage (which had all been upgraded to 2.8.4 last week) and found one small one had 2 admin accounts that were visible and 4 that were hidden (visible for about 1/2 second and then gone). I did not readily have the database password to get rid of the bogus admins and didn’t want to wait until I could get to my second office to find the info. I deleted all files, set up a new database, and reinstalled WP. Now there’s just 1 admin, me.

    I appreciate every alert that comes out. This one I wouldn’t have caught.Pat

  6. Constantine archivestrader.com
    Posted September 7, 2009 at 3:40 am | Permalink

    From what I have read in the wordpress link above, this is a very serious hack job because the hacker manages to insert spam (hidden links) into your old post.
    When my blog was hacked the hacker inserted hidden links only in the footer and cleaning that wasnt a big problem. I just removed the old install and installed a fresh one. If you have a blog with 1000 plus post and all of them are infected you might have big problem in your hands.
    The big problem is when google discovers the spam links, you will be slapped with a penalty and your blog de-indexed until you clean up.

  7. Alex Feldman enxaqueca.com.br
    Posted September 7, 2009 at 7:09 am | Permalink

    Hello! Thank you so much for this post. I actually found a bunch of users in one of my sites that weren’t supposed to be My webhost warns me that more than 150 emails are being sent per hour, so this issue is somehow affecting my email account by sending emails automatically via my website.

    Could someone please tell whether I should do anything other than delete these users in order to stop sending spam involuntarily? Thank you!!

  8. christian hymnos.existenz.ch
    Posted September 9, 2009 at 3:44 pm | Permalink

    Hmm, interesting. I found a weird username: ‘WordPress’, with admin capabilities and invisibility. Does anybody else have one like this?

    • brettbum softduit.com
      Posted November 10, 2009 at 11:20 am | Permalink

      I found one site that had a username of WordPress, and another that had a username of ‘admine’

      • brettbum softduit.com
        Posted November 10, 2009 at 11:57 am | Permalink

        I’ve seen the WordPress user twice now, and now also admins and adminj. wondering if they start with WordPress and then add additional items . . .

  9. Thierry Benquey tby-liber.com
    Posted September 17, 2009 at 6:06 am | Permalink

    Thank you for the query
    I found one invisible administrator on my database. I deleted directly on the database.
    A thankfull french blogger.

  10. Suneel teamnirvana.com
    Posted September 24, 2009 at 2:15 am | Permalink

    Thanks for pointing this out. I will make a search asap and check even though I am using the latest version of wordpress.

  11. ??? v29v.com
    Posted September 26, 2009 at 5:49 am | Permalink

    Thanks for pointing this out. I will make a search asap and check even though I am using the latest version of wordpress.

  12. thachcao home.thachcao.com
    Posted October 17, 2009 at 6:45 pm | Permalink

    Thank you for tips. I run checking for my own site. It’s OK, cos I just built it 5 mins ago. Thanks

  13. Sample Resumes jobresumesearch.com
    Posted October 30, 2009 at 3:41 pm | Permalink

    I would like to say thanks for sharing such a nice post. I ‘ll try to check out it.

17 Trackbacks

  1. [...] This post was recently mentioned on Twitter by Amanda Lauter (http://twitter.com/lauter), who said: RT @dougal: New blog post: Checking Your WordPress Security http://bit.ly/xHYrS [this guy knows his stuff - check it out]. [...]

  2. [...] a lot of registered users, you'll want to list out administrators and make sure they're all legit. Dougal Campbell has more details on this. Share this [...]

  3. [...] Dougal Campbell’s Blog Categories : Misc, News Tags [...]

  4. [...] there is any extra admin account for your WordPress account or not. This can be done through a simple SQL query. You need to run this query against your MySQL WordPress DB. There are a couple of ways to run this [...]

  5. [...] Campbell had a good post, Checking Your Wordpress Security, that talks about how to find the current list of accounts having administrative privileges in your [...]

  6. By WordPress Blogs Under Attack on September 6, 2009 at 9:27 pm

    [...] [via Dougal Campbell] [...]

  7. [...] également la requête SQL proposée par Dougal sur son blog. ( dougal.gunters.org [...]

  8. By Blake Helms | Birmingham, Alabama on September 6, 2009 at 10:55 pm

    The Great WordPress Attack of 2009: My Thoughts…

    On Fri­day reports began sur­fac­ing around the Inter­net that a new worm was attack­ing a large num­ber of Word­Press instal­la­tions. It was soon dis­cov­ered that the prob­lem is a cross-script attack­ing vul­ner­a­bil­ity that was ……

  9. By Psybertron Asks on September 7, 2009 at 2:58 am

    [...] got the latest security patch, but a useful tip in this post about running SQL queries direct from [...]

  10. [...] Checking Your Wordpress Security by Dougal Campbell [...]

  11. By Upgrade Your Wordpress now! | Pinoy Problogger on September 7, 2009 at 10:27 am

    [...] FORGET to backup your mysql and your files – if you still want to dig deeper and check your db, use this tutorial Share and [...]

  12. By Uppgradera alltid WordPress | Eyesx on September 7, 2009 at 12:46 pm

    [...] Checking Your WordPress Security [...]

  13. [...] and want to be sure that you haven’t fallen prey to the worm’s threat, you can use the query Dougal Campbell has posted to check your wp_users table for administrators. Check the results of [...]

  14. By Sicher bloggen mit Wordpress? Teil 1 on September 10, 2009 at 11:14 am

    [...] sollte man in phpMyAdmin entweder in der Userdatenbank nachschauen oder einfach folgendem Tipp von Dougal Campell folgen und diese SQL Abfrage laufen [...]

  15. By Sicher bloggen mit Wordpress? Teil 1 « My Blog on October 22, 2009 at 12:47 pm

    [...] sollte man in phpMyAdmin entweder in der Userdatenbank nachschauen oder einfach folgendem Tipp von Dougal Campell folgen und diese SQL Abfrage laufen [...]

Post a Comment

Your email is never published nor shared.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Subscribe without commenting