WordPress – DM Albums Version 2.0 Critical Vulnerability

The latest version of DM Albums was released on 10/21/2009 to all WordPress users and it contains a serious flaw that can allow an attacker to remotely delete any file or folder they wish. The author has been notified of the problem and I have listed a work around below to prevent directory traversal.

After upgrading to the latest version of DM Albums I was playing with the new features and noticed the function to delete albums. I dug into the code located at wp-content/plugins/dm-albums/wp-dm-albums-ajax.php and found that there is no check to see if someone has used directory traversal. This means that anyone can delete files or directories outside of the upload directory.

Example:

    http://someblogsite/wp-content/plugins/dm-albums/wp-dm-albums-ajax.php?delete_album=../../../public_html

The vulnerable section that allows this to take place is:

    if(isset($_GET[“delete_album”]) && !empty($_GET[“delete_album”]) && strlen($_GET[“delete_album”]) > 0)
    {
    //delete the album directory
    dm_get_album_delete($DM_UPLOAD_DIRECTORY . $_GET[“delete_album”]);
    }

In this code there is no check to see what is contained in the GET variable and you don’t even need to be logged in to delete files.

Below is a quick and dirty work around to prevent the problem and I would suspect there will be more checks to ensure that user input is sanitized in the near future. This work around will not prevent malicious users from deleting your albums but it will keep folders outside of the upload directory safe.

    if(isset($_GET[“delete_album”]) && !empty($_GET[“delete_album”]) && strlen($_GET[“delete_album”]) > 0)
    {
    //remove the / character from user input
    $_GET[“delete_album”] = str_replace(“/”, “”, $_GET[“delete_album”]);

    //delete the album directory
    dm_get_album_delete($DM_UPLOAD_DIRECTORY . $_GET[“delete_album”]);
    }

Once I hear back from the author I will update this post to let everyone know the outcome.

Update: A new release, v2.0.1, with the above mentioned work around has been released. We should also expect to see another update in the next few days that will employ more security checks and some upgrades for WordPress multi user environments as well.

Tags: , , , , ,

No comments yet.

Leave a Reply

*