agentleFS
silonxxsilonxx/hackbot/skills/js-analyze/SKILL.md

js-analyze

Skill0 starsChanged 3 months agoMITView on GitHub

Deep JavaScript attack-surface analysis for web apps - crawl every script (external, inline, lazy-loaded), recover exposed source maps, and extract endpoints, parameters, APIs, secrets, dangerous sinks and tech stack into a ranked report with runnable curl commands. TRIGGER: user wants to analyse a site's JavaScript, hunt endpoints/secrets/APIs in JS bundles, find hidden routes or shadow APIs, check for exposed sourcemaps, map a SPA's client-side attack surface, or says 'js recon' / 'analyse the JS' / 'what's in this bundle'.

The file

We split this skill into the rules it gives an agent

8 rules. About 0 are common, 3 are distinctive, and 5 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈3

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 5

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Read the program policy. Note the automation rules and the exclusion list — a confirmed bug can still be out of scope, and finding that out …

    line 61
  2. Very specific:

    If the program forbids automated scanning/crawling, do not run jsx_collect.py.

    line 64
  3. Very specific:

    No maps exposed? Fall back to webcrack (see references/deobfuscation.md) to split one bundle into per-module files, which is what makes …

    line 127
  4. Very specific:

    Write REPORT.md using the structure in references/output.md.

    line 166
  5. Very specific:

    Every half-chain gets recorded as a lead with its named missing link (feedback_always-chain-vulns), not dropped.

    line 177
  6. Distinctive:

    Never run the browser harvest and a big grep pass simultaneously.

    line 183
  7. Very specific:

    Run directories on real disk, not /tmp.

    line 184
  8. Distinctive:

    Never report a path as vulnerable because it appears in a bundle.

    line 195

≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

js-analyze — JavaScript Attack-Surface Analysis

You are assisting an authorized bug bounty hunter working under a program's published policy. This skill turns a target's client-side JavaScript into a ranked, evidence-backed attack surface.

The goal, stated precisely

Not "read the JavaScript". The deliverable is six answers, each backed by a file on disk and, where it matters, a curl command that reproduces it:

LaneThe question it answers
EndpointsWhat paths exist — live, historical, and which respond with no credentials?
ParamsWhat inputs does the client send, and which names are statistically vuln-prone?
APIsWhat is the API surface: REST bases, GraphQL operations, auth model, mutating calls?
SecretsWhat credentials shipped to the browser, and is any of it actually exploitable?
SinksWhich dangerous functions exist, and can user input reach them?
TechWhat framework, libraries, versions, feature flags and client-side gates?

A finding that is not backed by a file in the run directory does not exist.

Why this is split into phases

A modern bundle is 5–40 MB of minified code. Reading it is not an option: it blows the 1 MB context rule in ~/.claude/CLAUDE.md and OOMs this 5.7 GB VM. So the pipeline shrinks before it reads. Collection and extraction happen on disk via tools; only the small, pre-filtered lane outputs are ever read into context. You should never open a file from raw/. Use jsx_ctx.py to look at a bounded window around a specific offset instead.

Run layout

Everything lands in one run directory. Keep it on real disk — never /tmp, which is a 2.9 GB tmpfs shared with Chrome on this box.

~/js-runs/<target>-<date>/
  raw/            harvested scripts, content-addressed  <- NEVER read directly
  sources/        original files recovered from source maps  <- DO read these
  state/ dom/     __NEXT_DATA__, hydration globals, rendered HTML
  inventory.jsonl one line per unique script (url, hash, bytes, seen_on)
  network.jsonl   every response the browser saw
  chunks.txt      chunk URLs incl. ones the crawl never loaded
  routes.jsonl    client-side routes from framework manifests
  tech.json       framework/library evidence with hit counts
  sourcemaps.jsonl every exposed map found
  lanes/          the six small slices — this is what you read
  probe.jsonl     anon vs authenticated results per path
  curl_commands.sh reproducible evidence
  REPORT.md       the deliverable

Phase 0 — Scope and rules (never skip)

  1. Read the program policy. Note the automation rules and the exclusion list — a confirmed bug can still be out of scope, and finding that out after building a PoC wastes the whole effort.
  2. If the program forbids automated scanning/crawling, do not run jsx_collect.py. Use the Caido path in Phase 1c instead: it sends zero extra packets.
  3. Confirm in-scope hosts. Everything below runs only against those.

Phase 1 — Collect (the part most tools get wrong)

Getting "the JavaScript" means more than downloading .js files. Run whichever of these apply; they are complementary, not alternatives.

1a. Browser harvest — the primary source.

python3 scripts/jsx_collect.py --seeds seeds.txt --out $RUN --max-pages 25

Drives real Chromium and captures every script V8 parses via Debugger.scriptParsed — external bundles, inline <script> blocks, lazily-imported chunks, runtime-injected scripts, eval'd code. A URL-fetching crawler structurally cannot see most of that. It also scrolls each page to fire lazy loading, spiders same-scope links, and snapshots __NEXT_DATA__-style payloads that live in non-executable script tags.

