CVE-2021-29484: Ghost Cross-Site Scripting Vulnerability

MODERATE
Advisory Identifier: GHSA-9fgx-q25h-jxrg
CVSS 6.8
CWE-79
Published
Advisory Summary

CVE-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

CVE Identifier CVE-2021-29484
GHSA Identifier GHSA-9fgx-q25h-jxrg
Severity MODERATE
CVSS v3.1 Base Score 6.8
CWE Classification CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
Affected Product Ghost
Package Ecosystem npm
Published Date
Last Updated

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).

Attack Vector Network (AV:N)
Attack Complexity High (AC:H)
Privileges Required None (PR:N)
User Interaction Required (UI:R)
Scope Unchanged (S:U)
Confidentiality High (C:H)
Integrity High (I:H)
Availability None (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.

ghost fixed: 4.3.3
npm install ghost@4.3.3
Verify Direct and Transitive Dependencies

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

### Impact An 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. Ghost(Pro) has already been patched. We can find no evidence that the issue was exploited on Ghost(Pro) prior to the patch being added. Self-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. ### Patches Fixed in 4.3.3, all 4.x sites should upgrade as soon as possible. As the endpoint is unused, the patch simply removes it. ### Workarounds - Log out of Ghost Admin - Suspend any users who cannot log out - Block access to `/ghost/preview` Example of how to block access in nginx: ``` location ~ /ghost/preview { rewrite ^(\/(.*\/)?ghost\/)(.*)$ $1 redirect; } ``` This redirects the endpoint to `/ghost/`, which mimics the behaviour after the patch is applied. ### References - [Forum Post](https://forum.ghost.org/t/critical-security-update-available-for-ghost-4-x/22290) ### For more information If you have any questions or comments about this advisory: * email us at security@ghost.org --- Credits: Paul Gerste, SonarSource (https://www.sonarsource.com/)

CVE-2021-29484 Affected Ghost Versions

1 component(s)
Fixed Versions:
4.3.3
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?
CVE-2021-29484 is a security vulnerability in Ghost involving DOM XSS in Theme Preview under CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting').
Which Ghost versions are affected?
Affected versions include releases prior to 4.3.3 across affected packages: ghost.
What version fixes CVE-2021-29484?
Upgrading to 4.3.3 (or the latest patched release for your respective branch) resolves the vulnerability.
Is ghost affected?
Yes, ghost is affected in releases prior to 4.3.3. Upgrade your dependency to 4.3.3 or later.
What is the CVSS score of CVE-2021-29484?
CVE-2021-29484 has a CVSS v3.1 base score of 6.8 (MODERATE) with vector string CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:H/I:H/A:N.
What CWE is associated with CVE-2021-29484?
CVE-2021-29484 is classified under CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') (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.).
How can I check npm dependencies for CVE-2021-29484?
Run the dependency tree command: 'npm ls ghost'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "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"
  }
}