Skip to content
XSS Write-up Intermediate

Ghost CMS 4.3.2 – Cross-Origin Admin Takeover

A DOM-based cross-site scripting flaw in Ghost's theme preview page allowed any website to send a message that was inserted into the admin page without origin validation. An attacker could use this to take over an admin account by luring a logged-in admin to a malicious site.

blog.sonarsource.com

Published on blog.sonarsource.com

Ghost is one of the most popular Node.js-based Content Management Systems (CMS). According to the vendor, there are currently more than 2.5 million installs of it and the project has more than 38k stars on GitHub.

The author, on blog.sonarsource.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 theme preview page added message event data to the DOM without verifying the sender's origin.

Impact

An attacker could take over admin accounts and read or modify any data on the site; the victim must visit a malicious link while logged in, and the affected component cannot be disabled.

What the attacker needed

Victim is logged in to Ghost admin; victim visits attacker-controlled site; no authentication needed for attacker

How it was found

  1. An attacker creates a malicious website that embeds the Ghost theme preview page in an iframe.
  2. The attacker's page sends a postMessage containing a malicious script to the iframe once it loads.
  3. A logged-in admin visits the attacker's page, and the script executes in the context of the admin panel.
  4. The script creates a new admin account for the attacker.

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.

The theme preview page in Ghost's admin area listened for messages from other websites but did not check who sent them. A malicious website could send a message containing harmful code, which the admin page would run, letting the attacker act as the logged-in admin.

What is XSS?

Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.

Similar reports

View all

Same bug class and techniques, clearest first.

Cross-site scripting (XSS)

The lesson behind this report.

Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.