CVE-2024-1658
Executive Summary
CVE-2024-1658 is a Stored Cross-Site Scripting (XSS) vulnerability in the Grid Shortcodes WordPress plugin, affecting versions prior to 1.1.1. The vulnerability arises from insufficient validation and escaping of shortcode attributes before they are output in a page or post. This allows authenticated users with at least the Contributor role to inject arbitrary JavaScript, which executes when other users view the compromised content. The vulnerability is classified as a WordPress ecosystem issue, not related to the underlying web server (Apache/Nginx). No public exploit code or active exploitation has been reported, but the risk is elevated due to the plugin's widespread use in content-rich sites.
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
Supply Chain & Package Security
This vulnerability is specific to the WordPress plugin ecosystem. The plugin is distributed via the official WordPress Plugin Directory. Users should verify they are running version 1.1.1 or later. No known supply chain compromise has been reported.
CVSS Breakdown & Threat Level
- CVSS Vector: CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:L/I:L/A:N
- Base Score: 6.1 (Medium)
- Attack Vector: Network
- Attack Complexity: Low
- Privileges Required: Low (Contributor role)
- User Interaction: None
- Scope: Changed
- Confidentiality Impact: Low
- Integrity Impact: Low
- Availability Impact: None
Threat Level: Medium. The vulnerability requires authenticated access but can lead to persistent compromise of user sessions and content integrity.
Deep Dive & Mechanics
The Grid Shortcodes plugin provides custom shortcodes (e.g., [grid], [grid_item]) that allow users to create grid layouts. The vulnerability exists because the plugin does not properly sanitize or escape shortcode attributes before rendering them in the HTML output. An attacker with Contributor-level access can craft a shortcode with malicious JavaScript in an attribute, such as:
[grid_item title="<script>alert('XSS')</script>"]
When the post or page containing this shortcode is viewed, the script executes in the context of the victim's browser. The attack is stored (persistent) because the malicious payload is saved in the database and served to all visitors.
Vulnerable vs. Patched Code
Vulnerable Code (version < 1.1.1):
The plugin likely used echo or print without escaping, e.g.:
echo '<div class="grid-item" title="' . $atts['title'] . '">';
Patched Code (version 1.1.1):
The fix applies proper escaping functions like esc_attr() or wp_kses():
echo '<div class="grid-item" title="' . esc_attr($atts['title']) . '">';
Exploitation & Lab Setup
Red Team
- Prerequisites: WordPress site with Grid Shortcodes < 1.1.1, an account with Contributor role or higher.
- Steps:
- Log in as a Contributor.
- Create a new post or edit an existing one.
- Insert a shortcode with a malicious attribute:
[grid_item title="<img src=x onerror=alert('XSS')>"] - Publish or save the post.
- When an admin or visitor views the post, the script executes.
Blue Team
- Detection: Monitor for posts containing suspicious shortcode attributes (e.g.,
<script>,onerror,onload). - Prevention: Ensure the plugin is updated to version 1.1.1. Use a Web Application Firewall (WAF) to block XSS payloads in shortcode attributes.
- Response: If compromised, remove the malicious shortcode from the database and reset affected user sessions.
Indicators of Compromise (IOCs)
- File:
/wp-content/plugins/grid-shortcodes/grid-shortcodes.php(version < 1.1.1) - Database: Posts/pages containing shortcodes with unescaped HTML/JavaScript in attributes.
- Network: HTTP requests to
/wp-admin/post.phpor/wp-admin/post-new.phpwith shortcode parameters containing XSS payloads. - Logs: WordPress debug logs showing PHP notices related to shortcode rendering.
Detection Engineering
YARA Rule
rule CVE_2024_1658_Grid_Shortcodes_XSS {
meta:
description = "Detects Grid Shortcodes plugin files vulnerable to CVE-2024-1658"
author = "Valters IT"
date = "2025-04-14"
reference = "CVE-2024-1658"
strings:
$vuln_func = /echo\s*.*\$atts\[/
$shortcode = /add_shortcode\s*\(\s*['"]grid/
condition:
$shortcode and $vuln_func
}
Sigma Rule
title: CVE-2024-1658 Grid Shortcodes XSS Detection
id: 8a9b7c6d-5e4f-3a2b-1c0d-9e8f7a6b5c4d
status: experimental
description: Detects attempts to exploit Stored XSS in Grid Shortcodes plugin
author: Valters IT
date: 2025-04-14
logsource:
category: webserver
product: apache
detection:
selection:
cs-method: 'POST'
c-uri|contains: '/wp-admin/post.php'
cs-uri-query|contains:
- '<script'
- 'onerror='
- 'onload='
condition: selection
falsepositives:
- Legitimate use of HTML in shortcode attributes (rare)
level: high
Suricata Rule
alert http $HOME_NET any -> $EXTERNAL_NET any (msg:"CVE-2024-1658 Grid Shortcodes XSS Attempt"; flow:to_server,established; content:"POST"; http_method; content:"/wp-admin/post.php"; http_uri; content:"<script"; nocase; http_client_body; sid:1000001; rev:1;)
Remediation & Mitigation
- Immediate: Upgrade the Grid Shortcodes plugin to version 1.1.1 or later.
- Workaround: If upgrade is not possible, disable the plugin and use an alternative grid solution.
- Long-term: Implement a Content Security Policy (CSP) to mitigate XSS impact. Regularly audit WordPress plugins for vulnerabilities.
- Validation: After patching, verify that shortcode attributes are properly escaped by testing with a sample payload.
Valters IT
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.