performing-content-security-policy-bypass

Analyze and bypass Content Security Policy configurations to confirm XSS exploitability during authorized assessments.

954|172|Updated Mar 13, 2026
One-click install
npx skills add https://github.com/xalgord/xalgorix --skill performing-content-security-policy-bypass
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: performing-content-security-policy-bypass
Source: https://github.com/xalgord/xalgorix/tree/main/internal/tools/skills/data/web-application-security/performing-content-security-policy-bypass
Command: npx skills add https://github.com/xalgord/xalgorix --skill performing-content-security-policy-bypass

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

When a cross-site scripting vulnerability is found but the browser blocks execution due to a Content Security Policy, testers need a systematic way to determine whether the policy is actually effective or can be bypassed through misconfigurations, JSONP endpoints, or directive weaknesses.

Core Features & Use Cases

  • CSP Policy Analysis: Extract and evaluate CSP headers and meta tags, detect report-only mode, and identify weak directives such as unsafe-inline, unsafe-eval, and missing base-uri or object-src.
  • Bypass Technique Library: Step-by-step workflows covering JSONP callback abuse on whitelisted domains, AngularJS sandbox escapes, nonce leakage via CSS selectors, base-uri hijacking, and policy injection.
  • False-Positive Avoidance: Confirmation criteria requiring actual script execution in a browser before reporting a bypass, distinguishing enforced policies from report-only ones.
  • Use Case: During a bug bounty engagement, XSS is blocked by a script-src whitelist. The workflow guides testing whitelisted CDN domains for JSONP endpoints and AngularJS gadgets to achieve confirmed execution.

Quick Start

Analyze the Content Security Policy header of the target application and test it for bypass techniques such as JSONP endpoints, unsafe directives, and missing base-uri restrictions.

Frequently Asked Questions about performing-content-security-policy-bypass

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I bypass a Content Security Policy to execute XSS?

First analyze the policy for weak directives like unsafe-inline or unsafe-eval, then check whitelisted domains for JSONP endpoints or AngularJS libraries that allow callback or template injection. Confirm the bypass only when a script actually executes in the browser under the enforced policy.

How to check if a CSP header is actually enforced?

Inspect response headers for Content-Security-Policy versus Content-Security-Policy-Report-Only. Report-only mode logs violations without blocking, so plain XSS works directly and should not be reported as a CSP bypass.

What tools are used for CSP bypass testing?

The workflow uses Burp Suite for intercepting responses and analyzing headers, Google CSP Evaluator for automated policy analysis, and browser developer tools for monitoring CSP violation reports during testing.

Can CSP be bypassed when script-src uses nonces?

Yes, through nonce leakage via CSS attribute selector brute-forcing, nonce reuse across pages, or DOM clobbering. Note that unsafe-inline is ignored when a nonce or strict-dynamic is present, so focus shifts to leaking the nonce value.

Why does unsafe-inline not work when a nonce is present?

Under CSP3, browsers ignore unsafe-inline whenever a nonce or hash source is present in script-src. Inline injection attempts will be blocked, so testing must pivot to nonce leakage, script gadgets, or whitelisted-domain abuse.

What are the limitations of CSP bypass testing?

A weak-looking policy is only a lead, not a finding; a bypass is confirmed only when execution or exfiltration occurs under the enforced policy. Well-formed nonce-based policies with strict-dynamic and no whitelisted CDNs may leave no viable bypass path.