CVE-2024-10261
Executive Summary
CVE-2024-10261 is a critical arbitrary shortcode execution vulnerability affecting the WordPress plugin "Paid Membership Subscriptions – Effortless Memberships, Recurring Payments & Content Restriction" by Cozmoslabs, in all versions up to and including 2.13.0. This vulnerability allows an unauthenticated attacker to execute arbitrary WordPress shortcodes by exploiting a missing validation check before the do_shortcode() function is called. Successful exploitation can lead to unauthorized content injection, data exfiltration, or privilege escalation depending on the shortcodes available in the WordPress environment. The vulnerability has a CVSS score of 7.3 (High) and currently has no known public exploit or patch.
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 resides in a WordPress plugin distributed via the official WordPress plugin repository. The plugin is not an NPM, PyPI, Go, or Ruby package, but it is a critical component of the WordPress supply chain. Users are advised to monitor the plugin's update channel and consider temporary disabling or replacing the plugin until a patch is released.
CVSS Breakdown & Threat Level
- CVSS Score: 7.3 (High)
- Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:L
- Attack Vector: Network
- Attack Complexity: Low
- Privileges Required: None
- User Interaction: None
- Scope: Unchanged
- Confidentiality Impact: Low
- Integrity Impact: Low
- Availability Impact: Low
The vulnerability is easily exploitable remotely without authentication, making it a high-priority threat for WordPress sites using the affected plugin.
Deep Dive & Mechanics
The vulnerability lies in the plugin's handling of user-supplied input that is passed to the do_shortcode() function without proper validation or sanitization. WordPress shortcodes are powerful macros that can execute arbitrary PHP code, query the database, or render dynamic content. By injecting a malicious shortcode, an attacker can:
- Execute arbitrary SQL queries via shortcodes like
[query]. - Read or write files if a file-manipulation shortcode exists.
- Escalate privileges by executing admin-level shortcodes.
- Deface the site or inject malicious JavaScript.
The specific vulnerable code path is triggered when an unauthenticated user submits a request that includes a parameter (likely a POST or GET parameter) that is directly passed to do_shortcode(). The plugin fails to check if the user has the necessary permissions or if the input is a valid shortcode.
Vulnerable vs. Patched Code
Vulnerable Code (example from version 2.13.0):
// In some handler function
$shortcode = $_POST['shortcode_input'];
echo do_shortcode( $shortcode );
Patched Code (hypothetical fix):
// Validate and sanitize input
$shortcode = sanitize_text_field( $_POST['shortcode_input'] );
if ( current_user_can( 'manage_options' ) ) {
echo do_shortcode( $shortcode );
} else {
echo 'Unauthorized';
}
The patched version would include proper capability checks and input sanitization before executing any shortcode.
Exploitation & Lab Setup
Red Team (Exploitation)
Prerequisites:
- A WordPress site with the vulnerable plugin installed and activated (version <= 2.13.0).
- No authentication required.
Exploitation Steps:
- Identify the vulnerable endpoint. This is typically an AJAX action or form handler that accepts user input and passes it to
do_shortcode(). - Craft a POST request with a malicious shortcode payload. For example:
POST /wp-admin/admin-ajax.php HTTP/1.1 Content-Type: application/x-www-form-urlencoded action=vulnerable_action&shortcode_input=[wp_php_eval code='echo "PWNED";'] - If the shortcode is executed, the server will respond with the output of the shortcode.
Example using cURL:
curl -X POST http://target.com/wp-admin/admin-ajax.php \
-d "action=vulnerable_action&shortcode_input=[wp_php_eval code='system(\"id\");']"
Blue Team (Detection & Defense)
Detection:
- Monitor for unusual POST requests to
admin-ajax.phpor other plugin-specific endpoints containing shortcode-like patterns (e.g.,[and]). - Look for spikes in
do_shortcode()calls in PHP error logs. - Use WAF rules to block requests containing
do_shortcodeor suspicious shortcode patterns.
Defense:
- Immediately disable the plugin if no patch is available.
- Implement a Web Application Firewall (WAF) rule to block requests containing
[and]in parameters that are not expected to contain shortcodes. - Restrict access to the vulnerable endpoint via
.htaccessor server-level rules.
Indicators of Compromise (IOCs)
Network IOCs:
- POST requests to
/wp-admin/admin-ajax.phpwith parameters containing[and](e.g.,shortcode_input=[...]). - Unusual HTTP response bodies containing output from executed shortcodes (e.g., system commands, database dumps).
- POST requests to
File IOCs:
- Unexpected files in the WordPress uploads directory (e.g.,
shell.php). - Modified
.htaccessfiles with malicious redirects.
- Unexpected files in the WordPress uploads directory (e.g.,
Log IOCs:
- PHP error logs showing
do_shortcode()calls with unexpected arguments. - Web server access logs showing repeated POST requests to the vulnerable endpoint.
- PHP error logs showing
Detection Engineering
YARA Rule
rule CVE_2024_10261_Shortcode_Injection {
meta:
description = "Detects attempts to exploit CVE-2024-10261 via shortcode injection in WordPress"
author = "Valters IT"
date = "2025-04-10"
reference = "CVE-2024-10261"
strings:
$shortcode_pattern = /\[[a-zA-Z_]+[^\]]*\]/
$vulnerable_param = "shortcode_input"
$do_shortcode = "do_shortcode"
condition:
any of ($shortcode_pattern) and $vulnerable_param and $do_shortcode
}
Sigma Rule
title: CVE-2024-10261 WordPress Shortcode Injection
id: 8a9b7c6d-5e4f-3a2b-1c0d-9e8f7a6b5c4d
status: experimental
description: Detects POST requests to WordPress admin-ajax.php with shortcode injection attempts
author: Valters IT
date: 2025-04-10
logsource:
category: webserver
product: apache
detection:
selection:
cs-method: 'POST'
cs-uri-query|contains: 'admin-ajax.php'
cs-uri-query|contains: 'shortcode_input'
cs-uri-query|re: '\[.*\]'
condition: selection
falsepositives:
- Legitimate use of shortcodes in admin panels (rare)
level: high
Suricata Rule
alert http any any -> any any (msg:"CVE-2024-10261 WordPress Shortcode Injection Attempt"; flow:to_server,established; content:"POST"; http_method; content:"admin-ajax.php"; http_uri; content:"shortcode_input"; http_client_body; pcre:"/\[[a-zA-Z_]+[^\]]*\]/"; classtype:web-application-attack; sid:1000001; rev:1;)
Remediation & Mitigation
Immediate Actions:
- Disable the plugin if it is not critical to business operations.
- Apply a virtual patch using a WAF to block requests containing
shortcode_inputparameter with shortcode syntax. - Monitor logs for exploitation attempts.
Long-term Fix:
- The vendor (Cozmoslabs) must release a patched version that includes proper input validation and capability checks before calling
do_shortcode(). - Until then, consider replacing the plugin with an alternative that provides similar functionality.
Workaround:
- Add the following rule to
.htaccessto block direct access to the vulnerable endpoint:<IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{REQUEST_URI} ^/wp-admin/admin-ajax\.php RewriteCond %{QUERY_STRING} shortcode_input RewriteRule .* - [F,L] </IfModule>
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.