GHSA-388g-jwpg-x6j4: Swagger ui Cross-Site Scripting Vulnerability

MODERATE
CVSS 6.5
CWE-79
Published
Advisory Summary

GHSA-388g-jwpg-x6j4 is a MODERATE (CVSS 6.5) cross-site scripting vulnerability (CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')) affecting Swagger ui libraries in the npm ecosystem. The issue involves cross-site scripting in swagger-ui. Remediation is available by upgrading affected packages to version 3.0.13.

GHSA-388g-jwpg-x6j4 at a Glance

CVE Identifier N/A
GHSA Identifier GHSA-388g-jwpg-x6j4
Severity MODERATE
CVSS v3.1 Base Score 6.5
CWE Classification CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
Affected Product Swagger ui
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 6.5

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:N/A:N).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction Required (UI:R)
Scope Unchanged (S:U)
Confidentiality High (C:H)
Integrity None (I:N)
Availability None (A:N)

How to Fix GHSA-388g-jwpg-x6j4

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

swagger-ui fixed: 3.0.13
npm install swagger-ui@3.0.13
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 swagger-ui

How to Check if You Are Affected

To determine whether your Node.js application is affected by GHSA-388g-jwpg-x6j4, inspect your project dependencies using npm:

npm ls swagger-ui

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

Note: The npm ls swagger-ui 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 Swagger ui, 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

Versions of `swagger-ui` prior to 3.0.13 are vulnerable to Cross-Site Scripting (XSS). The package fails to sanitize YAML files imported from URLs or copied-pasted. This may allow attackers to execute arbitrary JavaScript. ## Recommendation Upgrade to version 3.0.13 or later.

GHSA-388g-jwpg-x6j4 Affected Swagger ui Versions

1 component(s)
Fixed Versions:
3.0.13
Product / Package Ecosystem Affected Versions Fixed Version
swagger-ui
npm
< 3.0.13
3.0.13

References

Frequently Asked Questions

What is GHSA-388g-jwpg-x6j4?
GHSA-388g-jwpg-x6j4 is a security vulnerability in Swagger ui involving Cross-Site Scripting in swagger-ui under CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting').
Which Swagger ui versions are affected?
Affected versions include releases prior to 3.0.13 across affected packages: swagger-ui.
What version fixes GHSA-388g-jwpg-x6j4?
Upgrading to 3.0.13 (or the latest patched release for your respective branch) resolves the vulnerability.
Is swagger-ui affected?
Yes, swagger-ui is affected in releases prior to 3.0.13. Upgrade your dependency to 3.0.13 or later.
What is the CVSS score of GHSA-388g-jwpg-x6j4?
GHSA-388g-jwpg-x6j4 has a CVSS v3.1 base score of 6.5 (MODERATE) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:N/A:N.
What CWE is associated with GHSA-388g-jwpg-x6j4?
GHSA-388g-jwpg-x6j4 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-388g-jwpg-x6j4?
Run the dependency tree command: 'npm ls swagger-ui'. 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-388g-jwpg-x6j4",
  "modified" : "2021-09-28T17:00:22Z",
  "published" : "2020-09-11T21:20:14Z",
  "aliases" : [ ],
  "summary" : "Cross-Site Scripting in swagger-ui",
  "details" : "Versions of `swagger-ui` prior to 3.0.13 are vulnerable to Cross-Site Scripting (XSS). The package fails to sanitize YAML files imported from URLs or copied-pasted. This may allow attackers to execute arbitrary JavaScript.\n\n\n## Recommendation\n\nUpgrade to version 3.0.13 or later.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:N/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "swagger-ui"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "3.0.13"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/swagger-api/swagger-ui/issues/3163"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/swagger-api/swagger-ui"
  }, {
    "type" : "WEB",
    "url" : "https://snyk.io/vuln/SNYK-JS-SWAGGERUI-449941"
  }, {
    "type" : "WEB",
    "url" : "https://www.npmjs.com/advisories/985"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-79" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2020-08-31T18:43:03Z",
    "nvd_published_at" : null
  }
}