Analysis
A stored cross-site scripting flaw in the WordPress Gutenberg editor's Shortcode error preview allowed an attacker with Contributor or higher permissions to inject JavaScript that executes in the browser of anyone viewing the post. If an administrator viewed the post, the attacker could create a new admin account and then upload a web shell to take over the server.
fortinet.com
Published on fortinet.com
WordPress is the world’s most popular Content Management System (CMS). It has 60.4% of the global CMS market share, which is far higher than the second-place Joomla!, which only has 5.2% of the market share.
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
Likely the Shortcode error preview decodes HTML entities and renders the result without applying the same sanitisation used elsewhere, allowing injected markup and script to execute.
Impact
An attacker with Contributor or higher permissions could execute arbitrary JavaScript in a victim's browser; if the victim is an administrator, the attacker could create an admin account and then a web shell to take over the server.
What the attacker needed
Contributor or higher WordPress role; Victim views the malicious post; Victim has administrator rights for full takeover
The fix
WordPress was contacted and issued a patch; users of vulnerable versions should upgrade to the latest version or apply the latest patches.
How it was found
- Add a Shortcode block to a post and insert HTML-encoded characters such as an encoded less-than sign.
- Re-open the post so the Shortcode error message appears and previews the decoded characters.
- Insert a crafted payload that breaks out of the preview and includes an image tag with an error handler.
- Publish the post; when a victim views it, the script executes in their browser.
- If the victim is an administrator, the script can create a new administrator account and then a web shell.
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 authors add small snippets called shortcodes to posts. When a shortcode is malformed, the editor shows an error preview but does not properly clean the content, so a malicious author can hide JavaScript in it. That script runs in the browser of anyone who opens the post, and if an administrator views it, the script can quietly create a new admin account for the attacker.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.