CVE-2024-22207: Default swagger-ui configuration exposes all files in the module
5.3
CVSS Score
3.1
Basic Information
CVE ID
GHSA ID
EPSS Score
0.93675%
CWE
Published
1/16/2024
Updated
2/16/2024
KEV Status
No
Technology
JavaScript
Technical Details
CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N
| Package Name | Ecosystem | Vulnerable Versions | First Patched Version |
|---|---|---|---|
| @fastify/swagger-ui | npm | >= 2.0.0, < 2.1.0 | 2.1.0 |
Vulnerability Intelligence
Miggo AI
Root Cause Analysis
The vulnerability stems from the unconditional registration of fastify-static and the wildcard route handler in lib/routes.js. The original code: 1) Registered fastify-static with root=opts.baseDir || __dirname/.. (module directory) 2) Created a /* route that served any file via sendFile(). When baseDir wasn't set, this combination allowed access to all files in the module directory. The patch moved both the static registration and route creation inside an if (opts.baseDir) block, making them conditional. The handler function in the wildcard route is specifically vulnerable as it directly serves files from the uncontrolled root directory when baseDir is missing.