Skip to content
PHASE 09/16OP CIPHER

JavaScript analysis

Noise
Light active
Reads
urls/clean.txthttp/live.txt
Writes
js/live.txtjs/files/js/endpoints.txtjs/secrets.jsonl

Scope checkActive phase. Check the program policy first. Send traffic only to in-scope assets, at the rate the program allows.

5 min readRecon Atlas

Modern front ends ship the whole API map to the browser. A React or Angular bundle contains every route the app can call, including routes for features your account cannot see: admin actions, beta features, internal tools. It may also contain hostnames for staging APIs and, now and then, keys that should never have left the server.

Downloading JS files is a handful of normal GET requests. The analysis itself runs on your machine.

Tool Noise Role Status
jsluice Passive Parses JS syntax trees to extract URLs, paths and secrets. Runs on local files Maintained
LinkFinder Light active Regex endpoint extraction from a JS URL or file Old, still useful
xnLinkFinder Light active Endpoints and parameter names from URLs, files or Burp exports Maintained
SecretFinder Light active Regex-based key and token finder for JS Old, many false positives
getJS, subjs Light active Collect every JS URL a page references Maintained
sourcemapper Passive Rebuilds the original source tree from a .map file Works
GAP Passive Burp and Caido extension that pulls endpoints and params from proxied traffic Maintained

vendor.js, chunk-vendors.js, and react-dom.js are the libraries, not the app. They are full of paths that do not exist on this server. Prefer app.*.js, main.*.js, routes.*.js, and the numbered chunks the app actually loads, such as 124.js or settings-tab.js. Leave Google Tag Manager, Sentry, Intercom, and files from cdn.jsdelivr.net or cdnjs.cloudflare.com out of the endpoint extract.

/api/v2/users/export

jsluice pulled that string out of js/files/4f2a9e10bc8351da.js. The client builds or calls /api/v2/users/export. It does not mean the server mounts that path, or that an anonymous caller can use it. Request it. A JSON 401, 403, or 405 means a handler is listening. A 200 whose body is the same HTML shell as a nonsense path means the browser router owns it. A 404 on GET, POST, and OPTIONS means it is not mounted here. Save the dead path in your notes and keep it out of the scanner list.

pk_live_51HzN48ExampleKeyString99

js/secrets.jsonl matched a Stripe publishable key. Stripe expects that prefix in the browser. The server secret prefix is sk_live_. A pk_live_ match is not a leak by itself. The same goes for a Google Maps browser key, a Firebase config, and a Sentry DSN.

api-staging.example.com

The hostname is hardcoded in a config object in the bundle. It does not mean public DNS resolves it, or that you can reach it from the internet. Put it through phase 4 before you treat it as a live host. If it does not resolve, keep the name for virtual host tests.

A bundle ends in //# sourceMappingURL=app.js.map. The bundler emitted the comment. The deploy often deletes the .map file before it publishes. Request the map URL. Only a 200 is the original source tree.

/admin/users/view returns 200 and the same index.html as /, often with <div id="root"></div>. That path is a client route. Drop it from the API list.

