Automated JavaScript bundle analysis pipeline - source map extraction, API endpoint discovery, secret detection, and client-side vulnerability hunting
From greyhatccnpx claudepluginhub overtimepog/greyhatcc --plugin greyhatccThis skill uses the workspace's default tool permissions.
Designs and optimizes AI agent action spaces, tool definitions, observation formats, error recovery, and context for higher task completion rates.
Enables AI agents to execute x402 payments with per-task budgets, spending controls, and non-custodial wallets via MCP tools. Use when agents pay for APIs, services, or other agents.
Compares coding agents like Claude Code and Aider on custom YAML-defined codebase tasks using git worktrees, measuring pass rate, cost, time, and consistency.
/greyhatcc:js <URL or domain>
{{ARGUMENTS}} is parsed automatically — just provide a target in any format:
No format specification needed from user — detect and proceed.
Before executing this skill:
.greyhatcc/scope.json — verify target is in scope, note exclusions.greyhatcc/hunt-state.json — check active phase, resume contextfindings_log.md, tested.json, gadgets.json — avoid duplicating workAlso:
JavaScript bundles are the single highest-ROI target for bug bounty hunters. They contain:
Source map disclosure alone has paid $25k+. Exposed API keys in JS pay $500-$5k routinely.
# Use Playwright to load the page and capture all JS requests
# OR extract from page source
Use Playwright MCP browser_navigate to load the target URL, then browser_network_requests to capture all loaded JS files. Filter for .js and .chunk.js URLs.
Also check:
<script> tags/_next/static/ for Next.js apps/static/js/ for React/CRA apps/assets/ for Vite/Vue appshttps://web.archive.org/cdx/search/cdx?url=<domain>/*.js&output=text&fl=original&collapse=urlkey&limit=200# Download each discovered JS file
curl -sk -o bundle_main.js "https://target.com/static/js/main.abc123.js"
Save to bug_bounty/<program>_bug_bounty/recon/js/
For every JS bundle, check:
# Check for sourceMappingURL comment at end of file
tail -5 bundle_main.js | grep sourceMappingURL
# Try common source map paths
curl -sk -o /dev/null -w "%{http_code}" "https://target.com/static/js/main.abc123.js.map"
curl -sk -o /dev/null -w "%{http_code}" "https://target.com/static/js/main.abc123.map"
Also check:
SourceMap HTTP header in the response.map extension appended to any JS URL/_next/static/chunks/*.js.map/webpack-internal://If source maps are found, they contain the original source code. Extract with:
# Parse the source map JSON to extract original files
python3 -c "
import json, os, sys
with open('bundle.js.map') as f:
sm = json.load(f)
for i, src in enumerate(sm.get('sources', [])):
content = sm.get('sourcesContent', [None]*len(sm['sources']))[i]
if content:
path = f'reconstructed/{src.lstrip(\"./\").lstrip(\"webpack:///\")}'
os.makedirs(os.path.dirname(path), exist_ok=True)
with open(path, 'w') as out:
out.write(content)
print(f'Extracted {len(sm.get(\"sources\", []))} source files')
"
This is a HIGH-severity finding if source maps are publicly accessible in production. Document immediately.
Search all JS files for:
Patterns to grep:
- /api/v[0-9]+/ → Versioned API paths
- /graphql → GraphQL endpoints
- fetch\(["'] → Fetch calls with URLs
- axios\.(get|post|put) → Axios HTTP calls
- \.ajax\( → jQuery AJAX
- XMLHttpRequest → Raw XHR
- baseURL.*["'] → Base URL configurations
- endpoint.*["'] → Endpoint definitions
- /v[0-9]+/ → API version paths
- ws://|wss:// → WebSocket endpoints
Search for:
Patterns to grep:
- ['"](AKIA|ASIA)[A-Z0-9]{16}['"] → AWS Access Keys
- sk[-_]live[-_][a-zA-Z0-9]+ → Stripe Secret Keys
- ghp_[a-zA-Z0-9]{36} → GitHub Personal Access Tokens
- glpat-[a-zA-Z0-9\-]{20} → GitLab Access Tokens
- xox[bporas]-[a-zA-Z0-9-]+ → Slack Tokens
- AIza[0-9A-Za-z\-_]{35} → Google API Keys
- sk-[a-zA-Z0-9]{48} → OpenAI API Keys
- eyJ[a-zA-Z0-9_-]*\.eyJ → JWT Tokens (base64)
- -----BEGIN (RSA |EC )?PRIVATE KEY → Private Keys
- password\s*[:=]\s*["'][^"']+["'] → Hardcoded Passwords
- api[_-]?key\s*[:=]\s*["'][^"']+ → Generic API Keys
- secret\s*[:=]\s*["'][^"']+ → Generic Secrets
- token\s*[:=]\s*["'][^"']+ → Generic Tokens
- dsn.*https://.*@.*sentry → Sentry DSNs
- phc_[a-zA-Z0-9]+ → PostHog Project Keys
Search for:
Patterns to grep:
- s3\.amazonaws\.com → S3 Bucket references
- \.blob\.core\.windows\.net → Azure Blob Storage
- storage\.googleapis\.com → GCP Storage
- \.cloudfront\.net → CloudFront distributions
- \.herokuapp\.com → Heroku apps
- \.firebaseio\.com → Firebase databases
- \.firebaseapp\.com → Firebase apps
- cognito-idp\.[a-z-]+\.amazonaws → Cognito User Pools
- launchdarkly → Feature flag services
- \.auth\.[a-z-]+\.amazoncognito → Cognito auth domains
- DEBUG|debug.*true → Debug flags
- NODE_ENV.*development → Environment leaks
- localhost:[0-9]+ → Local dev URLs left in prod
- 10\.\d+\.\d+\.\d+|172\.(1[6-9]|2[0-9]|3[01])\.\d+\.\d+|192\.168\.\d+\.\d+ → Internal IPs
Search for:
Patterns to identify:
- Redux action names (dispatch, reducer, action types) → API operation map
- Route definitions (react-router, vue-router) → Hidden admin/internal routes
- Role checks (isAdmin, hasPermission, role ===) → Authorization logic
- Payment/pricing logic (price, amount, discount, coupon) → Business logic targets
- Feature flags (featureFlag, isEnabled, flagsmith, launchdarkly) → Toggle state
- Error messages with internal details → Information disclosure patterns
bug_bounty/<program>_bug_bounty/recon/js/
├── bundles/ → Downloaded JS files
├── source_maps/ → Downloaded .map files (if found)
├── reconstructed/ → Extracted source (if maps available)
├── api_endpoints.md → All discovered API endpoints
├── secrets_found.md → Any secrets/keys detected
├── infrastructure.md → Internal URLs, S3 buckets, services
├── routes.md → Client-side routes (admin panels, etc.)
└── js_analysis_summary.md → Executive summary with findings
For each significant discovery:
/greyhatcc:findingschaining_potential (e.g., "discovered API endpoint feeds into IDOR testing")recon-specialist (sonnet) with this skill as instructionrecon-specialist-low (haiku)recon-specialist-high (opus)When delegating to agents via Task(), ALWAYS:
After completing this skill:
tested.json — record what was tested (asset + vuln class)gadgets.json — add any informational findings with provides/requires tags for chainingfindings_log.md — log any confirmed findings with severity