CVE-2021-29484: Ghost Cross-Site Scripting Vulnerability
MODERATECVE-2021-29484 is a MODERATE (CVSS 6.8) cross-site scripting vulnerability (CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')) affecting Ghost libraries in the npm ecosystem. The issue involves dom xss in theme preview. Remediation is available by upgrading affected packages to version 4.3.3.
CVE-2021-29484 at a Glance
Security Impact
CVSS: 6.8
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:H/I:H/A:N).
How to Fix CVE-2021-29484
To remediate this vulnerability, upgrade all affected Ghost dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
npm install ghost@4.3.3
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
npm ls ghost
How to Check if You Are Affected
To determine whether your Node.js application is affected by CVE-2021-29484, inspect your project dependencies using npm:
npm ls ghost
Analyze the terminal output to locate any version of Ghost in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 4.3.3), your application is affected.
Note: The npm ls ghost command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting'), where the product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. In Ghost, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2021-29484 Affected Ghost Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
ghost
|
npm |
≥ 4.0.0
< 4.3.3
|
4.3.3
|
References
Frequently Asked Questions
What is CVE-2021-29484?
Which Ghost versions are affected?
What version fixes CVE-2021-29484?
Is ghost affected?
What is the CVSS score of CVE-2021-29484?
What CWE is associated with CVE-2021-29484?
How can I check npm dependencies for CVE-2021-29484?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-9fgx-q25h-jxrg",
"modified" : "2022-11-21T19:46:10Z",
"published" : "2021-04-29T21:53:18Z",
"aliases" : [ "CVE-2021-29484" ],
"summary" : "DOM XSS in Theme Preview",
"details" : "### Impact\nAn unused endpoint added during the development of 4.0.0 has left sites vulnerable to untrusted users gaining access to Ghost Admin. Attackers can gain access by getting logged in users to click a link containing malicious code. Users do not need to enter credentials and may not know they've visited a malicious site. \n\nGhost(Pro) has already been patched. We can find no evidence that the issue was exploited on Ghost(Pro) prior to the patch being added. \n\nSelf-hosters are impacted if running Ghost a version between 4.0.0 and 4.3.2. Immediate action should be taken to secure your site - see patches & workarounds below.\n\n### Patches\nFixed in 4.3.3, all 4.x sites should upgrade as soon as possible.\nAs the endpoint is unused, the patch simply removes it. \n\n### Workarounds\n- Log out of Ghost Admin\n- Suspend any users who cannot log out\n- Block access to `/ghost/preview`\n\nExample of how to block access in nginx:\n\n```\nlocation ~ /ghost/preview {\n rewrite ^(\\/(.*\\/)?ghost\\/)(.*)$ $1 redirect;\n}\n```\n\nThis redirects the endpoint to `/ghost/`, which mimics the behaviour after the patch is applied.\n\n### References\n\n- [Forum Post](https://forum.ghost.org/t/critical-security-update-available-for-ghost-4-x/22290)\n\n### For more information\nIf you have any questions or comments about this advisory:\n* email us at security@ghost.org\n\n\n---\nCredits: Paul Gerste, SonarSource (https://www.sonarsource.com/)",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:H/I:H/A:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "npm",
"name" : "ghost"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "4.0.0"
}, {
"fixed" : "4.3.3"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/TryGhost/Ghost/security/advisories/GHSA-9fgx-q25h-jxrg"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2021-29484"
}, {
"type" : "WEB",
"url" : "https://github.com/TryGhost/Ghost/commit/14b3431de12e674a0bd562e9230e2891b6903ae2"
}, {
"type" : "WEB",
"url" : "https://blog.sonarsource.com/ghost-admin-takeover"
}, {
"type" : "WEB",
"url" : "https://forum.ghost.org/t/critical-security-update-available-for-ghost-4-x/22290"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/TryGhost/Ghost"
}, {
"type" : "WEB",
"url" : "https://security.netapp.com/advisory/ntap-20210618-0006"
}, {
"type" : "WEB",
"url" : "https://www.npmjs.com/package/ghost"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-79" ],
"severity" : "MODERATE",
"github_reviewed" : true,
"github_reviewed_at" : "2021-04-29T20:40:06Z",
"nvd_published_at" : "2021-04-29T21:15:00Z"
}
}