Vulnerabilities in pkg:npm/@fastify/swagger-ui
PACKAGECVE-2024-22207 is a MODERATE (CVSS 5.3) default swagger-ui configuration exposes all vulnerability (CWE-1188: Initialization of a Resource with an Insecure Default) affecting @fastify/swagger ui libraries in the npm ecosystem. The issue involves default swagger-ui configuration exposes all files in the module. Remediation is available by upgrading affected packages to version 2.1.0.
pkg:npm/@fastify/swagger-ui
Vulnerability advisories affecting package pkg:npm/@fastify/swagger-ui. Select an advisory below to view technical details or fixes.
| Advisory ID | CVE / NVD | Severity | Summary |
|---|---|---|---|
| GHSA-62jr-84gf-wmg4 | CVE-2024-22207 | MODERATE | Default swagger-ui configuration exposes all files in the module |
CVE-2024-22207 at a Glance
Security Impact
CVSS: 5.3
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N).
How to Fix CVE-2024-22207
To remediate this vulnerability, upgrade all affected @fastify/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 @fastify/swagger-ui@2.1.0
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
npm ls @fastify/swagger-ui
How to Check if You Are Affected
To determine whether your Node.js application is affected by CVE-2024-22207, inspect your project dependencies using npm:
npm ls @fastify/swagger-ui
Analyze the terminal output to locate any version of @fastify/swagger ui in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2.1.0), your application is affected.
Note: The npm ls @fastify/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-1188: Initialization of a Resource with an Insecure Default, where the product initializes or sets a resource with a default that is intended to be changed by the product's installer, administrator, or maintainer, but the default is not secure. In @fastify/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
CVE-2024-22207 Affected @fastify/swagger ui Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
@fastify/swagger-ui
|
npm |
≥ 2.0.0
< 2.1.0
|
2.1.0
|
References
Frequently Asked Questions
What is CVE-2024-22207?
Which @fastify/swagger ui versions are affected?
What version fixes CVE-2024-22207?
Is @fastify/swagger-ui affected?
What is the CVSS score of CVE-2024-22207?
What CWE is associated with CVE-2024-22207?
How can I check npm dependencies for CVE-2024-22207?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-62jr-84gf-wmg4",
"modified" : "2024-02-16T15:30:26Z",
"published" : "2024-01-16T15:24:41Z",
"aliases" : [ "CVE-2024-22207" ],
"summary" : "Default swagger-ui configuration exposes all files in the module",
"details" : "### Impact\n\nThe default configuration of `@fastify/swagger-ui` without `baseDir` set will lead to all files in the module's directory being exposed via http routes served by the module.\n\n### Patches\n\nUpdate to v2.1.0\n\n### Workarounds\n\nUse the `baseDir` option\n\n### References\n\n[HackerOne report\n](https://hackerone.com/reports/2312369).",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "npm",
"name" : "@fastify/swagger-ui"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "2.0.0"
}, {
"fixed" : "2.1.0"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/fastify/fastify-swagger-ui/security/advisories/GHSA-62jr-84gf-wmg4"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-22207"
}, {
"type" : "WEB",
"url" : "https://github.com/fastify/fastify-swagger-ui/commit/13d799a2c5f14d3dd5b15892e03bbcbae63ee6f7"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/fastify/fastify-swagger-ui"
}, {
"type" : "WEB",
"url" : "https://security.netapp.com/advisory/ntap-20240216-0002"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-1188" ],
"severity" : "MODERATE",
"github_reviewed" : true,
"github_reviewed_at" : "2024-01-16T15:24:41Z",
"nvd_published_at" : "2024-01-15T16:15:13Z"
}
}