From 07dd358d0e12071d53b5f34dbada03fb4c64f06d Mon Sep 17 00:00:00 2001 From: David Goodwin Date: Wed, 18 Nov 2026 11:16:55 +0000 Subject: [PATCH] block XSS issues due to Smarty escape:quotes not escaping double quotes, block aliases without only one @ to be a route for XSS - thanks @mirko, CVE-2026-127178 --- model/AliasHandler.php | 10 ++++++++++ templates/list-virtual_mailbox.tpl | 4 ++-- templates/list.tpl | 4 ++-- 3 files changed, 14 insertions(+), 4 deletions(-) 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}
- +