{"id":"GHSA-22q9-hqm5-mhmc","aliases":["GHSA-22q9-hqm5-mhmc"],"related":[],"kind":"vulnerability","state":"published","title":"Cross-Site Scripting in swagger-ui","summary":"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.","summaryFormat":"markdown","summarySource":"ghsa","descriptions":[{"lang":"en","text":"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.","format":"markdown","source":"ghsa"}],"published":"2020-09-11T21:22:24.000Z","modified":"2021-09-28T17:01:08.000Z","severity":{"scorer":"GitHub","scheme":"rating","rating":"MEDIUM"},"severities":[{"scorer":"GitHub","scheme":"rating","rating":"MEDIUM"}],"cwes":["CWE-79"],"affected":[{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"2.2.1"}],"ecosystem":"npm","package":"swagger-ui","purl":"pkg:npm/swagger-ui","source":"ghsa"}],"references":[{"url":"https://github.com/swagger-api/swagger-ui/issues/1154","tags":["web"],"sources":["ghsa"]},{"url":"https://github.com/swagger-api/swagger-ui","tags":["package"],"sources":["ghsa"]},{"url":"https://www.npmjs.com/advisories/987","tags":["web"],"sources":["ghsa"]}],"credits":[],"sources":[{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-22q9-hqm5-mhmc","url":"https://github.com/advisories/GHSA-22q9-hqm5-mhmc","licence":"CC-BY-4.0","modified":"2021-09-28T17:01:08.000Z"}],"updatedAt":"2026-11-25T22:56:43.536Z"}