CVE-2021-46708: Swagger ui dist Spoofing Attack Vulnerability
MODERATECVE-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
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).
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.
npm install swagger-ui-dist@4.1.3
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
CVE-2021-46708 Affected Swagger ui dist Versions
1 component(s)| 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?
Which Swagger ui dist versions are affected?
What version fixes CVE-2021-46708?
Is swagger-ui-dist affected?
What is the CVSS score of CVE-2021-46708?
What CWE is associated with CVE-2021-46708?
How can I check npm dependencies for CVE-2021-46708?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"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"
}
}