# CVE-2016-1000229: swagger-ui cross-site scripting in key names

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

CVE-2016-1000229 · Severity: low · CVSS 3.1 · Published 2022-05-24

swagger-ui is a widely used library for rendering API documentation in web applications. The vulnerability allows attackers to inject malicious scripts through JSON key names, which are displayed in the UI without proper sanitization. When a user views affected documentation, the injected script executes in their browser, potentially enabling session hijacking, credential theft, or malware distribution.

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

## Quick answers

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

**How severe is CVE-2016-1000229?** Low severity, with a CVSS score of 3.1, published 24 May 2022.

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

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

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

The vulnerability is a Cross-Site Scripting (CWE-79) flaw in swagger-ui's handling of JSON key names during web page generation. The library fails to properly neutralize or escape key names from JSON documents before rendering them in the HTML response. An attacker can craft a malicious JSON file with script tags embedded in object keys; when this file is loaded (either directly or via URL query-string parameter), the unescaped keys are rendered as HTML, causing the scripts to execute. The attack requires user interaction (visiting a link to the malicious documentation) but no authentication. Affected versions are all releases prior to 2.2.1.

## Affected products

- Swagger swagger-ui prior to 2.2.1

## Identifiers

- CVE-2016-1000229
- GHSA-h8wp-wgcq-qhrf

## Timeline

- 2019-12-20: disclosed
- 2022-05-24: patched: advisory published; fix available in version 2.2.1
- 2022-05-24: advisory

## References

- [https://access.redhat.com/errata/RHSA-2017:0868](https://access.redhat.com/errata/RHSA-2017:0868)

## Related threats

- [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)
- [Swagger UI Cross-Site Scripting in method descriptions](https://junglewise.ai/threats/swagger-ui-cross-site-scripting-in-method-descriptions-d34bf589)
