Leaked API Key in Public JavaScript Leads to Potential Abuse
描述了一次深夜渗透测试的过程,通过工具枚举子域名、探测存活主机并爬取JS文件。手动检查后发现暴露的API密钥,存在数据篡改或账户滥用风险。 2025-7-2 06:42:30 Author: infosecwriteups.com(查看原文) 阅读量:27 收藏

127.0.0.1

On a typical late-night recon session—just me, my terminal, and a cup of coffee—I was passively scanning a few assets on domain.com, a target participating in a public bug bounty program.

I wasn’t expecting much at first, just running through my usual checklist: subdomain enumeration, JS file discovery, parameter harvesting, and content scraping.

Here’s how it started:

# Subdomain enumeration


assetfinder --subs-only domain.com >> subs.txt

# Probing for live hosts


cat subs.txt | httpx -silent >> live.txt

# Crawling for JS files


cat live.txt | waybackurls | grep ".js" >> jsurls.txt

After gathering a list of live JavaScript files, I filtered out the third-party ones and focused on those hosted directly on domain.com.

Sometimes, tools aren’t enough—you have to read the code. So I fetched a few large JS files and manually inspected them:

curl -s https://www.domain.com/static/main.js | less

While scrolling, a particular block caught my attention:

const config = {
apiKey: "AKIAXXXXXXXEXAMPLEKEY123",
 data=91173hsbakexampledata
}

Yep. An API key, sitting exposed in client-side code. Immediately, a few red flags popped up in my head.

Even without knowing exactly what service the key belonged to, I knew this was risky:

If the key had write permissions, it could lead to data tampering or account abuse.


文章来源: https://infosecwriteups.com/leaked-api-key-in-public-javascript-leads-to-potential-abuse-e2f255ee0ee5?source=rss----7b722bfd1b8d---4
如有侵权请联系:admin#unsafe.sh