CVE-2021-46708: Swagger ui dist Spoofing Attack Vulnerability

MODERATE
Advisory Identifier: GHSA-6c9x-mj3g-h47x
CVSS 6.1
CWE-1021
Published
Advisory Summary

CVE-2021-46708 is a MODERATE (CVSS 6.1) spoofing attack vulnerability (CWE-1021: Improper Restriction of Rendered UI Layers or Frames) affecting Swagger ui dist libraries in the npm ecosystem. The issue involves spoofing attack in swagger-ui-dist. Remediation is available by upgrading affected packages to version 4.1.3.

CVE-2021-46708 at a Glance

CVE Identifier CVE-2021-46708
GHSA Identifier GHSA-6c9x-mj3g-h47x
Severity MODERATE
CVSS v3.1 Base Score 6.1
CWE Classification CWE-1021: Improper Restriction of Rendered UI Layers or Frames
Affected Product Swagger ui dist
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 6.1

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:C/C:L/I:L/A:N).

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

How to Fix CVE-2021-46708

To remediate this vulnerability, upgrade all affected Swagger ui dist 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-dist fixed: 4.1.3
npm install swagger-ui-dist@4.1.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 swagger-ui-dist

How to Check if You Are Affected

To determine whether your Node.js application is affected by CVE-2021-46708, inspect your project dependencies using npm:

npm ls swagger-ui-dist

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

Note: The npm ls swagger-ui-dist 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-1021: Improper Restriction of Rendered UI Layers or Frames, where the web application does not restrict or incorrectly restricts frame objects or ui layers that belong to another application or domain. In Swagger ui dist, 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

The swagger-ui-dist package before 4.1.3 for Node.js could allow a remote attacker to hijack the clicking action of the victim. By persuading a victim to visit a malicious Web site, a remote attacker could exploit this vulnerability to hijack the victim's click actions and possibly launch further attacks against the victim.

CVE-2021-46708 Affected Swagger ui dist Versions

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

References

Frequently Asked Questions

What is CVE-2021-46708?
CVE-2021-46708 is a security vulnerability in Swagger ui dist involving Spoofing attack in swagger-ui-dist under CWE-1021: Improper Restriction of Rendered UI Layers or Frames.
Which Swagger ui dist versions are affected?
Affected versions include releases prior to 4.1.3 across affected packages: swagger-ui-dist.
What version fixes CVE-2021-46708?
Upgrading to 4.1.3 (or the latest patched release for your respective branch) resolves the vulnerability.
Is swagger-ui-dist affected?
Yes, swagger-ui-dist is affected in releases prior to 4.1.3. Upgrade your dependency to 4.1.3 or later.
What is the CVSS score of CVE-2021-46708?
CVE-2021-46708 has a CVSS v3.1 base score of 6.1 (MODERATE) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N.
What CWE is associated with CVE-2021-46708?
CVE-2021-46708 is classified under CWE-1021: Improper Restriction of Rendered UI Layers or Frames (The web application does not restrict or incorrectly restricts frame objects or UI layers that belong to another application or domain.).
How can I check npm dependencies for CVE-2021-46708?
Run the dependency tree command: 'npm ls swagger-ui-dist'. 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-6c9x-mj3g-h47x",
  "modified" : "2022-03-29T19:10:02Z",
  "published" : "2022-03-12T00:00:36Z",
  "aliases" : [ "CVE-2021-46708" ],
  "summary" : "Spoofing attack in swagger-ui-dist",
  "details" : "The swagger-ui-dist package before 4.1.3 for Node.js could allow a remote attacker to hijack the clicking action of the victim. By persuading a victim to visit a malicious Web site, a remote attacker could exploit this vulnerability to hijack the victim's click actions and possibly launch further attacks against the victim.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "swagger-ui-dist"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "4.1.3"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2021-46708"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/swagger-api/swagger-ui"
  }, {
    "type" : "WEB",
    "url" : "https://security.netapp.com/advisory/ntap-20220407-0004"
  }, {
    "type" : "WEB",
    "url" : "https://security.snyk.io/vuln/SNYK-JS-SWAGGERUIDIST-2314884"
  }, {
    "type" : "WEB",
    "url" : "https://www.npmjs.com/package/swagger-ui-dist/v/4.1.3"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-1021" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2022-03-14T23:32:38Z",
    "nvd_published_at" : "2022-03-11T07:15:00Z"
  }
}