swagger-ui@2.1.2-M2 vulnerabilities

Direct Vulnerabilities

Known vulnerabilities in the swagger-ui package. This does not include vulnerabilities belonging to this package’s dependencies.

Automatically find and fix vulnerabilities affecting your projects. Snyk scans for vulnerabilities and provides fixes for free.
Fix for free
Vulnerability Vulnerable Version
  • M
Server-side Request Forgery (SSRF)

swagger-ui is a library that allows interaction and visualisation of APIs.

Affected versions of this package are vulnerable to Server-side Request Forgery (SSRF) via the ?url parameter, which was intended to allow displaying remote OpenAPI definitions. This functionality may pose a risk for users who host their own SwaggerUI instances. In particular, including remote OpenAPI definitions opens a vector for phishing attacks by abusing the trusted names/domains of self-hosted instances.

NOTE: This vulnerability has also been identified as: CVE-2021-46708

How to fix Server-side Request Forgery (SSRF)?

Upgrade swagger-ui to version 4.1.3 or higher.

<4.1.3
  • M
Server-side Request Forgery (SSRF)

swagger-ui is a library that allows interaction and visualisation of APIs.

Affected versions of this package are vulnerable to Server-side Request Forgery (SSRF) via the ?url parameter, which was intended to allow displaying remote OpenAPI definitions. This functionality may pose a risk for users who host their own SwaggerUI instances. In particular, including remote OpenAPI definitions opens a vector for phishing attacks by abusing the trusted names/domains of self-hosted instances.

NOTE: This vulnerability has also been identified as: CVE-2018-25031

How to fix Server-side Request Forgery (SSRF)?

Upgrade swagger-ui to version 4.1.3 or higher.

<4.1.3
  • M
Insecure Defaults

swagger-ui is a library that allows interaction and visualisation of APIs.

Affected versions of this package are vulnerable to Insecure Defaults. Markdown rendering allows class, style and data attributes in the result by default.

How to fix Insecure Defaults?

Upgrade swagger-ui to version 3.26.1 or higher.

<3.26.1
  • M
Relative Path Overwrite (RPO)

swagger-ui is a library that allows interaction and visualisation of APIs.

Affected versions of this package are vulnerable to Relative Path Overwrite (RPO). Attackers are able to use the Relative Path Overwrite (RPO) technique to perform CSS-based input field value exfiltration, such as exfiltration of a CSRF token value i.e. allows the embedding of untrusted JSON data from remote servers, using <style>@import within the JSON data.

How to fix Relative Path Overwrite (RPO)?

Upgrade swagger-ui to version 3.23.11 or higher.

<3.23.11
  • M
Cross-site Scripting (XSS)

swagger-ui is a library that allows interaction and visualisation of APIs.

Affected versions of this package are vulnerable to Cross-site Scripting (XSS). Multiple areas allowed reflecting of unsanitized JavaScript. This included

  • not converting values within .html() to text()
  • templates not sanitizing user inserted values
  • user input provided within content type JSON not being encoded correctly
  • injecting JavaScript through swagger documents

How to fix Cross-site Scripting (XSS)?

Upgrade swagger-ui to version 2.2.1 or higher.

<2.2.1
  • M
Cross-site Scripting (XSS)

swagger-ui is a library that allows interaction and visualisation of APIs.

Affected versions of this package are vulnerable to Cross-site Scripting (XSS) due to a lack of sanitization of URLs used for OAuth auth flow.

How to fix Cross-site Scripting (XSS)?

Upgrade swagger-ui to version 3.20.9 or higher.

<3.20.9
  • M
Reverse Tabnabbing

swagger-ui is a library that allows interaction and visualisation of APIs.

Affected versions of this package are vulnerable to Reverse Tabnabbing. Setting target="_blank" on anchor tags is unsafe unless used in conjunction with the rel="noopener" attribute. A link opened via target blank attribute can make changes to the original page, essentially bypassing same origin policy restrictions set by the browser.

How to fix Reverse Tabnabbing?

Upgrade swagger-ui to version 3.18.0 or higher.

<3.18.0
  • M
Cross-site Scripting (XSS)

swagger-ui is a library that allows interaction and visualisation of APIs.

Affected versions of this package are vulnerable to Cross-site Scripting (XSS) due to insertion of javascript: and data: URLs from user-influenced href fields in Swagger-UI.

How to fix Cross-site Scripting (XSS)?

Upgrade swagger-ui to version 3.4.2 or higher.

<3.4.2
  • M
Cross-site Scripting (XSS)

swagger-ui is a library that allows interaction and visualisation of APIs.

Affected versions of this package are vulnerable to Cross-site Scripting (XSS) due to not escaping html script tags. Swaggerui.utils.sanitize function is used instead of sanitizeHTML` which allows execution of JavaScript.

How to fix Cross-site Scripting (XSS)?

Upgrade swagger-ui to version 2.2.3 or higher.

<2.2.3
  • H
Cross-site Scripting (XSS)

swagger-ui is a library that allows interaction and visualisation of APIs.

Affected versions of this package are vulnerable to Cross-site Scripting (XSS). swagger-ui supports receiving headers (e.g. Content-Type) from the Swagger-conforming API server, to be used when demonstrating use of the API using curl. Those headers are injected into the documentation as-is (not encoded), allowing a malicious API server to inject a script (XSS) into the swagger-ui front-end.

How to fix Cross-site Scripting (XSS)?

Upgrade swagger-ui to version 2.2.1 or higher.

<2.2.1
  • C
Cross-site Scripting (XSS)

swagger-ui is a library that allows interaction and visualisation of APIs.

Affected versions of this package are vulnerable to Cross-site Scripting (XSS). A key part of this generation is the use of a JSON schema, which can be read locally or by providing a url parameter to the Swagger server (e.g. http://swagger-server/swagger-ui/index.html?url=<schema-url>).

The schema supports property fields, which are in turn included in the generated HTML without any HTML encoding, allowing an attacker to perform XSS by adding malicious scripts to their values.

How to fix Cross-site Scripting (XSS)?

Upgrade swagger-ui to version 2.2.1 or higher.

<2.2.1
  • C
Cross-site Scripting (XSS)

swagger-ui is a library that allows interaction and visualisation of APIs.

Affected versions of this package are vulnerable to Cross-site Scripting (XSS). A key part of this generation is the use of a JSON schema, which can be read locally or by providing a url parameter to the Swagger server (e.g. http://swagger-server/swagger-ui/index.html?url=<schema-url>).

The produces and consumes schema fields are written to the HTML without any HTML encoding, allowing an attacker to perform XSS by adding malicious scripts to their values.

How to fix Cross-site Scripting (XSS)?

Upgrade swagger-ui to version 2.2.1 or higher.

<2.2.1