Directory Listing: How a simple misconfiguration exposed an Appli
A web server had directory listing enabled, exposing log directories that contained a WeChat access token. An attacker could use that token to query WeChat's API, list users, retrieve message templates, and send official-looking messages with attacker-controlled links.
Published on medium.com
Hello, world! It’s been a while.
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 the web server had directory listing enabled and sensitive logs containing secrets were stored in a web-accessible directory.
Impact
An attacker could use the token to list users, retrieve message templates, and send official-looking messages with attacker-controlled links, which could be used for phishing.
What the attacker needed
Directory listing enabled; logs stored in web-accessible location; secrets written to logs
The fix
The text does not say it was fixed; it should be fixed by disabling directory listing, storing logs outside the web root, never logging secrets, and applying least privilege.
How it was found
- Use content discovery tools to find a suspicious directory called system.
- Open the directory in a browser and see directory listing with subdirectories including weixin and debug.
- Review the exposed logs and find an access_token in plain text.
- Verify the token by querying WeChat's API.
- Use the token to list users and retrieve private message templates.
- Send a message to a user as the application with an attacker-controlled link.
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.
Directory listing is a web server setting that lets anyone browse folders like a file manager. Here it was switched on, so logs were visible, and those logs contained a secret key (an access token) for WeChat. With that key, someone could act as the app on WeChat, for example sending messages to users.
What is Info disclosure?
Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.