mirror of
https://github.com/projectdiscovery/nuclei-templates.git
synced 2026-01-31 15:53:33 +08:00
50 lines
1.6 KiB
YAML
50 lines
1.6 KiB
YAML
id: weak-csp-detect
|
|
|
|
info:
|
|
name: Weak Content Security Policy - Detect
|
|
author: pussycat0x
|
|
severity: info
|
|
description: |
|
|
Detected misconfigured CSP directives containing unsafe and overly permissive keywords that weakened resource loading restrictions. This configuration allowed high-risk script behaviors, resulting in reduced protection against XSS attacks.
|
|
reference:
|
|
- https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/script-src
|
|
- https://content-security-policy.com/
|
|
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[^;]*(?:https:|'unsafe-inline'|'unsafe-eval'|'unsafe-hashes'|\\*|data:|blob:)[^;]*(?:;|$)"
|
|
- "(?i)default-src[^;]*(?:https:|'unsafe-inline'|'unsafe-eval|'unsafe-hashes'|\\*|data:|blob:)[^;]*(?:;|$)"
|
|
|
|
extractors:
|
|
- type: regex
|
|
part: header
|
|
name: script-src-directive
|
|
group: 1
|
|
regex:
|
|
- '(?i)(script-src[^;]+)'
|
|
|
|
- type: regex
|
|
part: header
|
|
name: default-src-directive
|
|
group: 1
|
|
regex:
|
|
- '(?i)(default-src[^;]+)'
|
|
# digest: 4a0a00473045022100a55ffcf123e80406645f50656ac808c42cfb3ee59d99b3e6a61d9a4e84953f6302200f47cc2824d2d34cd12b7e16a229b44388c191853f80137460d8e78ac52cc78a:922c64590222798bb761d5b6d8e72950 |