Analyzing JavaScript Files for Retrieving Admin Credentials
Administrator credentials were found in a JavaScript file served by the web application. An attacker who discovered the file could read the credentials and use them to gain administrative access.
Published on medium.com
In my very recent testing of a webapp, I was able to find out administrator credentials during my recon process. Following is the way which I used to find them,
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely, sensitive credentials were hard-coded into a client-side JavaScript file that was publicly accessible.
Impact
An attacker could obtain administrator credentials and use them to access the application with administrative privileges.
What the attacker needed
Publicly accessible JavaScript files; Credentials stored in JavaScript
The fix
Sensitive credentials should not be stored in client-side JavaScript files; they should be kept server-side and removed from any publicly accessible code.
How it was found
- Find all subdomains of the target and save them to a text file.
- Use a web crawler to visit all subdomains and save the discovered URLs.
- Filter the saved URLs to keep only JavaScript files.
- Run a secret-finding tool on each JavaScript file to look for sensitive content.
- Read the tool output to find administrator credentials.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
JavaScript files are code that runs in your browser and can be read by anyone. If a developer accidentally puts a password or secret key in that code, anyone who looks at the file can see it. Here, the tester searched many JavaScript files and found the administrator's username and password.
What is Info disclosure?
Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.