
A vulnerability in the markasjunk plugin of the open source webmail client Roundcube lets attackers execute code through payloads embedded in the e-mail address. Versions up to and including 1.6.1 are affected.
The plugin ships with the standard Roundcube distribution but has to be enabled. Once it is enabled and configured, any Roundcube user can achieve remote code execution.
The vulnerable markasjunk configuration is:
$config['markasjunk_learning_driver'] = "cmd_learn";$config['markasjunk_spam_cmd'] = "salearn %i";
The configuration file is located at: plugins/markasjunk/config.inc.php.
This configuration allows command execution because of filtering problems. The vulnerability can be triggered as long as the user changes their e-mail address and marks an e-mail as “Junk” - both conditions are required.
Remediation:
- In the configuration, replace "%i" with "%s" or "%f".
or
- Find line 59 in "plugins/markasjunk/drivers/cmd_learn.php". It contains:
$command = str_replace('%i', $identity['email'], $command); - Replace it with:
$command = str_replace('%i', escapeshellarg($identity['email']), $command);
More details: https://tinyurl.com/roundcube-markasjunk-rce
