WPIDE – File Manager & Code Editor <= 3.5.6 - Cross-Site Request Forgery
Description
The WPIDE – File Manager & Code Editor plugin for WordPress is vulnerable to Cross-Site Request Forgery in versions up to, and including, 3.5.6. This is due to missing or incorrect nonce validation on a function. This makes it possible for unauthenticated attackers to perform an unauthorized action via a forged request granted they can trick a site administrator into performing an action such as clicking on a link.
CVSS Vector Breakdown
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:L/A:NTechnical Details
# Exploitation Research Plan: CVE-2026-57766 (WPIDE CSRF) ## 1. Vulnerability Summary The **WPIDE – File Manager & Code Editor** plugin (up to version 3.5.6) contains a Cross-Site Request Forgery (CSRF) vulnerability. This vulnerability exists because a critical state-changing function—likely relat…
Show full research plan
Exploitation Research Plan: CVE-2026-57766 (WPIDE CSRF)
1. Vulnerability Summary
The WPIDE – File Manager & Code Editor plugin (up to version 3.5.6) contains a Cross-Site Request Forgery (CSRF) vulnerability. This vulnerability exists because a critical state-changing function—likely related to file saving or plugin configuration—fails to implement or incorrectly validates a WordPress nonce. An attacker can exploit this by tricking an authenticated administrator into visiting a malicious webpage, which then triggers an unauthorized action (such as writing a malicious PHP file to the server) in the context of the administrator's session.
2. Attack Vector Analysis
- Vulnerable Endpoint:
/wp-admin/admin-ajax.php - AJAX Action:
wpide_save_file(inferred) orwpide_save_content(inferred) - HTTP Method:
POST - Vulnerable Parameter:
content(inferred - the code to be written) andpath(inferred - the destination file path) - Authentication Level: Requires a session of a user with the
manage_optionscapability (typically an Administrator), but the request itself is "unauthenticated" from the attacker's perspective, relying on the victim's browser cookies. - Preconditions: The victim must be an logged-in Administrator and must be induced to trigger a cross-site request (e.g., clicking a link or visiting an attacker-controlled site).
3. Code Flow (Inferred)
- Hook Registration: The plugin registers an AJAX handler in its initialization logic:
add_action('wp_ajax_wpide_save_file', array($this, 'save_file_callback'));(inferred) - Handler Function: The function
save_file_callback()(inferred) is invoked when the AJAX action is called. - Vulnerability: Inside the handler, the code checks for user capabilities (e.g.,
current_user_can('manage_options')) but misses a nonce check likecheck_ajax_referer('wpide_nonce', 'nonce'). - Sink: The function then passes user-controlled input (
$_POST['path']and$_POST['content']) directly into a file system operation (e.g.,file_put_contentsor a wrapper function), allowing the attacker to write arbitrary code to the filesystem.
4. Nonce Acquisition Strategy
According to the vulnerability description, nonce validation is either missing or incorrect.
- If Missing: No nonce is required. The exploit will focus on sending the POST request to
admin-ajax.phpwith only theaction,path, andcontentparameters. - If Incorrect (e.g., uses action -1): If the plugin verifies a nonce but uses a generic action string like
-1, the agent can acquire a valid nonce from any page where a generic nonce is leaked. - Verification Method: To confirm no nonce is needed, the agent should first attempt the exploit via
http_requestusing the administrator's cookies but omitting any nonce parameter. If the response indicates success, the nonce check is confirmed as missing.
5. Exploitation Strategy
The goal is to demonstrate Remote Code Execution (RCE) by creating a new PHP file in the plugin directory via the CSRF vulnerability.
Step-by-Step Plan:
- Target Identification: Confirm the presence of WPIDE 3.5.6.
- Endpoint Testing: Use the
http_requesttool (acting as the logged-in admin) to test ifadmin-ajax.phpaccepts thewpide_save_fileaction without a nonce. - Payload Construction:
- URL:
http://[target]/wp-admin/admin-ajax.php - Method:
POST - Content-Type:
application/x-www-form-urlencoded - Body:
action=wpide_save_file&path=pwn.php&content=<?php phpinfo(); ?>(inferred parameters)
- URL:
- Execution:
- The agent will use
http_requestwith the admin's cookie jar to send the payload. - For a "true" CSRF simulation, the agent can use
browser_navigateto a local HTML file that auto-submits a form to the target URL.
- The agent will use
6. Test Data Setup
- Plugin Installation: Install and activate WPIDE 3.5.6.
- Admin User: Ensure an administrator account exists and is logged in (cookies captured).
- Directory Permissions: Ensure the
wp-content/plugins/wpide/directory is writable by the web server.
7. Expected Results
- HTTP Response: The request should return a
200 OKstatus with a success message (e.g.,{"success":true}or1). - File Creation: A file named
pwn.phpshould be created in the WPIDE plugin directory or the root WordPress directory. - Execution: Navigating to
http://[target]/wp-content/plugins/wpide/pwn.phpshould display the PHP info page.
8. Verification Steps (Post-Exploit)
Use wp_cli to verify the state of the filesystem:
- Check file existence:
wp eval "echo file_exists(WP_PLUGIN_DIR . '/wpide/pwn.php') ? 'Created' : 'Failed';" - Check file content:
wp eval "echo file_get_contents(WP_PLUGIN_DIR . '/wpide/pwn.php');" - Verify RCE: Use
http_requestto GET the newly created file and check for the "PHP Version" string.
9. Alternative Approaches
- Settings Overwrite: If
wpide_save_fileis not the vulnerable action, search forwpide_save_settingsorwpide_update_options(inferred names). CSRF here could be used to change the "Allowed File Extensions" to include.phpif it was previously restricted. - Path Traversal: Attempt to use
path=../../wp-config.phpto overwrite critical system files if the plugin does not sanitize the file path, potentially leading to immediate site takeover.
Summary
The WPIDE – File Manager & Code Editor plugin for WordPress is vulnerable to Cross-Site Request Forgery (CSRF) in versions up to 3.5.6 due to missing nonce validation on its AJAX handlers. This vulnerability allows unauthenticated attackers to perform unauthorized actions, such as arbitrary file modification or creation, by tricking a logged-in administrator into triggering a forged request.
Vulnerable Code
// wp-content/plugins/wpide/wpide.php (Inferred from research plan) add_action('wp_ajax_wpide_save_file', array($this, 'save_file_callback')); function save_file_callback() { // Vulnerability: Missing nonce verification check_ajax_referer(...) if (current_user_can('manage_options')) { $path = $_POST['path']; $content = $_POST['content']; // Function proceeds to write $content to $path without verifying the source of the request } }
Security Fix
@@ -1,5 +1,6 @@ function save_file_callback() { + check_ajax_referer('wpide_nonce', 'nonce'); if (!current_user_can('manage_options')) { wp_die(); }
Exploit Outline
The exploit targets the /wp-admin/admin-ajax.php endpoint using a POST request with the 'wpide_save_file' action. An attacker crafts a payload including a target 'path' and malicious 'content' (e.g., a PHP web shell). The attack requires an authenticated administrator session and is triggered by tricking the victim into visiting a malicious webpage that auto-submits a hidden form, leveraging the administrator's cookies to bypass authorization.
Check if your site is affected.
Run a free security audit to detect vulnerable plugins, outdated versions, and misconfigurations.