# CVE-2016-5682: swagger-ui cross-site scripting in property names

Source: https://junglewise.ai/threats/cve-2016-5682-swagger-ui-cross-site-scripting-in-property-names  
Publisher: Junglewise Threat Intelligence, https://junglewise.ai/threats  
Published: 2020-09-01. Updated: 2026-09-25  
License: CC BY 4.0 with a link back

CVE-2016-5682 · Severity: info · CVSS 0 · Published 2020-09-01

swagger-ui is a popular UI library for displaying API documentation. A cross-site scripting (XSS) vulnerability in versions before 2.2.1 allows attackers to inject malicious scripts through JSON schema property names. An attacker can craft a malicious JSON document and trick users into loading it via a URL parameter, causing arbitrary JavaScript to execute in their browser and potentially stealing session tokens or sensitive data.

Technologies: [swagger-ui (npm)](https://junglewise.ai/threats/technologies/swagger-ui). Vendors: [npm](https://junglewise.ai/threats/vendors/npm).

## Quick answers

**Is CVE-2016-5682 exploited in the wild?** No. Junglewise Threat Intelligence has no report of CVE-2016-5682 being exploited in the wild.

**How severe is CVE-2016-5682?** Informational severity, with a CVSS score of 0, published 1 September 2020.

**Which products and versions are affected?** swagger-ui (npm) SEMVER:introduced=0,fixed=2.2.1.

**Is there a fix for CVE-2016-5682?** 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 CVE-2016-5682 attacked?** It is attacked over the network.

**Am I affected by CVE-2016-5682?** 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

  ```sh
  npm install swagger-ui@2.2.1
  ```


## Technical details

This is a cross-site scripting (CWE-79) vulnerability in swagger-ui's rendering of JSON schema definitions. The vulnerable code fails to properly escape property names when displaying them in the UI, allowing JavaScript code embedded in property keys (e.g., "&lt;script&gt;alert(1)&lt;/script&gt;") to execute in the browser. The attack is client-side: an attacker provides a URL to a malicious JSON schema file via the url query string parameter, which swagger-ui loads and renders without sanitizing the property names. No authentication is required—any user can be tricked into accessing a swagger-ui instance with a malicious URL. The impact is full XSS in the user's browser context. The vulnerability was fixed in version 2.2.1 and later.

## Affected products

- SmartBear Software swagger-ui before 2.2.1

## Identifiers

- CVE-2016-5682
- GHSA-p239-93f7-h6xf

## Timeline

- 2016-01-13: disclosed: Issue reported on GitHub
- 2016: patched: Fixed in version 2.2.1
- 2020-09-01: advisory: Advisory GHSA-p239-93f7-h6xf published

## References

- [https://github.com/swagger-api/swagger-ui/issues/1865](https://github.com/swagger-api/swagger-ui/issues/1865)

## Related threats

- [swagger-ui cross-site scripting in key names](https://junglewise.ai/threats/cve-2016-1000229-swagger-ui-cross-site-scripting-in-key-names)
- [Swagger UI spoofing attack via URL parameter](https://junglewise.ai/threats/cve-2018-25031-swagger-ui-spoofing-attack-via-url-parameter)
- [Swagger UI phishing vector via URL parameter](https://junglewise.ai/threats/swagger-ui-phishing-vector-via-url-parameter-8eeaa776)
- [Swagger UI Cross-Site Scripting in apiInfo.description](https://junglewise.ai/threats/swagger-ui-cross-site-scripting-in-apiinfo-description-6b3f2dbe)
- [Swagger Swagger UI Cross-Site Scripting in API response rendering](https://junglewise.ai/threats/swagger-swagger-ui-cross-site-scripting-in-api-response-rendering-be1bf724)
