XSS with put in ghost blog
The Ghost settings API accepted a PUT request whose logo, cover_image, ghost_head and ghost_foot JSON parameters were written into every page without safe handling, so a script block could be closed and a new one injected. An attacker with an administrator or owner session could therefore run script on every page of the blog, though CORS and same-origin restrictions made real-world exploitation unlikely.
For my blog I have tried several content management systems and a while ago I decided to use Ghost for its simplicity and ease of use. Recently, I found XSS in the Ghost platform from at least version 1.24.9 and still in the latest version on GitHub.
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 settings values were inserted into the page template without output encoding or validation, allowing a value to close an existing script block and open a new one.
Impact
An attacker holding an administrator or owner session could run script on every page of the blog, but CORS and same-origin restrictions mean exploitation outside lab conditions is unlikely.
What the attacker needed
Administrator or owner session; ability to send a PUT request to the settings API
How it was found
- Authenticate to Ghost as an administrator or owner.
- Send a PUT request to the settings API endpoint with a JSON body.
- Include only the chosen vulnerable parameter with a payload that closes the script block and adds a new one.
- Load any page of the blog to see the injected script execute.
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.
Cross-site scripting (XSS) is when a site puts attacker-supplied text into a page in a way the browser treats as code, so the attacker's script runs as if the site wrote it. Here the blog's settings stored values like a logo URL and later printed them into every page without making them safe, so a crafted value could break out of an existing script tag and add a new one. The catch is that changing settings needs an admin login, so the attacker first needs that session.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.