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, 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.
- 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
This is a Cross-Site Scripting (CWE-79) vulnerability in Swagger UI versions before 2.2.1. The root cause is insufficient input sanitization of JSON schema method descriptions; attackers can inject <script> tags and arbitrary JavaScript code into the description fields. The vulnerability is triggered when a victim visits a Swagger UI page that loads a malicious API schema—no authentication or user interaction beyond viewing the page is required. An attacker can execute arbitrary JavaScript in the victim's browser context, potentially stealing credentials, session tokens, or performing actions on behalf of the user. The fix is to upgrade to version 2.2.1 or later.
Affected products
- Swagger API swagger-ui prior to 2.2.1
Timeline
- 2016-01-12: disclosed
- 2020-09-11: patched: Advisory published; version 2.2.1 available as fix
- 2020-09-11: advisory