# JavaScript Analysis > Collecting, de-minifying and mining a target's client-side JavaScript (live, archived and lazy-loaded chunks, plus any leaked source maps) for routes, parameters, hosts, client-side checks, crypto keys and secrets the HTML never shows. ## How it works SPAs ship routing, API calls and validation logic to the browser, so the bundle usually knows about more of the app than the UI shows. Look for: - **Endpoints and API routes** (`/api/v2/users/export`, `/internal/report`), WebSocket endpoints, old API versions. - **Hosts** missed by [[Subdomain Enumeration]], plus cloud identifiers such as S3 bucket names. - **Parameter names** the app accepts but doesn't advertise. - **Client-side checks** (`isAdmin`, `role`, `debug`). Test whether the server enforces them too. - **Comments, TODOs and feature flags** for unreleased functionality. - **Secrets and keys** (front-end keys are often public and domain-restricted, so verify before reporting). Sources: [[raw/learn.suvendudash.com/javascript-recon-for-bug-bounty-14093|Suvendu Dash: JS recon]], [[raw/bug-bounties.as93.net/recon-methodology-for-bug-bounties-finding-attack-surface-others-miss-14252|as93]], [[raw/yeswehack.com/uncover-hidden-assets-with-bug-bounty-recon-fuzzing-and-js-analysis-4867|YesWeHack]]. ## Techniques / payloads ### 1. Collect: live and historical ```bash echo https://target.example | katana -jc -d 3 -o katana.txt grep -iE '\.js(\?|$)' katana.txt | sort -u > js-live.txt echo target.example | gau | grep -iE '\.js(\?|$)' | sort -u > js-old.txt cat js-live.txt js-old.txt | sort -u | httpx -mc 200 -content-length -o js-reachable.txt ``` Large files are the app bundles worth reading; small ones are usually vendor libraries. Archived JS often references endpoints the UI dropped but the server still serves ([[raw/learn.suvendudash.com/javascript-recon-for-bug-bounty-14093|Suvendu Dash]]). Pipeline variants include `subfinder → live check → waybackurls → grep .js → nuclei` ([[raw/github.com/github-luffysec-automation-js-recon-this-tools-used-for-automating-fin-6044|LuffySec Automation-JS-Recon]]) and `subfinder → httpx → katana -list + waybackurls → grep .js` ([[raw/medium.com/from-recon-to-sensitive-key-exposure-using-nuclei-4278|Nuclei key exposure]]). ### 2. Extract endpoints ```bash python3 linkfinder.py -i https://t/static/app.js -o cli while read u; do python3 linkfinder.py -i "$u" -o cli; done < js-reachable.txt | sort -u > endpoints.txt cat endpoints.txt | httpx -mc 200,201,301,302,401,403 -o endpoints-live.txt # 401/403 = route exists ``` - **In the browser:** Renniepak's bookmarklet fetches every `<script src>` and regex-matches quoted `/paths` into a set ([[raw/yeswehack.com/uncover-hidden-assets-with-bug-bounty-recon-fuzzing-and-js-analysis-4867|YesWeHack]]). - **In Burp:** JSLinkFinder, GAP (endpoints plus interesting values) and JSpector ([[raw/yeswehack.com/uncover-hidden-assets-with-bug-bounty-recon-fuzzing-and-js-analysis-4867|YesWeHack]]). JSReconduit passively writes every JS response from Burp to disk, with optional beautify and source-map capture, lazy-chunk discovery (`JSRECONDUIT_ENABLE_CHUNK_DISCOVERY=1`; active fetch is off by default, capped by `CHUNK_FETCH_LIMIT=40`) and an in-scope-only switch. A VSCode extension then does AST analysis for routes, drift, clusters and dataflow traces ([[raw/github.com/mantissts-jsreconduit-passive-javascript-reconnaissance-for-penetratio-5545|JSReconduit]]). - **Manual grep after prettifying:** `fetch(`, `axios`, `/api`, `/admin`, `/internal`, `role`, `isAdmin`, `debug`. Also run `grep -rE '(api_key|apikey|secret|password|token|endpoint|/api/)' *.js` ([[raw/learn.suvendudash.com/javascript-recon-for-bug-bounty-14093|Suvendu Dash]], [[raw/bug-bounties.as93.net/recon-methodology-for-bug-bounties-finding-attack-surface-others-miss-14252|as93]]). - Feed the extracted paths and params back into [[Content Discovery]] wordlists and parameter fuzzing. ### 3. Source maps A `//# sourceMappingURL=app.min.js.map` trailer, or simply appending `.map` to a chunk URL, can return the original source. Extract `sourcesContent` with `jq` and the black box becomes a white box. ```bash curl -s https://t/_next/static/chunks/app/.../page-<hash>.js.map | jq -r '.sourcesContent[]' ``` Next.js is fingerprinted by `/_next/static/chunks/`. Its fix is to disable production browser source maps in `next.config.js` ([[raw/infosecwriteups.com/bypassing-the-frontend-obfuscation-how-i-uncovered-a-company-s-entire-15798|Frontend obfuscation via source maps]], [[raw/github.com/hacksmarter-casino-walkthrough-leaked-source-map-api-to-flask-ssti-15666|HackSmarter Casino]]). ### 4. Framework-aware crawling (lazy chunks, guarded routes) js-recon's `lazyload` enumerates framework chunks, and `taintwire build -d <dir> -o graph.pg` links every chunk through the webpack/Turbopack module registry into one graph. `taintwire analyze -g graph.pg -q <queries>` then runs Cypher-based taint rules across chunks. The `next_interceptRouteNextUrl` method targets Next.js intercepting routes defined under middleware-guarded paths (for example `app/admin/@modal/(..)pub/[id]`). Next serves them through the public source route when the request carries a `Next-Url` header naming the guarded path, while the middleware matcher only sees the public URL. Rules come from `_buildManifest.js` (`__rewrites.beforeFiles`), and redirecting paths are retried as `/_next/data/<buildId>/<path>.json`. It also distinguishes `nuxt-dev`/`next-dev` dev servers from production builds ([[raw/js-recon.io/js-recon-2-1-0-alpha-2-taintwire-graph-queries-and-next-js-intercept-r-14102|js-recon changelog]]). ### 5. Secrets - `nuclei -l js_files.txt -t exposures/ -o findings.txt` flagged `environment.js` with `apiKey: "sk_live_..."` ([[raw/medium.com/from-recon-to-sensitive-key-exposure-using-nuclei-4278|Nuclei key exposure]]). - SecretFinder (`python3 SecretFinder.py -i <js> -o cli`) matches patterns, not confirmed keys. Prove access with the smallest possible test, and never test against out-of-scope third parties ([[raw/learn.suvendudash.com/javascript-recon-for-bug-bounty-14093|Suvendu Dash]]). - Validation and triage are covered in [[Secret Scanning]] and [[Hardcoded Secrets]]. ### 6. Monitoring and automation - **robre/jsmon:** URLs listed in `targets/` are fetched on cron (`@daily /path/to/jsmon.sh`) and stored by md5 prefix. Any change triggers a Telegram or Slack diff notification ([[raw/github.com/robre-jsmon-a-javascript-change-monitoring-tool-for-bugbounties-5872|robre/jsmon]]). - **Jsmon (SaaS) Burp extension:** auto-sends JS from HTTP history (set scope or it burns `uploadUrl` API quota). Findings appear under JS Intelligence and Keys & Secrets, with scheduled change monitoring ([[raw/blogs.jsmon.sh/a-burpsuite-extension-for-js-reconnaissance-jsmon-5553|Jsmon Burp extension]]). - **JSFScan.sh:** `-l` gathers links (hakrawler `-js -depth 2 -scope subs`), `-e` endpoints, `-s` secrets, `-m` local copies, plus a wordlist from JS, variable names for XSS, DOM XSS scanning and an HTML report ([[raw/github.com/jsfscan-sh-javascript-recon-automation-kathanp19-4440|JSFScan.sh]]). - Rerun and diff on every release, because new bundles mean new endpoints ([[raw/learn.suvendudash.com/javascript-recon-for-bug-bounty-14093|Suvendu Dash]]). ## Notable cases - **Client-side crypto key → WAF-bypassing DOM XSS.** A login bundle rendered `t.msg` through React `dangerouslySetInnerHTML`, guarded only by a tag denylist regex (`script|form|iframe|…|svg|input|…`). `<details open ontoggle=...>` passed the regex but the WAF blocked it. The same bundle AES-encrypted parameter names and values (CryptoJS, key hard-coded as `i="sWaPV..."`, Base64→hex). Encrypting the payload client-side with that key sent an opaque hex blob past the WAF (reported as a duplicate) ([[raw/0xgh4zy.medium.com/the-waf-said-no-finding-xss-through-javascript-recon-12444|0xGh4zy]]). See [[DOM-Based XSS]] and [[XSS Filter Bypasses]]. - **Next.js `.map` → full backend blueprint.** The target sat behind Cloudflare WAF and reCAPTCHA v3. Appending `.map` to a chunk returned 81 KB of source. That exposed a headless WordPress + WPGraphQL backend (via `AcfMediaItemConnectionEdge` from `~/__generated__/graphql`), the exact `/api/submitForm` JSON schema, and the Zod env schema naming `SENDGRID_API_KEY`, `NEXT_AWS_SECRET_ACCESS_KEY` and `RECAPTCHA_SECRET_KEY`. A Mapbox token was correctly domain-restricted ([[raw/infosecwriteups.com/bypassing-the-frontend-obfuscation-how-i-uncovered-a-company-s-entire-15798|InfoSec Write-ups]]). - **Source map → hidden API → SSTI → root (lab).** `app.min.js.map` leaked `fetch('/api/v1/rooms/status?status=occupied')`, which dumped 100 room-number/last-name pairs, i.e. valid logins. A profile field rendered via `render_template_string` gave Jinja2 RCE ([[raw/github.com/hacksmarter-casino-walkthrough-leaked-source-map-api-to-flask-ssti-15666|HackSmarter Casino]]). See [[Jinja2 SSTI]]. - **Bundle-held allow-list → SSRF (High, paid).** A calendar bundle shipped the webhook destination allow-list (`chat: ["*.chat.target.com/hooks/", "chat.*/hooks/"]`); a hostname matching the wildcard but resolving to an OOB listener received the reminder POST. Source maps were 403 platform-wide and a secrets grep over 30+ bundles found nothing; the validation logic was the payload ([[raw/medium.com/six-days-one-target-thirty-six-tests-a-bug-bounty-bootcamp-from-recon-15887|six-day engagement]]). ## Defenses - Don't ship source maps to production, or restrict them to authenticated or internal origins. - No secrets or symmetric keys in the bundle. Client-side "encryption" with an embedded key is only obfuscation. - Enforce every role or feature check server-side, and don't expose admin routes or guarded paths through framework routing quirks (Next.js intercepting routes plus middleware matchers). ## Related - [[Reconnaissance]] (hub) · [[Content Discovery]] · [[Subdomain Enumeration]] · [[Asset Discovery]] · [[Google Dorking]] - [[API Discovery]] · [[Secret Scanning]] · [[Hardcoded Secrets]] · [[DOM-Based XSS]] · [[Bug Bounty Automation]] ## Sources - [[raw/learn.suvendudash.com/javascript-recon-for-bug-bounty-14093|JavaScript recon for bug bounty]] - [[raw/yeswehack.com/uncover-hidden-assets-with-bug-bounty-recon-fuzzing-and-js-analysis-4867|Uncover Hidden Assets with Bug Bounty Recon: Fuzzing and JS Analysis]] - [[raw/bug-bounties.as93.net/recon-methodology-for-bug-bounties-finding-attack-surface-others-miss-14252|Recon methodology for bug bounties (as93)]] - [[raw/github.com/robre-jsmon-a-javascript-change-monitoring-tool-for-bugbounties-5872|robre/jsmon: a javascript change monitoring tool]] - [[raw/blogs.jsmon.sh/a-burpsuite-extension-for-js-reconnaissance-jsmon-5553|A Burpsuite Extension For JS Reconnaissance - Jsmon]] - [[raw/github.com/jsfscan-sh-javascript-recon-automation-kathanp19-4440|JSFScan.sh: JavaScript recon automation]] - [[raw/github.com/mantissts-jsreconduit-passive-javascript-reconnaissance-for-penetratio-5545|MantisSTS/JSReconduit]] - [[raw/js-recon.io/js-recon-2-1-0-alpha-2-taintwire-graph-queries-and-next-js-intercept-r-14102|JS Recon 2.1.0-alpha.2 changelog]] - [[raw/github.com/github-luffysec-automation-js-recon-this-tools-used-for-automating-fin-6044|LuffySec/Automation-JS-Recon]] - [[raw/medium.com/from-recon-to-sensitive-key-exposure-using-nuclei-4278|From Recon to Sensitive Key Exposure Using Nuclei]] - [[raw/0xgh4zy.medium.com/the-waf-said-no-finding-xss-through-javascript-recon-12444|The WAF Said No: Finding XSS Through JavaScript Recon]] - [[raw/infosecwriteups.com/bypassing-the-frontend-obfuscation-how-i-uncovered-a-company-s-entire-15798|Bypassing the Frontend Obfuscation via Source Maps]] - [[raw/github.com/hacksmarter-casino-walkthrough-leaked-source-map-api-to-flask-ssti-15666|HackSmarter Casino walkthrough: leaked source-map API to Flask SSTI]] - [[raw/medium.com/six-days-one-target-thirty-six-tests-a-bug-bounty-bootcamp-from-recon-15887|Six Days One Target, Thirty-Six Tests: A Bug Bounty Bootcamp From Recon to Report]]