HexBrain

Browse / CVEs / CVE-2024-22207

CVE-2024-22207· smartbear / swagger ui· CWE-1188

Fastify Swagger-UI - Information Disclosure

mediumseverity
5.3CVSS score
2.3%likelihood of exploitation, next 30 days
83%of all CVEs are less likely
Readycheck to confirm it

fastify-swagger-ui is a Fastify plugin for serving Swagger UI. Prior to 2.1.0, the 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. The vulnerability is fixed in v2.1.0. Setting the `baseDir` option can also work around this vulnerability.

Impact

Unauthenticated attackers can access sensitive files in the Fastify Swagger-UI module directory, potentially exposing source code or configuration files.

Fix

Update @fastify/swagger-ui to version 2.1.0 or later, or configure the baseDir option.

How to confirm it

Send: GET {{BaseURL}}/documentation/playwright.config.js
Positive when: contains "module.exports" and "defineConfig" AND status 200

Run it with nuclei: nuclei -id CVE-2024-22207 -u <target>. This check is not marked as verified by its authors.

The full check
id: CVE-2024-22207

info:
  name: Fastify Swagger-UI - Information Disclosure
  author: DhiyaneshDK,iamnoooob
  severity: medium
  description: |
    fastify-swagger-ui is a Fastify plugin for serving Swagger UI.  Prior to 2.1.0, the 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.  The vulnerability is fixed in v2.1.0. Setting the `baseDir` option can also work around this vulnerability.
  impact: |
    Unauthenticated attackers can access sensitive files in the Fastify Swagger-UI module directory, potentially exposing source code or configuration files.
  remediation: |
    Update @fastify/swagger-ui to version 2.1.0 or later, or configure the baseDir option.
  reference:
    - https://security.netapp.com/advisory/ntap-20240216-0002/
    - https://nvd.nist.gov/vuln/detail/CVE-2024-22207
  classification:
    cvss-metrics: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N
    cvss-score: 5.3
    cve-id: CVE-2024-22207
    cwe-id: CWE-1188
    epss-score: 0.0229
    epss-percentile: 0.83375
    cpe: cpe:2.3:a:smartbear:swagger_ui:*:*:*:*:*:node.js:*:*
  metadata:
    vendor: smartbear
    product: swagger_ui
    framework: node.js
    shodan-query:
      - http.component:"swagger"
      - http.favicon.hash:"-1180440057"
    fofa-query: icon_hash="-1180440057"
  tags: cve,cve2024,swagger-ui,exposure,vuln

http:
  - method: GET
    path:
      - "{{BaseURL}}/documentation/playwright.config.js"

    matchers-condition: and
    matchers:
      - type: word
        words:
          - "module.exports"
          - "defineConfig"
        condition: and

      - type: status
        status:
          - 200

References

Use this check only on systems you are authorised to test. Where the data comes from