diff --git a/model/AliasHandler.php b/model/AliasHandler.php index 76e089f4..4d8d875e 100644 --- a/model/AliasHandler.php +++ b/model/AliasHandler.php @@ -194,6 +194,16 @@ class AliasHandler extends PFAHandler return false; } + # A valid alias address contains exactly one "@": either "localpart@domain" + # or a "@domain" catch-all. Reject anything else here - otherwise an address + # such as "@domain@@domain" slips past the catch-all shortcut below + # (explode() yields an empty local part, so check_email() is skipped) and is + # stored verbatim, which allows stored HTML/JS injection in the alias list. + if (substr_count($this->id, '@') !== 1) { + $this->errormsg[$this->id_field] = Config::lang('pCreate_alias_address_text_error1'); + return false; + } + list($local_part, $domain) = explode('@', $this->id); # TODO: already checked in set() - does it make sense to check it here also? Only advantage: it's an early check diff --git a/templates/list-virtual_mailbox.tpl b/templates/list-virtual_mailbox.tpl index 8f2ef58b..7884ba3c 100644 --- a/templates/list-virtual_mailbox.tpl +++ b/templates/list-virtual_mailbox.tpl @@ -116,9 +116,9 @@
- + -
diff --git a/templates/list.tpl b/templates/list.tpl index 30b800ed..b13fdf09 100644 --- a/templates/list.tpl +++ b/templates/list.tpl @@ -158,11 +158,11 @@ {if $item._can_delete}
- +