December 4, 2026
JavaScript Recon for Bug Bounty: From Hidden Endpoints to Exploitable Vulnerabilities
Whenever we start hunting for bugs on a target, most of us focus on the obvious things: login pages, registration forms, API requests, and…

By Rahul Singh Chauhan
6 min read
Whenever we start hunting for bugs on a target, most of us focus on the obvious things: login pages, registration forms, API requests, and parameters we can manipulate.
But there is another attack surface that deserves just as much attention: JavaScript files.
Even though I don't do bug bounty, I still follow this approach while performing JavaScript analysis. This has lead me sometimes led me to find critical vulnerabilities, an example you can find here.
Modern web applications rely heavily on JavaScript. A single bundle can reveal API routes, authentication flows, feature flags, internal service names, frontend authorization checks, and even functionality that is not linked anywhere in the user interface.
But due to heavy reliance on modern runtime environments, such as node.js, a lot of js file are heavily obfuscated. (We'll also tackle it in this article.)
In this article, I'll walk through a practical JavaScript reconnaissance workflow, from collecting files and extracting endpoints to analyzing obfuscated code and testing the actual security controls behind what we discover.
We'll also look at additional tools and test cases that can help you get better at JavaScript analysis.
Collect JS files
To analyze a js file, you must have one. So, there are a couple of methods you can use to get js files.
If you prefer a manual approach, you could crawl the website using a proxy tool such as Burp, Caido and then filter for js files. There are multiple ways of doing it. You could use the following extensions to dump these directly.
There's also JSminer installable directly from Burp Extension. However, you'll need to have Burp Suite Professional for this extension to work.
If the target is huge, you can try waybackurls, gau, katana and other open-source tools.
waybackurls retrieves URLs known to the Wayback Machine. There's a command line binary as well as a URL that you can query to fetch these files. Most rely on the command line.
waybackurls <your-domain> | grep -Ei '\.js([?#]|$)' > jsfiles.txtwaybackurls <your-domain> | grep -Ei '\.js([?#]|$)' > jsfiles.txtThese would give you old js files as well which might no longer be hosted on the main website or isn't visible on the HTML source code. If it's the latter case, you can probably find some interesting information including hard-coded keys in the old js files. What could be interesting that they might still be in use or overly-permissive.
Similarly, gau (GetAllURLs) collects URLs from several public sources.
gau <your-domain> | grep -Ei '\.js([?#]|$)' >> jsfiles.txtgau <your-domain> | grep -Ei '\.js([?#]|$)' >> jsfiles.txtIf you've got a live application, you could crawl it using Katana.
katana -u https://example.com -d 3 -jc -silent -o urls.txt
grep -Ei '\.js([?#]|$)' urls.txt >> jsfiles.txtkatana -u https://example.com -d 3 -jc -silent -o urls.txt
grep -Ei '\.js([?#]|$)' urls.txt >> jsfiles.txtAnalysis
Now you've got multiple js files. Some of them might be duplicate. Let's de-duplicate them.
sort -u jsfiles.txt > dedup-jsfiles.txtsort -u jsfiles.txt > dedup-jsfiles.txtAs discussed earlier, some of these files might not even exist in the wild. You could create a simple script using python requests module to fetch js file and send a request. If you get a 200, 401, 403, it means that the files exist. I've even seen JS files behind a authentication layer, that's why I've added 401 and 403.
You could also automate this easily using httpx
httpx -l dedup-jsfiles.txt -silent -mc 200,401,403 -o jslivefiles.txthttpx -l dedup-jsfiles.txt -silent -mc 200,401,403 -o jslivefiles.txtNow that we've a list of existing files, let's download them locally for further analysis:
mkdir -p jsanalysis
while IFS= read -r url; do
filename=$(printf '%s' "$url" | sha256sum | cut -d' ' -f1)
curl -fsSL --max-time 20 "$url" \
-o "jsanalysis/${filename}.js" || \
echo "Failed: $url"
done < jslivefiles.txtmkdir -p jsanalysis
while IFS= read -r url; do
filename=$(printf '%s' "$url" | sha256sum | cut -d' ' -f1)
curl -fsSL --max-time 20 "$url" \
-o "jsanalysis/${filename}.js" || \
echo "Failed: $url"
done < jslivefiles.txtNow that we've got all the files, let's perform further further analysis on them:
Search for secrets and sensitive configuration
SecretFinder searches JavaScript for patterns associated with secrets and interesting configuration.
python3 SecretFinder.py \
-i https://example.com/assets/app.js \
-o clipython3 SecretFinder.py \
-i https://example.com/assets/app.js \
-o cliFor bulk analysis, use the downloaded files or automate the tool's supported input modes rather than assuming every tool accepts a list of URLs.
Trufflehog — One of my favorites. TruffleHog can scan local files and directories for potential secrets.
trufflehog filesystem jsanalysis --jsontrufflehog filesystem jsanalysis --jsonThey've changed the syntax once. Therefore worth check the installed version's CLI documentation if you get errors.
If you prefer searching for secrets manually, you could use regex patterns. If you're on a single target for quite a while, you'll know what sort of naming patterns they use. You could use this for searching secrets.
grep -RniE \
'api[_-]?key|client[_-]?secret|access[_-]?token|password|private[_-]?key|authorization|bearer' \
jsanalysis/grep -RniE \
'api[_-]?key|client[_-]?secret|access[_-]?token|password|private[_-]?key|authorization|bearer' \
jsanalysis/I've often found config variables disclosing secrets and environment information such as. These can also disclose other dev environments.
const config = {
apiBaseUrl: "https://api.example.com",
environment: "staging",
enableAdminFeatures: false
};
const config = {
apiBaseUrl: "https://api.example.com",
environment: "staging",
enableAdminFeatures: false
};Sometimes, a single API key can be used across multiple environments. Therefore, worth trying that as well.
Extract hidden endpoints and API routes
One of my favorite uses for JavaScript analysis is discovering endpoints that aren't obvious from the user interface.
A bundle might contain routes such as:
const routes = {
profile: "/api/v1/profile",
invoices: "/api/v1/invoices",
export: "/api/v1/reports/export",
adminUsers: "/api/internal/admin/users"
};const routes = {
profile: "/api/v1/profile",
invoices: "/api/v1/invoices",
export: "/api/v1/reports/export",
adminUsers: "/api/internal/admin/users"
};These routes are clues, not vulnerabilities. The next step is understanding how they are used and what protections the server applies.
LinkFinder extracts endpoints and interesting paths from JavaScript.
python3 linkfinder.py \
-i https://example.com/assets/app.js \
-o clipython3 linkfinder.py \
-i https://example.com/assets/app.js \
-o cliFor bulk analysis, run it against each candidate file and store the output separately before deduplicating the results.
I've often found this to leave a lot of links which are not obvious or in obfuscated js files. In this case, I rely on patterns. For example, if the api endpoints being with /api/, you can search using this regex pattern.
At once, I was also using / as a regex pattern to find endpoints but then this would miss those endpoints which would begin with api/ , so you'll have to refine your approach based on the target.
What should you look for?
Pay particular attention to paths containing terms such as:
admin,internal,manageusers,accounts,rolesbilling,payments,invoicesexport,download,reportsdebug,test,previewgraphql,websocket,upload
Search for HTTP methods, too. A route used with DELETE or PATCH may reveal functionality worth examining, although the actual method and access requirements must be confirmed from the application's requests.
Validate the discovered endpoints
Finding an endpoint is only the beginning. Suppose a bundle reveals:
/api/v1/users
/api/v1/users/${userid}/invoices
/api/v1/reports/export/api/v1/users
/api/v1/users/${userid}/invoices
/api/v1/reports/exportWe now need to understand which requests are legitimate, which identities can access them, and whether the backend enforces the intended permissions.
Start by reproducing normal application requests through Burp Suite.
Compare:
- Requests made while logged out
- Requests made while authenticated
- Requests made by different authorized test accounts
- Requests using different HTTP methods
- Requests with different object identifiers
A status-code filter can help with triage:
httpx -l candidate_urls.txt \
-silent \
-mc 200,204,301,302,401,403 \
-o responding_urls.txthttpx -l candidate_urls.txt \
-silent \
-mc 200,204,301,302,401,403 \
-o responding_urls.txtOnly feed this command fully qualified URLs. If LinkFinder produces relative paths, first resolve them against the correct application origin.
A 200 response may contain a login page or generic fallback response. A 401 or 403 is not proof of a vulnerability, either.
The goal is to identify what the endpoint actually returns and whether the response is appropriate for the current identity.
For authenticated API testing, Burp Repeater is often more useful than a standalone HTTP probe because you can preserve cookies, tokens, headers, and request bodies while changing one variable at a time.
Look for Outdated dependencies
There's a handy Burp Extension such as retire.js that can help you with that. There's also a npm based cli tool for retire.js that can help you do this for the files we just downloaded.
retire --path jsanalysis/retire --path jsanalysis/The interesting part — analyze obfuscated JavaScript
The easy part: Scroll to the bottom of the js file or search for sourceMapURL. If you find one, you can use it to un-obfuscate the entire obfuscated javascript file.
If the sourceMap URLdoesn't exist, try the following:
- Use an LLM. Try low cost models like deepseek or open weight models (if you've got a good hardware)
- Try js beautifier. There are many websites which provide it. But even with beautified code, you won't be able to make much out of it. If there are hard-coded secrets, you'll be able to spot them easily. What I do in this case is I search for the
idornameparameter of the form/field that I'm interested in. And then search for thatidin the obfuscated code. Use the nearby code and try to make sense out of it. You can also paste that code in chatGPT or other open source models and at a fraction of a cost try to identify what is being done with the user input.
Browser DevTools
Sometimes, the fastest route to understanding a bundle is to run the application and inspect its behavior.
Open Chrome or Firefox DevTools and explore:
- Sources: Inspect loaded JavaScript and set breakpoints.
- Network: Identify API calls and the scripts responsible for them.
- Call Stack: Trace the functions that led to a particular request.
- Scope: Inspect local variables and function arguments.
- XHR/fetch breakpoints: Pause execution when requests matching a URL pattern are initiated.
For example, suppose you discover this request in the Network tab:
fetch("/api/v1/reports/export", {
method: "POST",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify({
reportId: selectedReport
})
});fetch("/api/v1/reports/export", {
method: "POST",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify({
reportId: selectedReport
})
});Instead of guessing how the endpoint works, set a breakpoint around the request and inspect where selectedReport originates, how the request is constructed, and whether any client-side checks happen before the call.
I've used breakpoints to bypass client-side encryption of files. Try it. It's interesting.
Hope you enjoyed reading the article. Please consider subscribing and clapping for the article.
In case you are interested in CTF/THM/HTB writeups consider visiting my YouTube channel.