October 18, 2026
How I Find Hidden Vulnerabilities Inside JavaScript Files: Step-by-Step Bug Bounty Guide
A simple, practical method to dig secrets, endpoints, and bugs out of JS files โ with every command you need

By Monika
3 min read
Whenever we do bug bounty on a target most of us only look at the main website โ login page, forms, APIs. But one goldmine that a lot of people miss is JavaScript files.
JS files often have things developers accidentally left behind:
- API keys and tokens
- Hidden/internal endpoints
- Admin panel URLs
- Subdomain names
- Database credentials
- Debug/test routes
In this article, I'll walk you through the exact process from recon to exploitation that I personally use on my own targets.
Step 1: Collect all the JS files of the target
First, we need to build a list of all the JS files on the target. For this, we use a few tools.
Tool 1 โ waybackurls (fetches old and current JS files):
waybackurls target.com | grep "\.js$" > js_files.txtwaybackurls target.com | grep "\.js$" > js_files.txtTool 2 โ gau (GetAllUrls, also pulls URLs from archives):
gau target.com | grep "\.js$" >> js_files.txtgau target.com | grep "\.js$" >> js_files.txtTool 3 โ katana (does live crawling, more accurate):
katana -u https://target.com -jc -o katana_js.txt
grep "\.js$" katana_js.txt >> js_files.txtkatana -u https://target.com -jc -o katana_js.txt
grep "\.js$" katana_js.txt >> js_files.txtNow remove duplicate URLs:
sort -u js_files.txt -o js_files.txtsort -u js_files.txt -o js_files.txtStep 2: Check which JS files are live
Not all files will be live, so we check with httpx :
cat js_files.txt | httpx -silent -mc 200 -o live_js.txtcat js_files.txt | httpx -silent -mc 200 -o live_js.txtThis command will list only the files that are still accessible status code 200.
Step 3: Pull out secrets and sensitive info
Now the real work begins hunting for secrets inside these JS files.
Tool: SecretFinder (pulls out API keys, tokens, etc.):
python3 SecretFinder.py -i live_js.txt -o clipython3 SecretFinder.py -i live_js.txt -o cliTool: trufflehog (regex + entropy based secret scan):
trufflehog filesystem live_js.txt --jsontrufflehog filesystem live_js.txt --jsonYou can also search manually with "grep" if a tool feels slow:
cat live_js.txt | while read url; do
curl -s "$url" | grep -Eo "(api_key|apikey|secret|token|password|aws_access_key_id)[\"']?\s[:=]\s[\"'][^\"']+[\"']"
donecat live_js.txt | while read url; do
curl -s "$url" | grep -Eo "(api_key|apikey|secret|token|password|aws_access_key_id)[\"']?\s[:=]\s[\"'][^\"']+[\"']"
doneThis regex will look for secrets around common keywords.
Step 4: Pull out hidden endpoints and paths
Every JS file has a lot of API endpoints hidden inside it. The best tool to extract these is LinkFinder:
python3 linkfinder.py -i https://target.com/app.js -o clipython3 linkfinder.py -i https://target.com/app.js -o cliIf you want to do it in bulk across all files:
for url in $(cat live_js.txt); do
python3 linkfinder.py -i "$url" -o cli >> endpoints.txt
donefor url in $(cat live_js.txt); do
python3 linkfinder.py -i "$url" -o cli >> endpoints.txt
doneYou'll then need to manually test the endpoints you find sometimes these turn out to be unauthenticated internal APIs that return sensitive data directly.
Step 5: Validate the endpoints are they accessible?
Once you've cleaned up the list of endpoints you found, check them again with "httpx":
cat endpoints.txt | sort -u | httpx -silent -mc 200,401,403 -o valid_endpoints.txtcat endpoints.txt | sort -u | httpx -silent -mc 200,401,403 -o valid_endpoints.txtWhat the status codes mean:
- 200 : the endpoint is live and directly accessible
- 401/403 : the endpoint exists but has authentication/authorization in place (this is where you can try IDOR or auth bypass)
Step 6: Check JS files for library versions known CVEs
Old JS libraries (jQuery, Angular, Lodash, etc.) often have known vulnerabilities. To check this, we use retire.js:
retire --js --path live_js.txtretire --js --path live_js.txtIf you find an outdated library with a public CVE, note it down these are easy, legitimate findings.
Step 7: Beautify and read manually
Minified JS is hard to read, so we need to beautify it first:
js-beautify app.min.js -o app_beautified.jsjs-beautify app.min.js -o app_beautified.jsThen open this file manually and read through it carefully, looking for:
- Developer notes in comments
- Hardcoded URLs (staging, dev, internal)
- Function names that hint at an admin feature
Step 8: Automate everything together
If doing this manually every time feels time-consuming, you can build a simple bash script that runs all these steps together:
#!/bin/bash
domain=$1
waybackurls $domain | grep "\.js$" > js_files.txt
gau $domain | grep "\.js$" >> js_files.txt
sort -u js_files.txt -o js_files.txt
cat js_files.txt | httpx -silent -mc 200 -o live_js.txt
python3 SecretFinder.py -i live_js.txt -o cli#!/bin/bash
domain=$1
waybackurls $domain | grep "\.js$" > js_files.txt
gau $domain | grep "\.js$" >> js_files.txt
sort -u js_files.txt -o js_files.txt
cat js_files.txt | httpx -silent -mc 200 -o live_js.txt
python3 SecretFinder.py -i live_js.txt -o cliRun it:
bash js_recon.sh target.combash js_recon.sh target.comImportant: Responsible disclosure
Whatever secret or endpoint you find, only test it within the authorized scope where the company has allowed it as part of their bug bounty program. Never misuse real credentials; only take a screenshot for proof-of-concept and report it.
Final Thoughts
JS files are an underrated attack surface the deeper you dig into them, the higher your chances of finding hidden bugs. This is the method I follow on every new target, and it has gotten me several valid findings.
In my next article, I'll show you how to use these endpoints to find IDOR and Broken Access Control โ stay tuned!
THANK YOU โจ
If this guide helped you, consider buying me a coffee โ โ it keeps me motivated to dig up and write more bugs like this
Monika Hi, I'm Monika โจI break down real-world bug bounty reports into simple, practical write-ups.If my articles help youโฆ