Every CVE Search/ Get API key

CVE-2021-46708

Spoofing attack in swagger-ui-dist

6.1 MediumFix available

The swagger-ui-dist package before 4.1.3 for Node.js could allow a remote attacker to hijack the clicking action of the victim. By persuading a victim to visit a malicious Web site, a remote attacker could exploit this vulnerability to hijack the victim's click actions and possibly launch further attacks against the victim.

Attack profile

How easy it is to exploit

Attack vector
Network
Complexity
Low
Privileges needed
None
User interaction
Required

What an attacker can affect

Confidentiality
Low
Integrity
Low
Availability
None

Exploit likelihood

1.49%Up 0.4 points since Mar 11, 2022
90%50%10%1%

What each source reports

NVD Score used 6.1

The swagger-ui-dist package before 4.1.3 for Node.js could allow a remote attacker to hijack the clicking action of the victim. By persuading a victim to visit a malicious Web site, a remote attacker could exploit this vulnerability to hijack the victim's click actions and possibly launch further attacks against the victim.

Record
CVE-2021-46708
CVSS 3.1
6.1 MediumCVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N
CVSS 2.0
4.3 MediumAV:N/AC:M/Au:N/C:N/I:P/A:N
Weakness
CWE-1021
Updated
2026-11-02
CVE List No score

The swagger-ui-dist package before 4.1.3 for Node.js could allow a remote attacker to hijack the clicking action of the victim. By persuading a victim to visit a malicious Web site, a remote attacker could exploit this vulnerability to hijack the victim's click actions and possibly launch further attacks against the victim.

Record
CVE-2021-46708
Updated
2026-11-02
EUVDEUVD-2022-1341 No score

The swagger-ui-dist package before 4.1.3 for Node.js could allow a remote attacker to hijack the clicking action of the victim. By persuading a victim to visit a malicious Web site, a remote attacker could exploit this vulnerability to hijack the victim's click actions and possibly launch further attacks against the victim.

Record
EUVD-2022-1341
Updated
2026-11-03
GitHub AdvisoriesGHSA-6c9x-mj3g-h47x 6.1

Spoofing attack in swagger-ui-dist

The swagger-ui-dist package before 4.1.3 for Node.js could allow a remote attacker to hijack the clicking action of the victim. By persuading a victim to visit a malicious Web site, a remote attacker could exploit this vulnerability to hijack the victim's click actions and possibly launch further attacks against the victim.

Record
GHSA-6c9x-mj3g-h47x
CVSS 3.1
6.1 MediumCVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N
Weakness
CWE-1021
Updated
2026-11-02
GitHub AdvisoriesGHSA-qrmm-w75w-3wpx No score

Server side request forgery in SwaggerUI

SwaggerUI supports displaying remote OpenAPI definitions through the ?url parameter. This enables robust demonstration capabilities on sites like petstore.swagger.io, editor.swagger.io, and similar sites, where users often want to see what their OpenAPI definitions would look like rendered.

However, 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.

An example scenario abusing this functionality could take the following form:

  • https://example.com/api-docs hosts a version of SwaggerUI with ?url= query parameter enabled.
  • Users will trust the domain https://example.com and the contents of the OpenAPI definition.
  • A malicious actor may craft a similar OpenAPI definition and service that responds to the defined APIs at https://evildomain.
  • Users mistakenly click a phishing URL like https://example.com/api-docs?url=https://evildomain/fakeapi.yaml and enters sensitive data via the "Try-it-out" feature.

We do want to stress that this attack vector is limited to scenarios that actively trick users into divulging sensitive information. The ease of this is highly contextual and, therefore, the threat model may be different for individual users and organizations. It is not possible to perform non-interactive attacks (e.g., cross-site scripting or code injection) through this mechanism.

Resolution

We've made the decision to disable query parameters (#4872) by default starting with SwaggerUI version 4.1.3. Please update to this version when it becomes available (ETA: 2021 December). Users will still be able to be re-enable the options at their discretion. We'll continue to enable query parameters on the Swagger demo sites.

