YayMail <= 4.3.2 - Missing Authorization to Authenticated (Shop Manager+) Plugin Installation and Activation
Description
The YayMail - WooCommerce Email Customizer plugin for WordPress is vulnerable to unauthorized plugin installation and activation due to missing capability checks on the 'yaymail_install_yaysmtp' AJAX action and `/yaymail/v1/addons/activate` REST endpoint in all versions up to, and including, 4.3.2. This makes it possible for authenticated attackers, with Shop Manager-level access and above, to install and activate the YaySMTP plugin.
CVSS Vector Breakdown
CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:U/C:N/I:L/A:NTechnical Details
<=4.3.2What Changed in the Fix
Changes introduced in v4.3.3
Source Code
WordPress.org SVN# Exploitation Research Plan: CVE-2026-1831 - YayMail Missing Authorization ## 1. Vulnerability Summary The **YayMail – WooCommerce Email Customizer** plugin (versions <= 4.3.2) fails to implement sufficient authorization checks on two specific entry points: 1. **AJAX Action:** `yaymail_install_ya…
Show full research plan
Exploitation Research Plan: CVE-2026-1831 - YayMail Missing Authorization
1. Vulnerability Summary
The YayMail – WooCommerce Email Customizer plugin (versions <= 4.3.2) fails to implement sufficient authorization checks on two specific entry points:
- AJAX Action:
yaymail_install_yaysmtp - REST API Endpoint:
/yaymail/v1/addons/activate
The vulnerability allows authenticated users with Shop Manager level permissions (or any role possessing the manage_woocommerce or similar mid-level capabilities) to install and activate the YaySMTP plugin. In a standard WordPress environment, plugin installation and activation are restricted to users with the install_plugins and activate_plugins capabilities (typically only Administrators).
2. Attack Vector Analysis
- Endpoints:
POST /wp-admin/admin-ajax.php?action=yaymail_install_yaysmtpPOST /wp-json/yaymail/v1/addons/activate
- Required Role: Shop Manager (Authenticated).
- Payload Parameters:
- For AJAX:
action=yaymail_install_yaysmtp(and likely a nonce). - For REST: The endpoint
/yaymail/v1/addons/activatelikely expects a JSON body or query parameter identifying the addon (e.g.,{"slug": "yaysmtp"}).
- For AJAX:
- Preconditions: The YaySMTP plugin must not already be active (or must be available for installation in the WP repo).
3. Code Flow (Inferred from Patch/Description)
- AJAX Entry Point: The plugin registers the action
wp_ajax_yaymail_install_yaysmtp. - Missing Check: The callback function for this action likely lacks a
current_user_can( 'install_plugins' )check. It may only checkis_user_logged_in()or a lower-level capability likemanage_woocommerce. - REST Entry Point: The route
/yaymail/v1/addons/activateis registered viaregister_rest_route. - Permission Callback: The
permission_callbackfor this route likely returnstruefor any user with Shop Manager access, or fails to verify the specific capability required for plugin manipulation. - Sink: The backend logic uses WordPress core functions like
plugins_api(),WP_Upgrader, oractivate_plugin()to fetch and enable the YaySMTP plugin.
4. Nonce Acquisition Strategy
The AJAX handler likely verifies a nonce. Based on the file assets/dist/yaymail/yaymail-main.tsx-523766ce.js, the plugin is a React-based application. It likely localizes its settings and nonces into a global JavaScript object.
Extraction Steps:
- Create a Shop Manager user.
- Login as the Shop Manager and navigate to the YayMail interface (usually under
WooCommerce > Email Customizeror a top-levelYayMailmenu). - The plugin likely enqueues its settings via
wp_localize_script. Common variable names for this plugin includeyaymail_settingsoryaymail_localize. - Use
browser_evalto find the nonce:browser_eval("window.yaymail_settings?.nonce")browser_eval("window.yaymail_localize?.nonce")browser_eval("window.yaymail_settings?.ajax_nonce")
5. Exploitation Strategy
Phase 1: AJAX Installation
- Target URL:
http://[target]/wp-admin/admin-ajax.php - Method:
POST - Headers:
Content-Type: application/x-www-form-urlencoded - Body:
action=yaymail_install_yaysmtp&nonce=[EXTRACTED_NONCE]
Phase 2: REST Activation
If the installation succeeds but activation is a separate step:
- Target URL:
http://[target]/wp-json/yaymail/v1/addons/activate - Method:
POST - Headers:
Content-Type: application/jsonX-WP-Nonce: [REST_NONCE](The REST nonce can be found viawindow.wpApiSettings.nonceor in the page source).
- Body (Inferred):
{ "slug": "yaysmtp" }
6. Test Data Setup
- Install YayMail: Ensure version 4.3.2 or lower is installed.
- WooCommerce: Ensure WooCommerce is active (as YayMail is a WooCommerce customizer).
- Attacker User:
wp user create attacker attacker@example.com --role=shop_manager --user_pass=password - Verify Initial State:
wp plugin is-installed yaysmtp || echo "Not installed"
7. Expected Results
- AJAX Request: Should return a
200 OKwith a JSON body indicating success (e.g.,{"success": true, "data": "..."}). - REST Request: Should return a
200 OKor201 Createdindicating the plugin was activated. - System State: The
yaysmtpdirectory should now exist inwp-content/plugins/and be marked as active in the database.
8. Verification Steps
After performing the HTTP requests:
- Check Plugin Installation:
wp plugin is-installed yaysmtp - Check Plugin Status:
wp plugin status yaysmtp - Check if Active:
wp plugin is-active yaysmtp
9. Alternative Approaches
- Generic Addon Activation: If
yaysmtpis not the only addon, check if the REST endpoint/yaymail/v1/addons/activateaccepts other slugs. - Direct REST Exploration: If the AJAX action fails due to strict nonce checking, focus on the REST endpoint. REST endpoints often have weaker
permission_callbackimplementations in plugins that bridge specialized roles like Shop Manager. - Search for other nonces: If the
yaymail_settingsobject is not found, search the HTML source for any string containing_nonceornoncewithin<script>tags to identify the correct localization variable.
Summary
The YayMail plugin for WordPress is vulnerable to unauthorized plugin installation and activation due to missing capability checks on the 'yaymail_install_yaysmtp' AJAX action and REST API endpoints. This allows authenticated attackers with Shop Manager-level permissions or higher to install and activate the YaySMTP plugin, a privilege normally reserved for Administrators.
Vulnerable Code
// src/Ajax.php line 230 public function yaymail_install_yaysmtp() { $nonce = isset( $_POST['nonce'] ) ? sanitize_text_field( $_POST['nonce'] ) : ''; if ( ! wp_verify_nonce( $nonce, 'yaymail_frontend_nonce' ) ) { return wp_send_json_error( [ 'mess' => __( 'Verify nonce failed', 'yaymail' ) ] ); } // Missing capability check before proceeding to installation try { $is_installed = $this->process_plugin_installer( 'yaysmtp' ); --- // src/Controllers/AddonController.php line 39 register_rest_route( YAYMAIL_REST_NAMESPACE, '/addons/activate', [ [ 'methods' => \WP_REST_Server::EDITABLE, 'callback' => [ $this, 'exec_activate_addon' ], 'permission_callback' => [ $this, 'permission_callback' ], // Evaluates to true for Shop Managers ], ] );
Security Fix
@@ -231,6 +231,11 @@ if ( ! wp_verify_nonce( $nonce, 'yaymail_frontend_nonce' ) ) { return wp_send_json_error( [ 'mess' => __( 'Verify nonce failed', 'yaymail' ) ] ); } + + if ( ! current_user_can( 'install_plugins' ) && ! current_user_can( 'activate_plugins' ) ) { + return wp_send_json_error( [ 'mess' => __( 'You do not have permission to install plugins', 'yaymail' ) ] ); + } + try { $is_installed = $this->process_plugin_installer( 'yaysmtp' ); @@ -21,6 +21,10 @@ $this->init_hooks(); } + protected function permission_callback_admin_only() { + return current_user_can( 'activate_plugins' ); + } + protected function init_hooks() { register_rest_route( YAYMAIL_REST_NAMESPACE, @@ -40,7 +44,7 @@ [ 'methods' => \WP_REST_Server::EDITABLE, 'callback' => [ $this, 'exec_activate_addon' ], - 'permission_callback' => [ $this, 'permission_callback' ], + 'permission_callback' => [ $this, 'permission_callback_admin_only' ], ], ] ); @@ -51,7 +55,7 @@ [ 'methods' => \WP_REST_Server::EDITABLE, 'callback' => [ $this, 'exec_deactivate_addon' ], - 'permission_callback' => [ $this, 'permission_callback' ], + 'permission_callback' => [ $this, 'permission_callback_admin_only' ], ], ] );
Exploit Outline
The exploit targets the AJAX action and REST API. An attacker authenticated with a Shop Manager role first extracts the 'yaymail_frontend_nonce' from the localized script variables in the WordPress admin dashboard (e.g., window.yaymail_settings.nonce). To install the plugin, the attacker sends a POST request to wp-admin/admin-ajax.php with the action 'yaymail_install_yaysmtp' and the valid nonce. To activate the plugin, the attacker sends a POST request to the REST endpoint /wp-json/yaymail/v1/addons/activate, providing the slug 'yaysmtp'. Because the plugin only checks for a valid session and nonce but fails to verify if the user has 'install_plugins' or 'activate_plugins' capabilities, the requests succeed.
Check if your site is affected.
Run a free security audit to detect vulnerable plugins, outdated versions, and misconfigurations.