Useful flags: --proxy http://127.0.0.1:8080 (route through Caido so the traffic is captured too), --headed (some bot checks pass a visible browser when they block headless), --profile ~/.jsx-profiles/target (reuse a logged-in session — authenticated JS is usually where the interesting code is), --delay (be polite).

1b. Framework manifest expansion — the highest-yield step.

python3 scripts/jsx_expand.py --run $RUN --base https://target.com --fetch

Bundlers ship a manifest naming every chunk and route, including admin areas the crawl never reached. This reads Next.js _buildManifest.js, webpack runtime id→hash tables, and Vite manifests, then fetches chunks the crawl never loaded. Routes found here that are not linked anywhere are exactly the ones to probe.

1c. Caido harvest — for no-automation programs and authenticated flows.

python3 scripts/jsx_caido.py --run $RUN --host target.com

Pulls JS bodies out of the Caido project DB (read-only) from traffic you already generated by browsing manually. ROE-safe, authenticated, zero extra requests. See the caido-setup memory.

1d. Historical.

bash scripts/jsx_hist.sh $RUN target.com --fetch

Old bundles are a separate surface: endpoints removed from the UI but live on the server, params that still work, keys "rotated" by deleting the file. Also yields a free target-specific parameter wordlist.

Phase 2 — Make it readable

python3 scripts/jsx_maps.py --run $RUN

Do this before any analysis. An exposed .map turns a minified bundle back into the original TypeScript/JSX tree — comments, internal paths, dead code and all. It is both a massive analysis shortcut and often a reportable finding on its own. Checks the sourceMappingURL comment, inline data: maps, and the .map convention. Recovered files land in sources/ — those you may read normally.

No maps exposed? Fall back to webcrack (see references/deobfuscation.md) to split one bundle into per-module files, which is what makes per-module review possible at all.

Phase 3 — Extract the six lanes

bash scripts/jsx_lanes.sh $RUN

Produces small files in lanes/. This is the step that makes the work bite-sized: a 40 MB corpus becomes a few hundred lines per lane.

Phase 4 — Analyse, one lane at a time

Now read. One lane per unit of work. Each lane is small enough to review completely, which is the whole point — do not try to hold the app in your head. Delegation contracts for each lane are in references/lanes.md; use them verbatim if spawning subagents, and only when the user has asked for subagents.

Inspect any specific hit with a bounded window, never by opening the bundle:

python3 scripts/jsx_ctx.py --from-lanes $RUN/lanes/sinks_xss.txt --max 30

Phase 5 — Prove it

python3 scripts/jsx_probe.py --run $RUN --base https://target.com \
  --auth headers.txt --canary https://target.com/api/me

Probes each interesting path anonymously and (optionally) authenticated, diffs the results, and writes curl_commands.sh.

The canary is mandatory with --auth and the script enforces it. A dead session returns 401 exactly like correctly-enforced authz, and reading that as "properly protected" has produced wrong conclusions here before.

Phase 6 — Report and hand off

Write REPORT.md using the structure in references/output.md. Then route:

  • Something worth reporting → triage-finding, then write-report.
  • Secrets → confirm exploitability without exercising the credential against real data (feedback_leaked-creds-roe). Report the exposure; stop there.
  • Sinks with reachable input → hunt-xss, hunt-bxss.
  • Unauth 200s and role-shaped params → hunt-idor, hunt-rbac.
  • URL-taking params → hunt-ssrf. Auth endpoints → hunt-ato.
  • Firebase/Supabase/exposed keys → hunt-vibecoded.
  • Continuous monitoring of the JS layer → jsmon.

Every half-chain gets recorded as a lead with its named missing link (feedback_always-chain-vulns), not dropped.

Resource discipline (this VM will fall over otherwise)

  • One Chromium at a time. jsx_collect.py already caps V8 at 768 MB.
  • Never run the browser harvest and a big grep pass simultaneously.
  • Run directories on real disk, not /tmp.
  • jsluice runs file-at-a-time with -P 2; do not raise it.
  • Skip files >12 MB in lanes; handle those individually via jsx_ctx.py.
  • rg is a shell function on this box, not a binary — scripts here use GNU grep deliberately. Do not "fix" them to use ripgrep.

Honesty rules

  • Secret candidates are candidates. Most are public keys (pk_live_, Firebase web config, Sentry DSNs) that are supposed to ship. Classify before claiming (references/lanes.md §Secrets).
  • Never report a path as vulnerable because it appears in a bundle. Probe it.
  • Quote what the tool actually output (feedback_verify-claims-against-raw-output).
  • A read-back is not proof of causation — run a positive control (feedback_prove-causation-not-correlation).

References

  • references/collection.md — crawling, lazy loading, auth, anti-automation
  • references/deobfuscation.md — source maps, webcrack, module splitting
  • references/lanes.md — the six lanes in depth + subagent contracts
  • references/frameworks.md — Next/Nuxt/Vite/Angular/webpack goldmines
  • references/output.md — report structure and curl conventions

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.