GHSA-22q9-hqm5-mhmc: Swagger ui Cross-Site Scripting Vulnerability
MODERATEGHSA-22q9-hqm5-mhmc is a MODERATE 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 2.2.1.
GHSA-22q9-hqm5-mhmc at a Glance
How to Fix GHSA-22q9-hqm5-mhmc
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.
npm install swagger-ui@2.2.1
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-22q9-hqm5-mhmc, 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 2.2.1), 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
GHSA-22q9-hqm5-mhmc Affected Swagger ui Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
swagger-ui
|
npm |
< 2.2.1
|
2.2.1
|
References
Frequently Asked Questions
What is GHSA-22q9-hqm5-mhmc?
Which Swagger ui versions are affected?
What version fixes GHSA-22q9-hqm5-mhmc?
Is swagger-ui affected?
What CWE is associated with GHSA-22q9-hqm5-mhmc?
How can I check npm dependencies for GHSA-22q9-hqm5-mhmc?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-22q9-hqm5-mhmc",
"modified" : "2021-09-28T17:01:08Z",
"published" : "2020-09-11T21:22:24Z",
"aliases" : [ ],
"summary" : "Cross-Site Scripting in swagger-ui",
"details" : "Versions of `swagger-ui` prior to 2.2.1 are vulnerable to Cross-Site Scripting (XSS). The package fails to encode output in GET requests. The request is meant to respond with Content-Type `application/json` which does not trigger the vulnerability but if the web server changes the header to `text/html` it may allow attackers to execute arbitrary JavaScript.\n\n\n## Recommendation\n\nUpgrade to version 2.2.1 or later.",
"severity" : [ ],
"affected" : [ {
"package" : {
"ecosystem" : "npm",
"name" : "swagger-ui"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "2.2.1"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/swagger-api/swagger-ui/issues/1154"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/swagger-api/swagger-ui"
}, {
"type" : "WEB",
"url" : "https://www.npmjs.com/advisories/987"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-79" ],
"severity" : "MODERATE",
"github_reviewed" : true,
"github_reviewed_at" : "2020-08-31T18:43:08Z",
"nvd_published_at" : null
}
}