GHSA-98pf-gfh3-x3mp: Readthedocs Cross-Site Scripting Vulnerability

MODERATE
CWE-79
Published
Advisory Summary

GHSA-98pf-gfh3-x3mp is a MODERATE cross-site scripting vulnerability (CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')) affecting Readthedocs libraries in the npm ecosystem. The issue involves read the docs vulnerable to cross-site scripting (xss). Remediation is available by upgrading affected packages to version 8.8.1.

GHSA-98pf-gfh3-x3mp at a Glance

CVE Identifier N/A
GHSA Identifier GHSA-98pf-gfh3-x3mp
Severity MODERATE
CVSS v3.1 Base Score N/A
CWE Classification CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
Affected Product Readthedocs
Package Ecosystem npm
Published Date
Last Updated

How to Fix GHSA-98pf-gfh3-x3mp

To remediate this vulnerability, upgrade all affected Readthedocs dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

readthedocs fixed: 8.8.1
npm install readthedocs@8.8.1
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 readthedocs

How to Check if You Are Affected

To determine whether your Node.js application is affected by GHSA-98pf-gfh3-x3mp, inspect your project dependencies using npm:

npm ls readthedocs

Analyze the terminal output to locate any version of Readthedocs in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 8.8.1), your application is affected.

Note: The npm ls readthedocs 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 Readthedocs, 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 This vulnerability allowed a malicious user to serve arbitrary HTML files from the main application domain (readthedocs[.]org/readthedocs[.]com) by exploiting a vulnerability in the code that serves downloadable content from a project. Exploiting this would have required the attacker to get a logged-in user to visit the malicious URL, which would have allowed the attacker to take control of the user's session with JavaScript (making requests to the API/site on behalf of the user). This URL would have looked something like `hxxps[:]//readthedocs[.]org/projects/attacker-project/downloads/html/version-with-javascript-attack/`. ### Patches This issue has been patched in our 8.8.1 release.

GHSA-98pf-gfh3-x3mp Affected Readthedocs Versions

1 component(s)
Fixed Versions:
8.8.1
Product / Package Ecosystem Affected Versions Fixed Version
readthedocs
npm
< 8.8.1
8.8.1

References

Frequently Asked Questions

What is GHSA-98pf-gfh3-x3mp?
GHSA-98pf-gfh3-x3mp is a security vulnerability in Readthedocs involving Read the Docs vulnerable to Cross-Site Scripting (XSS) under CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting').
Which Readthedocs versions are affected?
Affected versions include releases prior to 8.8.1 across affected packages: readthedocs.
What version fixes GHSA-98pf-gfh3-x3mp?
Upgrading to 8.8.1 (or the latest patched release for your respective branch) resolves the vulnerability.
Is readthedocs affected?
Yes, readthedocs is affected in releases prior to 8.8.1. Upgrade your dependency to 8.8.1 or later.
What CWE is associated with GHSA-98pf-gfh3-x3mp?
GHSA-98pf-gfh3-x3mp 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 GHSA-98pf-gfh3-x3mp?
Run the dependency tree command: 'npm ls readthedocs'. 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-98pf-gfh3-x3mp",
  "modified" : "2022-11-10T16:02:51Z",
  "published" : "2022-11-10T16:02:51Z",
  "aliases" : [ ],
  "summary" : "Read the Docs vulnerable to Cross-Site Scripting (XSS)",
  "details" : "### Impact\n\nThis vulnerability allowed a malicious user to serve arbitrary HTML files from the main application domain (readthedocs[.]org/readthedocs[.]com) by exploiting a vulnerability in the code that serves downloadable content from a project. \n\nExploiting this would have required the attacker to get a logged-in user to visit the malicious URL, which would have allowed the attacker to take control of the user's session with JavaScript (making requests to the API/site on behalf of the user). This URL would have looked something like `hxxps[:]//readthedocs[.]org/projects/attacker-project/downloads/html/version-with-javascript-attack/`.\n\n### Patches\n\nThis issue has been patched in our 8.8.1 release.",
  "severity" : [ ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "readthedocs"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "8.8.1"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/readthedocs/readthedocs.org/security/advisories/GHSA-98pf-gfh3-x3mp"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/readthedocs/readthedocs.org/commit/b0ae626acd13882170ec5888e35f3ef2e48e6ff6"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/readthedocs/readthedocs.org"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-79" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2022-11-10T16:02:51Z",
    "nvd_published_at" : null
  }
}