Skip to content

Commit

Permalink
Fix security issue in DBMail driver of password plugin (#1490261)
Browse files Browse the repository at this point in the history
  • Loading branch information
alecpl committed Feb 5, 2015
1 parent 09d52db commit 7c96646
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ CHANGELOG Roundcube Webmail
- Fix keyboard navigation and css in datepicker widget across many Firefox versions
- Fix false warning when opening attached text/plain files (#1490241)
- Fix bug where signature could have been inserted twice after plain-to-html switch (#1490239)
- Fix security issue in DBMail driver of password plugin (#1490261)

RELEASE 1.1-rc
--------------
Expand Down
17 changes: 15 additions & 2 deletions plugins/password/drivers/dbmail.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,23 @@ class rcube_dbmail_password
function save($currpass, $newpass)
{
$curdir = RCUBE_PLUGINS_DIR . 'password/helpers';
$username = escapeshellcmd($_SESSION['username']);
$username = escapeshellarg($_SESSION['username']);
$password = escapeshellarg($newpass);
$args = rcmail::get_instance()->config->get('password_dbmail_args', '');
$command = "$curdir/chgdbmailusers -c $username -w $password $args";

exec("$curdir/chgdbmailusers -c $username -w $newpass $args", $output, $returnvalue);
if (strlen($command) > 1024) {
rcube::raise_error(array(
'code' => 600,
'type' => 'php',
'file' => __FILE__, 'line' => __LINE__,
'message' => "Password plugin: The command is too long."
), true, false);

return PASSWORD_ERROR;
}

exec($command, $output, $returnvalue);

if ($returnvalue == 0) {
return PASSWORD_SUCCESS;
Expand Down
2 changes: 1 addition & 1 deletion plugins/password/helpers/chgdbmailusers.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
main(int argc, char *argv[])
{
int cnt,rc,cc;
char cmnd[255];
char cmnd[1024];

strcpy(cmnd, CMD);

Expand Down

0 comments on commit 7c96646

Please sign in to comment.