[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[FD] dotclear 2.8.1: Code Execution



Security Advisory - Curesec Research Team

1. Introduction

Affected Product:    dotclear 2.8.1
Fixed in:            2.8.2
Fixed Version Link:  http://download.dotclear.org/latest.zip
Vendor Website:      http://dotclear.org/
Vulnerability Type:  Code Execution
Remote Exploitable:  Yes
Reported to vendor:  10/02/2015
Disclosed to public: 11/13/2015
Release mode:        Coordinated release
CVE:                 n/a
Credits              Tim Coen of Curesec GmbH

2. Overview

CVSS

High 9.0 AV:N/AC:L/Au:S/C:C/I:C/A:C

Description

While upload of files with extension php, php4, and php5 is forbidden, upload
of files with the extension pht, phps, and phtml is allowed, which will lead to
code execution with most default Apache configurations.

The upload form is located here:
http://localhost/dotclear/admin/media.php?popup=1&plugin_id=dcLegacyEditor

A user with the right "manage their own media items" and "manage their own
entries and comments" is needed to exploit this issue.

3. Code


/dotclear/inc/libs/clearbricks/filemanager
public function uploadFile($tmp,$dest,$overwrite=false)
{
        $dest = $this->pwd.'/'.path::clean($dest);

        if ($this->isFileExclude($dest)) {
                throw new Exception(__('Uploading this file is not allowed.'));
        }
        [...]
        if (@move_uploaded_file($tmp,$dest) === false) {
                throw new Exception(__('An error occurred while writing the 
file.'));
        }
        [...]
}

[...]
protected function isFileExclude($f)
{
        if (!$this->exclude_pattern) {
                return false;
        }

        return preg_match($this->exclude_pattern,$f);
}

/dotclear/inc/core/class.dc.media.php
$this->exclude_pattern = $core->blog->settings->system->media_exclusion;

/dotclear/inc/core/class.dc.core.php
array('media_exclusion','string','/\.php[0-9]*$/i',
                        'File name exclusion pattern in media manager. (PCRE 
value)'),

Note that after installation, the regex is retrieved from the settings table of 
the database, not from the code.

4. Solution

To mitigate this issue please upgrade at least to version 2.8.2:

http://download.dotclear.org/latest.zip

Please note that a newer version might already be available.

5. Report Timeline

10/02/2015 Informed Vendor
10/25/2015 Vendor releases fix
11/13/2015 Disclosed to public


Blog Reference:
http://blog.curesec.com/article/blog/dotclear-281-Code-Execution-93.html

_______________________________________________
Sent through the Full Disclosure mailing list
https://nmap.org/mailman/listinfo/fulldisclosure
Web Archives & RSS: http://seclists.org/fulldisclosure/