# GHSA-22q9-hqm5-mhmc: Cross-Site Scripting in swagger-ui

- Severity: Medium (rating, scored by GitHub)
- Known to be exploited: not in CISA's catalogue, which lists only what CISA has confirmed
- Published: 2020-09-11T21:22:24.000Z
- Modified: 2021-09-28T17:01:08.000Z
- Weaknesses: CWE-79

## Description

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.


## Recommendation

Upgrade to version 2.2.1 or later.

(As written by GitHub Advisory Database.)

## Affected

- swagger-ui (npm): before 2.2.1

## References

- <https://github.com/swagger-api/swagger-ui/issues/1154> (web)
- <https://github.com/swagger-api/swagger-ui> (package)
- <https://www.npmjs.com/advisories/987> (web)

## Sources

- GitHub Advisory Database: [GHSA-22q9-hqm5-mhmc](https://github.com/advisories/GHSA-22q9-hqm5-mhmc), CC-BY-4.0, modified 2021-09-28

---

Page: https://cve.day/GHSA-22q9-hqm5-mhmc · Whole record: https://cve.day/GHSA-22q9-hqm5-mhmc.json · Rebuilt by cve.day 2026-11-25T22:56:43.536Z
