Quick answers
- Is This vulnerability exploited in the wild?
- No. Junglewise Threat Intelligence has no report of This vulnerability being exploited in the wild.
- How severe is This vulnerability?
- Informational severity, with a CVSS score of 6.1, published 11 September 2020.
- Which products and versions are affected?
- swagger-ui (npm) SEMVER:introduced=0,fixed=2.2.1.
- Is there a fix for This vulnerability?
- Yes. swagger-ui (npm): upgrade to 2.2.1 or later. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.
- How is This vulnerability attacked?
- It is attacked over the network, in a software library.
- Am I affected?
- Check whether you run swagger-ui (npm) at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.
How to fix
- swagger-ui (npm): upgrade to 2.2.1 or later
npm install swagger-ui@2.2.1
Technical details
Swagger UI versions prior to 2.2.1 are vulnerable to reflected Cross-Site Scripting (XSS). The vulnerability exists because the application fails to properly sanitize or encode output when an API endpoint returns a 'text/html' Content-Type, even if the UI expected 'application/json'. An attacker can exploit this by hosting or manipulating an API response to include malicious <script> tags, which are then executed in the context of the Swagger UI web page when a user clicks the 'Try it out!' button. This issue is resolved in version 2.2.1 by ensuring that HTML responses are properly encoded before being rendered.
Affected products
- Swagger API swagger-ui < 2.2.1
Timeline
- 2015-04-13: disclosed: Issue reported on GitHub
- 2020-09-11: advisory: GitHub Advisory published