WordPress Cross Site Scripting Vulnerability in templates.php Uncovered

Filed as News on January 4, 2007 11:26 am

Folks, if you’re using WordPress to run your blogs (we are!), I suggest you go and download the latest version (2.06, which is in development stage as of this writing) or at least install some patches. Recently, a Cross-Site Scripting (XSS) vulnerability has been discovered that could permit malicious code injection into the core files of WordPress blogs.


David Kierznowski writes at Operation N:

When editing files a shortcut is created titled ‘recently accessed files’. The anchor tag text is correctly escaped with wp_specialchars(); however, the link title is not sanitised. Instead, it is passed to get_file_description($file). The only restriction or limitation here is that our text is passed through basename. This means standard script tags will fail when ending with ‘/’. We can get around this by using open IMG tags; this works under FF and IE.

If that’s Greek to you (it is to me), you can check out Security Focus, which has a description more attuned to layman speak.

WordPress is prone to a HTML-injection scripting vulnerability because the application fails to properly sanitize user-supplied input.

Attacker-supplied HTML and script code would execute in the context of the affected site, potentially allowing the attacker to steal cookie-based authentication credentials or to control how the site is rendered to the user; other attacks are also possible.

Tech Buzz lists the vulnerable versions (almost all versions prior to 2.06), and adds,

A Cross-site scripting (XSS) vulnerability has been in found in wp-admin/template.php which could allow malicious web users to inject arbitary web scripts or HTML code through the file parameter.

This exploit could allow remote attackers to do nasty things by injecting php or html codes into your wordpress core files.

The vulnerability is in the templates.php script, and if you would rather not upgrade to the latest WP version yet (because of heavy customizations, incompatible templates, hacks, plugins, etc.), you can work around the problem by either commenting out a line or replacing the file with a patched version.

  • Comment out line 72 in /wp-admin/templates.php, which contains update_recently_edited($file);
  • Patch templates.php with that from the latest WP version (file can be downloaded here).

And that, folks, is one great thing with open source software. Everyone can pitch in, and if there are vulnerabilities, these are more easily found and resolved, as compared to closed software, which would require a centralized development team to provide fixes.

[via Stellify]

Tags:

This post was written by

You can visit the for a short bio, more posts, and other information about the author.

Submissions & Subscriptions

Submit the post to Reddit, StumbleUpon, Digg or Del.icio.us.

