Vulnerabilities in pkg:nuget/Swashbuckle.AspNetCore.SwaggerUI
PACKAGEGHSA-qrmm-w75w-3wpx is a MODERATE server side request forgery vulnerability (CWE-918: Server-Side Request Forgery (SSRF)) affecting Swagger ui libraries in the npm ecosystem. The issue involves server side request forgery in swaggerui. Remediation is available by upgrading affected packages to version 4.1.3, 6.3.0.
pkg:nuget/Swashbuckle.AspNetCore.SwaggerUI
Vulnerability advisories affecting package pkg:nuget/Swashbuckle.AspNetCore.SwaggerUI. Select an advisory below to view technical details or fixes.
| Advisory ID | CVE / NVD | Severity | Summary |
|---|---|---|---|
| GHSA-qrmm-w75w-3wpx | - | MODERATE | Server side request forgery in SwaggerUI |
GHSA-qrmm-w75w-3wpx at a Glance
How to Fix GHSA-qrmm-w75w-3wpx
To remediate this vulnerability, upgrade all affected Swagger ui dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
npm install swagger-ui@4.1.3
npm install swagger-ui-dist@4.1.3
npm install swagger-ui-react@4.1.3
Upgrade Swashbuckle.AspNetCore.SwaggerUI to 6.3.0
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
npm ls swagger-ui
How to Check if You Are Affected
To determine whether your Node.js application is affected by GHSA-qrmm-w75w-3wpx, inspect your project dependencies using npm:
npm ls swagger-ui
Analyze the terminal output to locate any version of Swagger ui in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 4.1.3), your application is affected.
Note: The npm ls swagger-ui command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-918: Server-Side Request Forgery (SSRF), where the web server receives a url or similar request from an upstream component and retrieves the contents of this url, but it does not sufficiently ensure that the request is being sent to the expected destination. In Swagger ui, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
GHSA-qrmm-w75w-3wpx Affected Swagger ui Versions
4 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
swagger-ui
|
npm |
< 4.1.3
|
4.1.3
|
|
swagger-ui-dist
|
npm |
< 4.1.3
|
4.1.3
|
|
swagger-ui-react
|
npm |
< 4.1.3
|
4.1.3
|
|
Swashbuckle.AspNetCore.SwaggerUI
|
NuGet |
< 6.3.0
|
6.3.0
|
References
Frequently Asked Questions
What is GHSA-qrmm-w75w-3wpx?
Which Swagger ui versions are affected?
What version fixes GHSA-qrmm-w75w-3wpx?
Is swagger-ui affected?
Is swagger-ui-dist affected?
What CWE is associated with GHSA-qrmm-w75w-3wpx?
How can I check npm dependencies for GHSA-qrmm-w75w-3wpx?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-qrmm-w75w-3wpx",
"modified" : "2022-05-26T20:08:34Z",
"published" : "2021-12-09T19:08:38Z",
"aliases" : [ ],
"summary" : "Server side request forgery in SwaggerUI",
"details" : "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.\n\nHowever, 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.\n\nAn example scenario abusing this functionality could take the following form:\n- `https://example.com/api-docs` hosts a version of SwaggerUI with `?url=` query parameter enabled.\n- Users will trust the domain `https://example.com` and the contents of the OpenAPI definition.\n- A malicious actor may craft a similar OpenAPI definition and service that responds to the defined APIs at `https://evildomain`.\n- 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.\n\nWe 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.\n\n### Resolution \nWe've made the decision to [disable query parameters (#4872)](https://github.com/swagger-api/swagger-ui/issues/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.\n\n### Workaround\nIf you host a version of SwaggerUI and wish to mitigate this issue immediately, you are encouraged to add the following custom plugin code:\n\n```js\nSwaggerUI({\n // ...other configuration options,\n plugins: [function UrlParamDisablePlugin() {\n return {\n statePlugins: {\n spec: {\n wrapActions: {\n // Remove the ?url parameter from loading an external OpenAPI definition.\n updateUrl: (oriAction) => (payload) => {\n const url = new URL(window.location.href)\n if (url.searchParams.has('url')) {\n url.searchParams.delete('url')\n window.location.replace(url.toString())\n }\n return oriAction(payload)\n }\n }\n }\n }\n }\n }],\n})\n```\n\n### Future UX work\n\nThrough 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.\n\n## Reflected XSS attack\n\n**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.\n",
"severity" : [ ],
"affected" : [ {
"package" : {
"ecosystem" : "npm",
"name" : "swagger-ui"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "4.1.3"
} ]
} ]
}, {
"package" : {
"ecosystem" : "npm",
"name" : "swagger-ui-dist"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "4.1.3"
} ]
} ]
}, {
"package" : {
"ecosystem" : "npm",
"name" : "swagger-ui-react"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "4.1.3"
} ]
} ]
}, {
"package" : {
"ecosystem" : "NuGet",
"name" : "Swashbuckle.AspNetCore.SwaggerUI"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "6.3.0"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/swagger-api/swagger-ui/security/advisories/GHSA-qrmm-w75w-3wpx"
}, {
"type" : "WEB",
"url" : "https://github.com/swagger-api/swagger-ui/issues/4872"
}, {
"type" : "WEB",
"url" : "https://github.com/domaindrivendev/Swashbuckle.AspNetCore/commit/401c7cb81e5efe835ceb8aae23e82057d57c7d29"
}, {
"type" : "WEB",
"url" : "https://github.com/swagger-api/swagger-ui/commit/01a3e55960f864a0acf6a8d06e5ddaf6776a7f76"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/swagger-api/swagger-ui"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-918" ],
"severity" : "MODERATE",
"github_reviewed" : true,
"github_reviewed_at" : "2021-12-09T17:49:08Z",
"nvd_published_at" : null
}
}