Responsive Block Control <= 1.3.0 - Authenticated (Contributor+) Stored Cross-Site Scripting
Description
The Responsive Block Control plugin for WordPress is vulnerable to Stored Cross-Site Scripting in versions up to, and including, 1.3.0 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
<=1.3.0Source Code
WordPress.org SVN# Exploitation Research Plan - CVE-2025-62135 ## 1. Vulnerability Summary The **Responsive Block Control** plugin (<= 1.3.0) for WordPress is vulnerable to **Authenticated (Contributor+) Stored Cross-Site Scripting**. The plugin allows users to control the visibility of Gutenberg blocks based on de…
Show full research plan
Exploitation Research Plan - CVE-2025-62135
1. Vulnerability Summary
The Responsive Block Control plugin (<= 1.3.0) for WordPress is vulnerable to Authenticated (Contributor+) Stored Cross-Site Scripting. The plugin allows users to control the visibility of Gutenberg blocks based on device width. This is achieved by adding custom attributes to blocks. The vulnerability exists because these attributes are not properly sanitized upon being saved in the post content and are subsequently rendered on the frontend without sufficient escaping. An attacker with "Contributor" privileges (who can create and edit posts) can inject malicious JavaScript into these attributes.
2. Attack Vector Analysis
- Authentication Level: Contributor or higher (requires
edit_postscapability). - Vulnerable Endpoint: WordPress REST API post update/creation endpoint (
/wp-json/wp/v2/posts). - Vulnerable Parameter:
content(specifically, the JSON-encoded attributes within Gutenberg block comments). - Payload Location: Inside a block attribute managed by the plugin, such as a visibility setting or a custom CSS class field.
- Preconditions: The plugin must be active. The attacker must have credentials for a Contributor-level account.
3. Code Flow (Inferred)
- Input: A Contributor saves a post containing a Gutenberg block (e.g., a Paragraph block) with malicious attributes.
- Storage: WordPress saves the block in the
wp_poststable. The attributes are stored within the HTML comment delimiters, e.g.,<!-- wp:paragraph {"responsive_control_attr": "PAYLOAD"} -->. - Processing: When the post is viewed, the plugin uses the
render_blockhook (inferred) to modify the block's HTML output based on the stored attributes. - Sink: The plugin retrieves the attribute value and appends it to the block's wrapper element (likely as a CSS class or a
styleattribute) using string concatenation orprintfwithout applyingesc_attr()oresc_html(). - Execution: The payload is rendered in the victim's browser, leading to XSS.
4. Nonce Acquisition Strategy
To save a post via the REST API as a Contributor, a REST API nonce is required.
- Role Creation: Use WP-CLI to create a contributor user.
- Login: Log in to the WordPress admin dashboard as the contributor.
- Navigation: Use
browser_navigateto go to the "Add New Post" page:/wp-admin/post-new.php. - Extraction: Execute
browser_evalto extract the REST nonce from the globalwpApiSettingsobject.- JavaScript:
window.wpApiSettings.nonce
- JavaScript:
- Alternative: If using the classic editor/legacy AJAX, extract the nonce from
document.querySelector('#_wpnonce').value.
5. Exploitation Strategy
The goal is to inject a payload into a block attribute that the plugin processes and outputs.
- Step 1: Obtain the REST API nonce for the Contributor user.
- Step 2: Construct a REST API request to create a new post. The content will include a Gutenberg block with a malicious attribute.
- Target Attribute (Inferred): The plugin likely uses attributes like
responsiveVisibilityordevices. We will target a generic attribute and a predicted plugin-specific one. - Payload:
"><script>alert(document.domain)</script> - HTTP Request:
POST /wp-json/wp/v2/posts HTTP/1.1 Host: localhost:8888 Content-Type: application/json X-WP-Nonce: [EXTRACTED_NONCE] { "title": "XSS Test", "status": "draft", "content": "<!-- wp:paragraph {\"responsiveControl\": \"\\\" onmouseover=\\\"alert(1)\\\"\"} -->\n<p>Hover over this text.</p>\n<!-- /wp:paragraph -->" } - Step 3: Retrieve the
idof the created post from the JSON response. - Step 4: Navigate to the post preview or view the post (if published) to trigger the XSS.
6. Test Data Setup
- Install Plugin:
wp plugin install responsive-block-control --version=1.3.0 --activate - Create User:
wp user create attacker attacker@example.com --role=contributor --user_pass=password123 - Identify Attributes: To be precise, first create a post manually in the UI, toggle a "Responsive Block Control" setting, and run
wp post get [ID] --field=post_contentto see the exact attribute name used by the plugin. (e.g.,devices).
7. Expected Results
- The HTTP request should return a
201 Createdstatus code. - The
post_contentin the database should contain the raw payload. - When viewing the post frontend, the HTML of the block should look like:
<div class="..." " onmouseover="alert(1)">...</div>or similar, indicating attribute injection. - A browser alert box should appear if a script tag was used or an event handler was triggered.
8. Verification Steps
- Check Database:
wp db query "SELECT post_content FROM wp_posts WHERE post_title='XSS Test'" - Verify Rendering: Use the
http_requesttool to GET the post URL and check if the payload is present in the response body unescaped.- Check if
alert(1)exists within the HTML. - Confirm the absence of
esc_attr(e.g.,"should not be").
- Check if
9. Alternative Approaches
- Block Variations: Try different Gutenberg blocks (Heading, Image, List) as the plugin might handle different block types with different code paths.
- Meta-based Injection: If the plugin uses post meta instead of block attributes for certain settings, attempt to update post meta via the REST API or
admin-ajax.php. - Classic Editor: If the site uses the Classic Editor, the plugin might use shortcodes. Test injecting the payload into shortcode attributes:
[shortcode attr='"><script>alert(1)</script>'].
Summary
The Responsive Block Control plugin for WordPress is vulnerable to Authenticated (Contributor+) Stored Cross-Site Scripting in versions up to 1.3.0. This is due to the plugin's failure to sanitize and escape block attributes, such as visibility settings, when they are rendered as part of a block's HTML wrapper.
Security Fix
@@ -10,1 +10,1 @@ - $content = str_replace( 'class="', 'class="' . $attributes['responsiveControl'] . ' ', $content ); + $content = str_replace( 'class="', 'class="' . esc_attr( $attributes['responsiveControl'] ) . ' ', $content );
Exploit Outline
An attacker with Contributor-level access or higher can exploit this by first obtaining a WordPress REST API nonce (found in the 'wpApiSettings' object in the admin dashboard). The attacker then creates or updates a post via the `/wp-json/wp/v2/posts` endpoint, embedding a Gutenberg block containing a malicious payload in its JSON-encoded attributes (e.g., '" onmouseover="alert(1)"'). When the post is viewed by any user, the injected attribute is rendered without escaping into the block's wrapper element, leading to script execution.
Check if your site is affected.
Run a free security audit to detect vulnerable plugins, outdated versions, and misconfigurations.