Did you like it? Then subscribe to our RSS feed!



  1. By David Kierznowski posted on January 4, 2007 at 12:23 pm
    Want an avatar? Get a gravatar! • You can link to this comment

    I don’t speak Greek :) I was trying to demonstrate the attack vector which required some tech jargon; apologies if there was to much, I’ll keep this in mind next time.

  2. Wednesday LinksJanuary 4, 2007 at 1:39 pm
  3. By Big Roy posted on January 4, 2007 at 4:21 pm
    Want an avatar? Get a gravatar! • You can link to this comment

    I started reading The Blog Herald before I ever started my own blog. As time went on I found I wasn’t really happy with the tone being set.

    I have to say the “new” Blog Herald is a big change. The articles are useful, original, and enjoyable to read. It’s obvious you guys aren’t just rehashing a bunch of stuff from other blogs.

    This isn’t a dig at Matt in any way. I like him a lot and his writing. He gave me one of the first links to my blog.

    Thanks for the heads up on WordPress.

  4. By J. Angelo Racoma posted on January 4, 2007 at 6:28 pm
    Want an avatar? Get a gravatar! • You can link to this comment

    David,

    We all speak Greek (or Geek?) every once in a while. I have a few friends who remind me of that often. Thanks for warning everyone with that WP vulnerability. I’ve a lot of blogs to fix!

    Big Roy,

    Thanks for the vote of confidence. We’re hoping people would notice the change.

  5. WordPress Cross Site Scripting Vulnerability in templates.php | Content Writing and CopyWriting BlogJanuary 4, 2007 at 8:41 pm
  6. WordPress’in 2.0.6 versiyonu yayınlandı » Acemi BlogcuJanuary 5, 2007 at 5:37 pm
  7. By Aaron Brazell posted on January 5, 2007 at 6:42 pm
    Want an avatar? Get a gravatar! • You can link to this comment

    It’s a shame BH couldn’t have acted more responsibly and waited for 2.0.6 to be released before announcing an XSS flaw to the blogging world that predominantly uses WordPress. Sometimes the “scoop” isn’t the wisest choice.

  8. WeRoam saves the day: Updating WordPress to latest release | Leon Kilat ::: The Cybercafe ExperimentsJanuary 5, 2007 at 7:30 pm
  9. By J. Angelo Racoma posted on January 6, 2007 at 12:21 am
    Want an avatar? Get a gravatar! • You can link to this comment

    Aaron,

    It wasn’t a scoop–the news would’ve spread even without us posting about it, so I thought it best to post this as a warning. Patching WP to fix bugs would always be a good idea.

  10. By Aaron Brazell posted on January 6, 2007 at 12:26 am
    Want an avatar? Get a gravatar! • You can link to this comment

    It was released before WP 2.0.6. As it happens, I knew about one of the flaws weeks ago but you didn ‘t see me post anything on it, did you? The reality is thousands of people use WordPRess and all you can offer them for your hand flailing is a beta version of WordPress 2.0.6.

    I think it’s wiser for you to study up on how to handle these issues in the future. It makes you a better citizen. My flailing trust in BH has slipped further due to your demonstrated irresponsibility.

  11. How to Handle Security Flaws » Technology, Blogging and New MediaJanuary 6, 2007 at 1:04 am
  12. By Abe Olandres posted on January 6, 2007 at 2:45 am
    Want an avatar? Get a gravatar! • You can link to this comment

    Hello Aaron,

    It wasn’t as if we were the ones who first discovered the vulnerability prior to v2.0.6, so it wasn’t a “scoop” for us. If you read the post again, you will notice several links to the original sites which cited the problem.

    Our intention is to inform and warn people of such vulnerabilities and help them find ways to fix it. Our motive was clear. If you didn’t see the good intention, some other readers & WP users might. While you look at it as irresponsible, some of us look at it as cautiously responsible. We’ll just have to settle with the fact that we can’t really please everybody with what we deliver to our readers.

  13. Wordpress 2.1′e az kala | Blog ve Wolkanca.Com - Evden iÅŸe iÅŸten eve Blog!January 6, 2007 at 2:55 am
  14. By Tony posted on January 6, 2007 at 3:46 am
    Want an avatar? Get a gravatar! • You can link to this comment

    I think what Aaron was commenting on was the usual way of dealing with vulnerabilities and exploits to minimize the chance of publicizing the vulnerabilities to hackers.

    However, without speaking too much for Angelo, I think I’ll agree with Abe here — the intention was never to do the wrong thing in pursuit of the scoop.

    If this security publishing faux pas has changed your opinion about the BlogHerald, I’m sorry for that — but I think our new columnists are doing their damndest to try and make it better.

    And hopefully in the New Year we can make you a believer too. ;)

    Cheers,
    Tony.

  15. By Aaron Brazell posted on January 6, 2007 at 12:32 pm
    Want an avatar? Get a gravatar! • You can link to this comment

    Tony: My opinion wasn’t changed. It was merely cemented.

  16. By Tony posted on January 6, 2007 at 1:43 pm
    Want an avatar? Get a gravatar! • You can link to this comment

    I guess we’ll have to work doubly hard, then. ;)

    t

  17. By Big Roy posted on January 6, 2007 at 2:07 pm
    Want an avatar? Get a gravatar! • You can link to this comment

    As an independent observer. I think this comment thread reflects more on Mr. Brazell than it does Mr. Racoma’s post.

  18. By Jeremy Wright posted on January 6, 2007 at 9:19 pm
    Want an avatar? Get a gravatar! • You can link to this comment

    For the record, it’s considered irresponsible in security circles to publish or publicize bugs where the software’s creators are currently working actively on a patch (and when the patch is only days away).

    Sure, the Blog Herald didn’t publish the details initially, but they still broadened interest in it needlessly. It’s not a public service if there isn’t anything appropriate the public can do to protect themselves.

  19. By Mark posted on January 7, 2007 at 2:44 am
    Want an avatar? Get a gravatar! • You can link to this comment

    Jeremy- I think that this is understood now and the way you put it here is fine. One lives and learns by one’s mistakes.

    What I don’t get, however, is the way that such feedback is delivered by Aaron Brazell- who is essentially enflaming a story that he himself claims should not be for public consumption, both here and on his own blog.

    Wouldn’t the best way for him to have handled things, given the correct protocol, been to have privately contacted BH editorial staff and asked that the post be taken down? I am sure that he would have received a positive response.

    In the end of the day, I would hope that we’re all pretty much on the same side.

  20. By David Kierznowski posted on January 7, 2007 at 6:51 am
    Want an avatar? Get a gravatar! • You can link to this comment

    Let me put the record straight:

    1. A patch was provided with the original advisory. Therefore, not only was a problem advertised but a solution provided. So who is being irresponsible? The one not spreading the word or the one pointing out the problem and offering a solution.

    2. There is much debate (still) over what is responsible and what is irresponsible with how one releases security holes. In this case a fix was provided with the problem, not to mention WordPress had an overnight patch.

    3. If it is irresponsible for the security community to publish holes, is it not also irresponsible for the software vendor who is releasing a package to the public that has not been sufficiently tested?

    4. Who says attackers didn’t already know about the vulnerability?

    Nuff said.

  21. By Aaron Brazell posted on January 7, 2007 at 11:20 am
    Want an avatar? Get a gravatar! • You can link to this comment

    Mark: I said nothing about the story until after WordPress 2.0.6 was officially released. That is, not a beta version, but the offiicial version. I didn’t even say anything on Blog Herald. Granted, I didn’t see it here until after 2.0.6 was released or I probably would have said something privately.

    David:

    1. Blog Herald is not the sole irresponsible party here. But they are the one with the biggest bullhorn. The original posters that were quoted also bear responsiblity. And what about the people who don’t read BH that use WordPress. Are they responsible finding out about the “patch” provided here and implementing it for themselves?

    2. Where is this debate? It seems the only debate is between black hat and white hat hackers. Do you subscribe to Bugtraq? Do you see the thousands of bug reports that are reported every month?

    As for WordPress’ fix, yeah – they rushed 2.0.6 out the door because of stuff like this being public and in the process broke something else because it was a rush job. Now they have to look at 2.0.7 to fix that. Come on, don’t give me what is responsible and what is not.

    3. See #2.

    4. No one but now hackers know and the rest of the world knows.

  22. By Mark posted on January 7, 2007 at 4:26 pm
    Want an avatar? Get a gravatar! • You can link to this comment

    Okay. I stand corrected. But still, maybe we can do without the nasty vibe a wee bit.

  23. Recommended Update: WordPress 2.0.6 at The Blog HeraldJanuary 7, 2007 at 6:33 pm
  24. WeRoam saves the day: Updating WordPress to latest release | PHP MagazineJanuary 8, 2007 at 3:28 am
  25. By Andy Merrett posted on January 10, 2007 at 10:38 pm
    Want an avatar? Get a gravatar! • You can link to this comment

    If we’re talking about estimations lowering and being cemented then I’m finding one right now. There’s a certain tone coming from some that takes an otherwise useful message and turns it into “Listen to me. I’m a coder. I’m wonderful. I’m right”. Maybe that’s what some networks do to people, but it’s a shame to see how the person I thought I was getting to know last year (before they switched networks) has gone all corporate and UTOA.

    Still, it doesn’t matter much as I guess they won’t be reading BH for much longer.

  26. How to Handle Security Flaws | Technosailor.comNovember 29, 2008 at 2:49 pm