-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 NEFARIOUSPLAN-CANONICAL-V1 {"body_md":"## The role is one variable. wp_capabilities is its storage.\n\nThe Easy Elements for Elementor plugin (slug `easy-elements`, latest released version 1.4.5 on the WordPress.org plugin directory as of 2026-05-23) registers a Login/Register Elementor widget. The widget's submission handler lives in `widgets/login-register/class.login-register.php`. The class registers two AJAX hooks against the same method:\n\n```php\nadd_action( 'wp_ajax_eel_register', [$this, 'easyel_handle_register'] );\nadd_action( 'wp_ajax_nopriv_eel_register', [$this, 'easyel_handle_register'] );\n```\n\nThe `_nopriv_` half makes the endpoint callable without authentication. That registration is correct by design; a public registration form has to accept unauthenticated submissions to do its job. The handler's first responsibility is to make sure the new account it creates is not granted more authority than the site operator intended. The author understood this responsibility. The same file contains the private helper that enforces it:\n\n```php\nprivate function easyel_get_safe_registration_role() {\n $role = get_option( 'default_role', 'subscriber' );\n $role = apply_filters( 'easyel_registration_role', $role );\n\n if ( ! is_string( $role ) || $role === '' ) {\n return 'subscriber';\n }\n\n $role_obj = get_role( $role );\n if ( ! $role_obj ) {\n return 'subscriber';\n }\n\n $blocked_caps = [\n 'manage_options',\n 'promote_users',\n 'edit_users',\n 'create_users',\n 'delete_users',\n 'edit_others_posts',\n 'publish_posts',\n 'edit_published_posts',\n 'edit_theme_options',\n 'install_plugins',\n 'activate_plugins',\n 'unfiltered_html',\n ];\n foreach ( $blocked_caps as $cap ) {\n if ( ! empty( $role_obj->capabilities[ $cap ] ) ) {\n return 'subscriber';\n }\n }\n\n return $role;\n}\n```\n\nThe docstring above the method opens with one sentence: \"The role is never read from `$_POST`.\" The body refuses to return any role that holds any one of twelve dangerous capabilities, falling back to `subscriber` whenever the configured default role would. The list reads as an audit of the entire administrator capability set seen through one operator's mental model: install plugins, edit theme files, edit other users' posts, promote and create and delete users. Every capability on that list belongs to the administrator role. The author has enumerated the consequences of role injection and ruled them out, at the role layer.\n\nThe handler calls the helper exactly where the registration data is being built:\n\n```php\n$safe_role = $this->easyel_get_safe_registration_role();\n\n$user_data = [\n 'user_login' => ! empty( $_POST['user_login'] )\n ? sanitize_user( wp_unslash( $_POST['user_login'] ), true ) : '',\n 'user_email' => /* ... */,\n 'user_pass' => /* ... */,\n 'role' => $safe_role,\n /* first_name, last_name, display_name, nickname, etc. */\n];\n\n/* username, email, password validation */\n\n$user_id = wp_insert_user( $user_data );\n```\n\nThe defence is in scope, in the same function, on a line a reviewer cannot miss. `$safe_role` flows into `wp_insert_user`. WordPress's `wp_insert_user` then calls `WP_User::set_role($safe_role)`, which writes the role to the user's meta row. A code reviewer who walks the handler from top to bottom sees the helper, sees the docstring's promise, sees the role variable assigned from a server-side computation, and sees the validated user being inserted. The author has implemented role-injection defence in depth at the role field.\n\nFifty lines below `wp_insert_user`, the same function does this:\n\n```php\n// Save meta\nforeach ( $custom_meta as $key => $value ) {\n update_user_meta( $user_id, $key, $value );\n}\n```\n\nThe source of `$custom_meta` is two lines below the nonce check:\n\n```php\n$custom_meta = !empty($_POST['custom_meta'])\n ? map_deep( wp_unslash( $_POST['custom_meta'] ), 'sanitize_text_field' )\n : [];\n```\n\n`map_deep` is a WordPress recursion helper. It walks every leaf in a nested array or object and applies the callback to leaves only. It does not filter keys. It does not constrain shape. `sanitize_text_field` removes HTML tags, strips control characters, and normalises whitespace inside string values. The combined effect is that string leaves are passed through one of WordPress's standard sanitisers, and the keys arrive at the loop unchanged from `$_POST`.\n\nWordPress's user-meta table is shared between the user's role, the user's session tokens, the user's application passwords, and whatever profile fields the site decides to store. The role storage is the meta key `wp_capabilities`. `WP_User::set_role()` is one of the two ways to write it; its single non-bookkeeping line is `update_user_meta( $this->ID, $this->cap_key, $caps )`, where `$this->cap_key` is the string `wp_capabilities` on a default-prefixed install. `update_user_meta($user_id, 'wp_capabilities', $caps)` is the other way. The PHP runtime cannot tell them apart, because they are the same call.\n\nThe denylist guarded `wp_insert_user`. The unfiltered `foreach` writes to `wp_capabilities`.\n\n## From subscriber to administrator in one POST\n\nThe exploit chain is two requests. The first reads the registration-form page that the Login/Register Elementor widget renders. The form ships a CSRF nonce in a hidden input that `wp_nonce_field( 'easy_elements_nonce', 'eel_register_nonce' )` emits:\n\n```html\n\n```\n\nThe nonce was minted via `wp_create_nonce('easy_elements_nonce')` against user_id `0`, because the renderer ran for an unauthenticated visitor. WordPress's `wp_verify_nonce` accepts a token issued to user_id `0` as proof of CSRF freshness for the named action; it does not assert anything about who the caller is. The registration handler's only identity gate is `wp_verify_nonce($posted_nonce, 'easy_elements_nonce')`, and the token, action, and identity check are all bound to the unauthenticated tier the form was designed for. Trusting that nonce on the registration path is correct; the form is `nopriv` by intent, and `subscriber` creation is the operation the operator opted into when they ticked \"Anyone can register.\" Where nonce is not auth bites is one section down: the meta loop performs an administrator-grant operation under the same `nopriv` registration, and the same nonce gate is the only gate standing in front of it. The nonce confirms the caller could read the form page. It does not confirm the caller is allowed to write `wp_capabilities`, and nothing else in the handler asks that question.\n\nThe second request is the POST:\n\n```bash\ncurl -s -X POST 'https://target.example/wp-admin/admin-ajax.php' \\\n -d 'action=eel_register' \\\n -d 'nonce=abcd1234' \\\n -d 'user_login=npxadmin' \\\n -d 'user_email=npxadmin@example.com' \\\n -d 'user_pass=correct_horse_battery_staple' \\\n -d 'custom_meta[wp_capabilities][administrator]=1'\n```\n\nPHP's `application/x-www-form-urlencoded` parser turns `custom_meta[wp_capabilities][administrator]=1` into the nested structure `$_POST['custom_meta'] = ['wp_capabilities' => ['administrator' => '1']]`. `map_deep` recurses into the structure, applies `sanitize_text_field` to the leaf string `'1'`, and returns the same nested array. The handler validates the username, email, and password; calls `wp_insert_user($user_data)`, which creates the new account with `wp_capabilities = ['subscriber' => true]`; and then enters the meta loop.\n\nOn the first iteration of that loop, `$key = 'wp_capabilities'`, `$value = ['administrator' => '1']`. `update_user_meta($user_id, 'wp_capabilities', ['administrator' => '1'])` serialises the array and overwrites the row. The subscriber capabilities the `wp_insert_user` call had just written are now gone. The next time the user logs in, `WP_User::get_role_caps()` reads `wp_capabilities`, finds the key `'administrator'`, looks up the administrator role in the global role registry, and unions the role's full capability set into the user's effective permissions. The account is an administrator in every sense the rest of WordPress recognises.\n\nFrom here the path to PHP execution on the host is two clicks: `Appearance > Theme File Editor`, paste, save, request the modified file. The administrator role includes `edit_themes` and `edit_plugins` by default; the editor inside `/wp-admin/` is the WordPress documentation's own example of what an administrator is allowed to do. The grant-an-admin-via-public-form primitive converts directly to persistence, because the account itself is the persistence and the editor is the code-execution mechanism. Detection requires looking at `wp_users` for accounts the operator did not create, not at request logs for unusual paths.\n\n## sanitize_text_field is not a key filter\n\nThe line that processes `custom_meta` is doing one job correctly and one job not at all. `sanitize_text_field` is the right answer for the string values inside the structure: it removes the HTML tags, control characters, and excess whitespace that would otherwise round-trip through `update_user_meta` into the database and back out into rendered pages. A reviewer reading the line sees a sanitiser, sees the recursion helper, and concludes the input is being defended.\n\nWhat the line does not do is filter keys. The keys arrive at the loop exactly as the network supplied them. The loop has no allowlist of permitted meta keys, no denylist of reserved ones, no inspection of whether the new value would collide with a WordPress system meta. Every meta key in `wp_usermeta` is reachable: `wp_capabilities` for the role, `wp_user_level` for the legacy numeric privilege level, `session_tokens` for active auth sessions, `_application_passwords` for API credentials. The handler treats every one of them as profile data the visitor wants to set.\n\nThe author's denylist on the role helper called out `manage_options`, `promote_users`, `edit_users`, `create_users`, `delete_users`, `edit_others_posts`, `publish_posts`, `edit_published_posts`, `edit_theme_options`, `install_plugins`, `activate_plugins`, and `unfiltered_html`. Every one of those capabilities is a default administrator capability. Every one is reachable by posting `custom_meta[wp_capabilities][administrator]=1` to the same handler. The defender knew the threat. The defender enumerated the consequences. The defender sanitised the field they perceived as the role field, and looped the field that actually holds the role.\n\n## The patch does not exist\n\nThe PoC's README states \"Fixed in 1.4.6+.\" There is no 1.4.6. The current tag on the WordPress.org SVN as of 2026-05-23 is 1.4.5, and `trunk/widgets/login-register/class.login-register.php` is byte-identical to the 1.4.5 release: the same `nopriv` registration, the same nonce check, the same `easyel_get_safe_registration_role` helper, the same unguarded `foreach` over `$custom_meta`. No commit in the public SVN log addresses the registration handler. The vendor's release discipline has been active during this period; the plugin's last-updated date is 2026-05-17, six days before the PoC went public, and the registration handler was not touched. The vendor's fix, if one is in progress, has not landed in the public tree.\n\nAtomic Edge published the PoC at `xxconi/CVE-2026-9018` against a version that is currently the only version a WordPress operator can install from the canonical repository. The exposure window for any installation running 1.4.5 with `Settings → General → Anyone can register` enabled and a published page carrying the Login/Register widget started when the CVE was assigned and has not closed.\n\n## The fortress and the open back door\n\nEasy Elements is a clean instance of [sanitized the secrets, not the sink](/patterns/sanitized-the-secrets-not-the-sink), moved one tier inward from where the pattern's earlier exhibits live. ASUSTOR's `vpn.cgi` escaped two of three fields that reached `/bin/sh` and left the server-address field raw. OPNsense's `local_user_set` applied `escapeshellarg` to the free-form comment field and left the username, the operation verb, and the home path interpolated. Keras's `deserialize_keras_object` applied `safe_mode` to the input shape carrying a pickled Python lambda and left the parallel path through `importlib.import_module` unguarded. Each of those exhibits is the asymmetry visible inside a single function in a single commit: the same author chose where the defence should fire, and chose by what the field is rather than where the field goes.\n\nEasy Elements is the same shape with the dangerous interpreter swapped. The interpreter is not a shell or a deserializer; it is the WordPress runtime that reads `wp_capabilities` user-meta and computes the user's effective role on every page load. The twelve-capability denylist on the role field is proof the author understood role grant as a sensitive category. The unfiltered meta loop is proof the author sorted by the name of the field rather than by the table the field writes to. The field named `custom_meta` reaches the same storage as the field named `role`, because in WordPress, the role field IS a `wp_capabilities` user-meta key, and the runtime reads the role from there.\n\nThe companion catalogue entry is [name is the only type](/patterns/name-is-the-only-type). `custom_meta` is the JSON-shaped, server-side-untyped dict whose name implies \"user-supplied profile fields the form developer wants to capture.\" That contract is implicit in the name. The storage (`update_user_meta`) reads any key as a row in the user-meta table, and the WordPress runtime reads several specific keys (`wp_capabilities`, `wp_user_level`, `session_tokens`, `_application_passwords`) with security-relevant authority. The producer's \"custom\" naming is the only thing typing `custom_meta` as cosmetic. Nothing else does.\n\nLast week's [Divi Form Builder CVE-2026-5118](/posts/divi-form-builder-cve-2026-5118-administrator-existed) is the same vendor ecosystem and the same primitive: an unauthenticated visitor lands the administrator role on a public registration form. The mechanism is a step apart. Divi read `$_POST['role']` directly and validated it with `isset($wp_roles->roles[$role])`, an existence check that returns true for every role on the install. Easy Elements never reads `$_POST['role']` at all, and validates the role against a twelve-capability denylist. Divi believed the role-field validator was the gate. Easy Elements believed the absence of a role-field read was the gate. Both shipped a parallel write path their author had not considered. Two CVEs, two weeks, two WordPress registration plugins, one structural shape: the fortress at the front door, and the open back door in the same function.\n\nPoC: [xxconi/CVE-2026-9018](https://github.com/xxconi/CVE-2026-9018)","closing_line":"`set_role` writes to `wp_capabilities`. So does `update_user_meta`.","hook_md":"Easy Elements for Elementor 1.4.5 ships a private method called `easyel_get_safe_registration_role`. The docstring's first line reads \"The role is never read from `$_POST`.\" The method enumerates twelve dangerous capabilities, falls back to `subscriber` if any of them is present on the configured default role, and is invoked by the registration handler to populate `$user_data['role']` before `wp_insert_user`. Fifty lines below that fortress, the same handler iterates `$_POST['custom_meta']` and calls `update_user_meta($user_id, $key, $value)` against every key the network supplied. `wp_capabilities` is a user-meta key. The role the docstring promises is never read from `$_POST` is the role the loop overwrites from `$_POST`.","post_id":452,"slug":"easy-elements-cve-2026-9018-hardened-role-looped-meta","title":"CVE-2026-9018: Easy Elements Hardened the role Field. The Same Function Iterates custom_meta Into wp_capabilities.","type":"initial","unreadable_sentence":"The role the docstring promises is never read from `$_POST` is the role the loop overwrites from `$_POST`."} -----BEGIN PGP SIGNATURE----- iHUEARYIAB0WIQRf0htP5+SjynlxywneZjl4jgkQJgUCanIc+wAKCRDeZjl4jgkQ Jr6VAQCPDGOIHa4tI5sH77MEa62rm6II0jA5NrABPNm1cBDG6gD+Obq6SBMQMgG9 pkEd/XHA4F3TcHeb+V/iKmzMqYBU9AU= =227k -----END PGP SIGNATURE-----