diff --git a/CHANGELOG b/CHANGELOG index af3fe850c..03f5ee993 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -25,6 +25,7 @@ CHANGELOG Roundcube Webmail - Managesieve: Fix so "Create filter" option does not show up when Filters menu is disabled (#6723) - Enigma: Fix bug where revoked users/keys were not greyed out in key info - Enigma: Fix error message when trying to encrypt with a revoked key (#6607) +- Enigma: Fix "decryption oracle" bug [CVE-2019-10740] (#6638) - Fix so advanced search dialog is not automatically displayed on searchonly addressbooks (#6679) - Fix so an error is logged when more than one attachment plugin has been enabled, initialize the first one (#6735) - Fix bug where flag change could have been passed to a preview frame when not expected diff --git a/plugins/enigma/lib/enigma_engine.php b/plugins/enigma/lib/enigma_engine.php index de6afd678..521c614d3 100644 --- a/plugins/enigma/lib/enigma_engine.php +++ b/plugins/enigma/lib/enigma_engine.php @@ -368,20 +368,36 @@ class enigma_engine */ function part_structure($p, $body = null) { + static $got_content = false; + + // Prevent from "decryption oracle" [CVE-2019-10740] (#6638) + // On mail compose (edit/reply/forward) we support encrypted content only + // in the first "content part" of the message. + if ($got_content && $this->rc->task == 'mail' && $this->rc->action == 'compose') { + return; + } + // Don't be tempted to support encryption in text/html parts // Because of EFAIL vulnerability we should never support this (#6289) if ($p['mimetype'] == 'text/plain' || $p['mimetype'] == 'application/pgp') { $this->parse_plain($p, $body); + $got_content = true; } else if ($p['mimetype'] == 'multipart/signed') { $this->parse_signed($p, $body); + $got_content = true; } else if ($p['mimetype'] == 'multipart/encrypted') { $this->parse_encrypted($p); + $got_content = true; } else if ($p['mimetype'] == 'application/pkcs7-mime') { $this->parse_encrypted($p); + $got_content = true; + } + else { + $got_content = $p['structure']->type === 'content'; } return $p;