mirror of
https://github.com/postfixadmin/postfixadmin.git
synced 2026-11-20 23:43:26 +03:00
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
This commit is contained in:
3 files changed
+14
-4
No files matched your search
@@ -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@<payload>@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
|
||||
|
||||
@@ -116,9 +116,9 @@
|
||||
<td>
|
||||
<form method="post" action="delete.php">
|
||||
<input type="hidden" name="table" value="mailbox">
|
||||
<input type="hidden" name="delete" value="{$item.username|escape:"quotes"}">
|
||||
<input type="hidden" name="delete" value="{$item.username}">
|
||||
<input type="hidden" name="token" value="{$smarty.session.PFA_token|escape:"quotes"}">
|
||||
<button type="submit" class="btn btn-danger list-action-icon" title="{$PALANG.del}" aria-label="{$PALANG.del}" onclick="return confirm ('{$PALANG.confirm}{$PALANG.mailboxes}: {$item.username}');">
|
||||
<button type="submit" class="btn btn-danger list-action-icon" title="{$PALANG.del}" aria-label="{$PALANG.del}" onclick="return confirm ('{$PALANG.confirm}{$PALANG.mailboxes}: {$RAW_tMailbox[$i].username|escape:'javascript'|escape:'html'}');">
|
||||
<span class="glyphicon glyphicon-trash" aria-hidden="true"></span>
|
||||
</button>
|
||||
</form>
|
||||
|
||||
+2
-2
@@ -158,11 +158,11 @@
|
||||
<td class="list-col-action">{if $item._can_delete}
|
||||
<form method="post" action="{#url_delete#}">
|
||||
<input type="hidden" name="table" value="{$table}">
|
||||
<input type="hidden" name="delete" value="{$RAW_item.$id_field|escape:"quotes"}">
|
||||
<input type="hidden" name="delete" value="{$item.$id_field}">
|
||||
<input type="hidden" name="token" value="{$smarty.session.PFA_token|escape:"quotes"}">
|
||||
|
||||
<button class="btn btn-danger list-action-icon" title="{$PALANG.del}" aria-label="{$PALANG.del}"
|
||||
onclick="return confirm('{$PALANG.{$msg.confirm_delete}|replace:'%s':$item.$id_field}')">
|
||||
onclick="return confirm('{$PALANG.{$msg.confirm_delete}|replace:'%s':{$RAW_item.$id_field|escape:'javascript'|escape:'html'}}')">
|
||||
<span class="glyphicon glyphicon-trash" aria-hidden="true"></span>
|
||||
</button>
|
||||
</form>
|
||||
|
||||
Reference in new issue
Block a user