High-Tech Bridge Security Research Lab discovered a path traversal vulnerability in a popular webmail client Roundcube. Vulnerability can be exploited to gain access to sensitive information and under certain circumstances to execute arbitrary code and totally compromise the vulnerable server.

The vulnerability exists due to insufficient sanitization of "_skin" HTTP POST parameter in "/index.php" script when changing between different skins of the web application. A remote authenticated attacker can use path traversal sequences (e.g. "../../") to load a new skin from arbitrary location on the system, readable by the webserver.

A simple exploit below will send HTTP POST request to vulnerable script and will load a new skin from "/tmp" folder:

Exploitation of the vulnerability requires valid user credentials and ability to create files on vulnerable host.

Using specially crafted skin for Roundcube, a remote attacker can gain access to potentially sensitive information. The following code in skin files will display database access credentials:

<roundcube:var name="config:db_dsnw" />

In case, when "skin_include_php" parameter is set to true, the attacker will be able to execute arbitrary PHP code from the skin files:

$config['skin_include_php'] = true;

This vulnerability is difficult to exploit since it requires ability to create files on the web server and a valid Roundcube account. But this situation is very common for shared hosting servers, that host clients' websites on the same server as Roundcube.

Have additional information to submit? Please feel free to send us any additional information related to this Advisory, such as vulnerable versions, additional exploitation details and conditions, patches and other relevant details.