id: csp-script-src-wildcard

info:
  name: Content-Security-Policy "script-src" Wildcard Detected
  author: pussycat0x
  severity: info
  description: |
    Detected a wildcard (*) within the script-src directive of the Content-Security-Policy. This allowed scripts to load from any origin, weakening the CSP and increasing XSS risk.
  reference:
    - https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/script-src
  metadata:
    max-request: 1
    verified: true
  tags: csp,misconfig,headers

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

    matchers-condition: and
    matchers:

      - type: word
        part: header
        words:
          - "Content-Security-Policy"
        case-insensitive: true

      - type: regex
        part: header
        regex:
          - "(?i)script-src[^;]*\\*[^;]*(?:;|$)"
# digest: 4a0a004730450220682800352a5e08e9a1d3032dd6a39c373a99ce184d8366bd9c2f0634e41f1475022100d98932997f60b678498e3aed52ce9db6692d2360f6c2c69dd620858c327b882d:922c64590222798bb761d5b6d8e72950