Files
nuclei-templates/http/misconfiguration/missing-sri.yaml
2025-10-26 16:17:37 +00:00

48 lines
2.3 KiB
YAML

id: missing-sri
info:
name: Missing Subresource Integrity
author: lucky0x0d,PulseSecurity.co.nz,sullo amarsct
severity: info
description: |
Checks if external script and stylesheet tags in the HTML response are missing the Subresource Integrity (SRI) attribute.
reference:
- https://cheatsheetseries.owasp.org/cheatsheets/Third_Party_Javascript_Management_Cheat_Sheet.html#subresource-integrity
- https://developer.mozilla.org/en-US/docs/Web/Security/Subresource_Integrity
metadata:
max-request: 1
tags: compliance,js,css,sri,misconfig,vuln
http:
- raw:
- |
GET / HTTP/1.1
Host: {{Hostname}}
redirects: true
max-redirects: 5
matchers:
- type: xpath
part: body
xpath:
- "//script[contains(@src,'//') and not(matches(translate(@integrity,'ABCDEFGHIJKLMNOPQRSTUVWXYZ+/-=','abcdefghijklmnopqrstuvwxyz+/-='), '^sha(256|384|512)-'))]"
- "//script[contains(@src, '//') and (not(@integrity) or not(matches(translate(@integrity, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ+/-=', 'abcdefghijklmnopqrstuvwxyz+/-='), '^sha(256|384|512)-')))]"
- "//link[@rel='stylesheet' and contains(@href, '//') and (not(@integrity) or not(matches(translate(@integrity, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ+/-=', 'abcdefghijklmnopqrstuvwxyz+/-='), '^sha(256|384|512)-')))]"
extractors:
- type: xpath
attribute: src
xpath:
- "//script[contains(@src,'//') and not(matches(translate(@integrity,'ABCDEFGHIJKLMNOPQRSTUVWXYZ+/-=','abcdefghijklmnopqrstuvwxyz+/-='), '^sha(256|384|512)-'))]"
- type: xpath
attribute: src
xpath:
- "//script[contains(@src, '//') and (not(@integrity) or not(matches(translate(@integrity, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ+/-=', 'abcdefghijklmnopqrstuvwxyz+/-='), '^sha(256|384|512)-')))]"
- type: xpath
attribute: href
xpath:
- "//link[@rel='stylesheet' and contains(@href, '//') and (not(@integrity) or not(matches(translate(@integrity, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ+/-=', 'abcdefghijklmnopqrstuvwxyz+/-='), '^sha(256|384|512)-')))]"
# digest: 4b0a00483046022100f78fa99ea25519456a2c84aef0c7da1f9b40c3b637009557bf0aa5ffe2784d670221008a4f6c890bc9cb2d30b346cd11134a7bccf49a02cc06364b14de80c1819df61f:922c64590222798bb761d5b6d8e72950