Workaround

If you host a version of SwaggerUI and wish to mitigate this issue immediately, you are encouraged to add the following custom plugin code:

SwaggerUI({
  //  ...other configuration options,
  plugins: [function UrlParamDisablePlugin() {
    return {
      statePlugins: {
        spec: {
          wrapActions: {
            // Remove the ?url parameter from loading an external OpenAPI definition.
            updateUrl: (oriAction) => (payload) => {
              const url = new URL(window.location.href)
              if (url.searchParams.has('url')) {
                url.searchParams.delete('url')
                window.location.replace(url.toString())
              }
              return oriAction(payload)
            }
          }
        }
      }
    }
  }],
})

Future UX work

Through the exploration of this issue, it became apparent that users may not be aware to which web server the Try-it-out function will send requests. While this information is currently presented at the top of the page, understanding may improve by displaying it closer to the "Execute" button where requests are actually made. We'll be exploring these UX improvements over the coming months and welcome community input. Please create a Feature Request under the GitHub Issue tab to start a conversation with us and the community.

Reflected XSS attack

Warning in versions < 3.38.0, it is possible to combine the URL options (as mentioned above) with a vulnerability in DOMPurify (https://www.cvedetails.com/cve/CVE-2020-26870/) to create a reflected XSS vector. If your version of Swagger UI is older than 3.38.0, we suggest you upgrade or implement the workaround as mentioned above.

Record
GHSA-qrmm-w75w-3wpx
Weakness
CWE-918
Updated
2026-11-02
OSVGHSA-6c9x-mj3g-h47x 6.1

Spoofing attack in swagger-ui-dist

The swagger-ui-dist package before 4.1.3 for Node.js could allow a remote attacker to hijack the clicking action of the victim. By persuading a victim to visit a malicious Web site, a remote attacker could exploit this vulnerability to hijack the victim's click actions and possibly launch further attacks against the victim.

Record
GHSA-6c9x-mj3g-h47x
CVSS 3.1
6.1 MediumCVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N
Weakness
CWE-1021
Updated
2026-11-02
OSVCLSA-2026-1785468079 No score

TuxCare security update for swagger-ui (3 CVEs)

TuxCare rebuilt swagger-ui to address 3 CVEs. Fixed in 2.2.10-tuxcare.1.

Record
CLSA-2026-1785468079
Updated
2026-11-02
OSVCLSA-2026-1786375655 No score

TuxCare security update for swagger-ui-dist (2 CVEs)

TuxCare rebuilt swagger-ui-dist to address 2 CVEs. Fixed in 3.52.5-tuxcare.1.

Record
CLSA-2026-1786375655
Updated
2026-11-02
OSVGHSA-qrmm-w75w-3wpx No score

Server side request forgery in SwaggerUI

SwaggerUI supports displaying remote OpenAPI definitions through the ?url parameter. This enables robust demonstration capabilities on sites like petstore.swagger.io, editor.swagger.io, and similar sites, where users often want to see what their OpenAPI definitions would look like rendered.

However, 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.

An example scenario abusing this functionality could take the following form:

  • https://example.com/api-docs hosts a version of SwaggerUI with ?url= query parameter enabled.
  • Users will trust the domain https://example.com and the contents of the OpenAPI definition.
  • A malicious actor may craft a similar OpenAPI definition and service that responds to the defined APIs at https://evildomain.
  • Users mistakenly click a phishing URL like https://example.com/api-docs?url=https://evildomain/fakeapi.yaml and enters sensitive data via the "Try-it-out" feature.

We do want to stress that this attack vector is limited to scenarios that actively trick users into divulging sensitive information. The ease of this is highly contextual and, therefore, the threat model may be different for individual users and organizations. It is not possible to perform non-interactive attacks (e.g., cross-site scripting or code injection) through this mechanism.

Resolution

We've made the decision to disable query parameters (#4872) by default starting with SwaggerUI version 4.1.3. Please update to this version when it becomes available (ETA: 2021 December). Users will still be able to be re-enable the options at their discretion. We'll continue to enable query parameters on the Swagger demo sites.

Workaround

If you host a version of SwaggerUI and wish to mitigate this issue immediately, you are encouraged to add the following custom plugin code:

SwaggerUI({
  //  ...other configuration options,
  plugins: [function UrlParamDisablePlugin() {
    return {
      statePlugins: {
        spec: {
          wrapActions: {
            // Remove the ?url parameter from loading an external OpenAPI definition.
            updateUrl: (oriAction) => (payload) => {
              const url = new URL(window.location.href)
              if (url.searchParams.has('url')) {
                url.searchParams.delete('url')
                window.location.replace(url.toString())
              }
              return oriAction(payload)
            }
          }
        }
      }
    }
  }],
})

Future UX work

Through the exploration of this issue, it became apparent that users may not be aware to which web server the Try-it-out function will send requests. While this information is currently presented at the top of the page, understanding may improve by displaying it closer to the "Execute" button where requests are actually made. We'll be exploring these UX improvements over the coming months and welcome community input. Please create a Feature Request under the GitHub Issue tab to start a conversation with us and the community.

Reflected XSS attack

Warning in versions < 3.38.0, it is possible to combine the URL options (as mentioned above) with a vulnerability in DOMPurify (https://www.cvedetails.com/cve/CVE-2020-26870/) to create a reflected XSS vector. If your version of Swagger UI is older than 3.38.0, we suggest you upgrade or implement the workaround as mentioned above.

Record
GHSA-qrmm-w75w-3wpx
Weakness
CWE-918
Updated
2026-11-02

Affected products

Affected packages

Affected packages
PackageAffectedFixed
swagger-ui-dist
npm
before 4.1.3
4.1.3
swagger-ui
npm
before 4.1.3
4.1.3
swagger-ui-react
npm
before 4.1.3
4.1.3
Swashbuckle.AspNetCore.SwaggerUI
NuGet
before 6.3.0
6.3.0
swagger-ui
TuxCare:npm
2.2.10-tuxcare.0 up to 2.2.10-tuxcare.1, plus listed versions
2.2.10
2.2.10-tuxcare.1
swagger-ui-dist
TuxCare:npm
3.52.5-tuxcare.0 up to 3.52.5-tuxcare.1, plus listed versions
3.52.5
3.52.5-tuxcare.1
Swashbuckle.AspNetCore.SwaggerUI
NuGet
before 6.3.0, plus listed versions
1.0.01.0.0--rc11.0.0-rc11.0.0-rc21.0.0-rc3
Show 45 moreShow less
1.1.01.2.02.0.02.1.02.1.12.2.02.3.02.4.02.5.03.0.04.0.04.0.15.0.05.0.0-beta5.0.0-rc15.0.0-rc25.0.0-rc35.0.0-rc45.0.0-rc55.1.05.2.05.2.15.3.05.3.15.3.25.3.35.4.05.4.15.5.05.5.15.6.05.6.15.6.25.6.36.0.06.0.16.0.26.0.36.0.46.0.56.0.66.0.76.1.06.1.16.1.2
6.3.0

History

History
RecordedChangedSources
aliasesEUVD
first indexedCVE List, GitHub Advisories, NVD, OSV

Dates are when Every CVE recorded each change. Upstream dates may differ.

In short

CVE-2021-46708 is a medium vulnerability (CVSS 6.1) in Smartbear Swagger-ui-dist, published December 9, 2021. No source lists public exploit code. EPSS puts the chance of exploitation in the next 30 days at 1.49%, the 74th percentile. Fixed in swagger-ui-dist 4.1.3.

References

Show 5 moreShow less
This page doesn't list everything

Left out here: 7 versions. The JSON record has them.

MoveEnter Open