Skip to content
RCE Write-up Advanced

Click2Shell: The RCE WordPress 7.1.1 Just Patched

A theme slug passed through a URL was sanitised by the WordPress.org Themes API but inserted raw into a jQuery selector by wp-admin JavaScript, so a crafted slug could make the page act as if the admin clicked Install on an unrelated theme. Chained with a vulnerable catalog theme whose AJAX handler lacked nonce and capability checks, this let an attacker install and execute a malicious plugin, giving remote code execution.

Chazz Wolcott Follow

Published on patchstack.com

WordPress 7.1.1 patched a vulnerability reported by pwn.ai’s Paulos Yibelo named Click2Shell, a complicated vulnerability chaining Cross-Site Request Forgery (C

Chazz Wolcott, on patchstack.com

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

The same URL parameter was sanitised on the server side but inserted unsanitised into a jQuery selector on the client side, a parser mismatch that allowed selector injection.

Impact

An attacker could achieve remote code execution, but only if an administrator loads the crafted link while logged in and the site can install themes; sites with DISALLOW_FILE_MODS enabled are not affected by the install stage.

What the attacker needed

Victim is a logged-in administrator; admin clicks a crafted link; site allows theme installation; a vulnerable catalog theme is used

The fix

WordPress 7.1.1 was fixed by scoping the selector to real .theme elements and escaping the slug with $.escapeSelector() so it is treated as literal text.

How it was found

  1. Send the administrator a crafted URL containing a malicious theme slug.
  2. The admin loads the URL while logged in, and the injected selector makes the page click Install on an unrelated theme.
  3. Use a follow-up link to open the Customizer with the newly installed theme active, running its functions.php.
  4. Pass a URL to an attacker-owned ZIP to the theme's AJAX handler, which lacks nonce and capability checks.
  5. WordPress downloads the ZIP as a plugin and executes it server-side.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

WordPress lets an administrator install themes from inside the admin panel, and the theme name travels in the web address. Two parts of the code read that name differently: the server cleans it up, but the browser-side script drops it straight into a lookup instruction, so a rigged name can make the page behave as if the admin pressed a button. The attacker then uses a separate, badly written theme to install and run their own code on the server.

What is RCE?

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.

Similar reports

View all

Same bug class and techniques, clearest first.

Remote code execution

The lesson behind this report.

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.