Regex tools split a concatenated path into /api/v1/ and /export. jsluice keeps the path the code actually builds. Use jsluice on the files you downloaded. Use LinkFinder when you only want a quick look at one URL.

  1. Collect JavaScript URLs from the URL list and from a fresh crawl.

    Terminal window
    # Pull .js URLs out of the cleaned URL list
    grep -Ei '\.js(\?|$)' urls/clean.txt | sort -u > js/urls.txt

    The cleaned URL list only holds JS that archives or the crawler already saw. getJS and subjs fetch each live page and read its <script> tags, which catches bundles added since the last crawl.

    Terminal window
    # Collect script URLs from every live host, merge with what you have
    cat http/live.txt | getJS --complete 2>/dev/null | anew js/urls.txt
    cat http/live.txt | subjs | anew js/urls.txt
    Terminal window
    # Keep only JS files that still return 200
    httpx -l js/urls.txt -mc 200 -rl 30 -silent > js/live.txt
  2. Download them once. Analyzing local copies is faster, repeatable, and lets you grep later. The file name is a hash of the URL, and js/index.tsv maps it back.

    Terminal window
    # Download each JS file to js/files/ and record which URL it came from
    while read -r u; do
    h=$(printf '%s' "$u" | sha1sum | cut -c1-16)
    curl -sk --max-time 20 "$u" -o "js/files/$h.js" && printf '%s\t%s\n' "$h" "$u" >> js/index.tsv
    sleep 0.1
    done < js/live.txt
  3. Extract endpoints with jsluice. It understands JavaScript syntax, so it finds paths built by string concatenation and fetch() calls that regex tools miss.

    Terminal window
    # Extract URLs and paths from every downloaded file
    jsluice urls js/files/*.js | jq -r '.url' | sort -u > js/endpoints.txt

    For a quick look at one remote file, LinkFinder still does the job:

    Terminal window
    # Print endpoints found in one JS file
    python3 linkfinder.py -i https://app.example.com/static/main.js -o cli
  4. Collect parameter names with xnLinkFinder. It writes endpoints and a separate list of parameter names, which phase 10 uses as a custom wordlist.

    Terminal window
    # Links and parameter names from all live JS URLs, scoped to the target
    xnLinkFinder -i js/live.txt -sf example.com -o js/xnl-links.txt -op js/xnl-params.txt
  5. Hunt for secrets.

    Terminal window
    # jsluice's secret patterns across every file
    jsluice secrets js/files/*.js > js/secrets.jsonl
    Terminal window
    # SecretFinder on one file; expect false positives
    python3 SecretFinder.py -i https://app.example.com/static/main.js -o cli
    Terminal window
    # Simple grep for common key shapes and internal hosts
    grep -EHo "(AKIA[0-9A-Z]{16}|AIza[0-9A-Za-z_-]{35}|sk_live_[0-9a-zA-Z]{24,}|xox[baprs]-[0-9A-Za-z-]+|[a-z0-9.-]+\.(internal|corp|local)\b)" js/files/*.js | sort -u
  6. Look for source maps. A source map rebuilds the original source tree, with comments and file names. Check for the reference comment, then for the .map file itself.

    Terminal window
    # Files that reference a source map
    grep -l 'sourceMappingURL=' js/files/*.js
    Terminal window
    # Try the .map next to each JS file and keep the ones that exist
    sed 's/$/.map/' js/live.txt | httpx -mc 200 -silent -o js/sourcemaps.txt

    If one exists, open it in the browser’s DevTools Sources panel, or rebuild the tree on disk with sourcemapper.

    Terminal window
    # Rebuild the original source tree from a live .map
    sourcemapper -url https://app.example.com/static/main.js.map -output js/source/main

    Read the recovered tree like code review: auth checks, feature flags, admin-only routes.

  7. Enumerate webpack chunks. A webpack entry bundle holds a map from chunk id to the hashed filename of each lazy-loaded chunk. The logged-out crawl never loads most of them, but the map names them all. Pull the map out of the entry bundle, build the chunk URLs, and download them, then analyse the chunks the same way as the rest.

    Terminal window
    # Pull the chunk-id to filename map out of the entry bundle
    grep -Eo '\{([0-9]+:"[a-f0-9]+",?)+\}' js/files/main.*.js | tr ',' '\n' | grep -Eo '[0-9]+:"[a-f0-9]+"'
    Terminal window
    # Build and fetch each chunk URL from the ids and hashes you found
    while IFS=: read -r id hash; do
    h=$(echo "$hash" | tr -d '"')
    curl -sk "https://app.example.com/static/js/$id.$h.chunk.js" -o "js/files/chunk-$id.js"
    done < js/chunk-map.txt

    The exact filename template ([id].[hash].chunk.js, [id].[hash].js, or similar) differs per build. Read one <script> tag or network request in the browser to see the real pattern before you loop.

  8. Scan the JS host with nuclei. The exposures templates match source maps, .env files, config and key patterns served next to the bundles, which catches exposures the endpoint tools skip.

    Terminal window
    # Run exposure templates against the hosts that serve JS
    nuclei -l js/live.txt -tags exposure -rl 30 -silent -o js/nuclei-exposures.txt
  9. Use GAP during manual browsing. Install GAP in Burp or Caido and run it on the site map after you click through the app. It collects endpoints and parameters from every response you have seen, including ones loaded after login.

  • js/endpoints.txt adds API routes for phase 10 and phase 11.
  • js/xnl-params.txt becomes a target-specific parameter wordlist.
  • Internal hostnames found in JS go back into subs/all.txt and through phase 4.
  • Analyzing only main.js. Lazy-loaded chunks (chunk-4f2a.js) hold admin and settings pages.
  • Analyzing the logged-out bundle only. Some apps serve a different bundle after login.
  • Reporting public keys as leaks.
  • Running regex-only tools on minified code and trusting that they found everything.
What to look for
  • Routes containing admin, internal, debug, impersonate, export, role, permission, feature
  • Feature flag names next to routes, such as isBetaEnabled guarding /api/v2/billing/refund
  • Hostnames for staging or internal APIs: api-staging.example.com, *.internal.example.com
  • Exposed source maps on production
  • Keys with a server-side prefix: sk_live_, AKIA, private key headers, xoxb-
  • GraphQL operation names, which hint at the schema even when introspection is off

Next, find the parameters those routes accept in phase 10.

Connections13 backlinks · 3 outgoing · 5 cross-guideFull graph →
Open local graph around this page
Open full graph →
Click a node to open · Drag to reposition · Scroll to zoom

Recon AtlasFor authorized testing only. Your scope is the map edge.