How I Discovered Critical WordPress Vulnerabilities: A Real-World
A WordPress site exposed directory indexing and allowed direct download of wp-config.php, leaking database credentials and secret keys. A reflected XSS was also found in an unsanitised comment parameter.
Published on thezubairusman.medium.com
In early May 2025, I was conducting a routine reconnaissance on a popular WordPress-based hosting environment when I uncovered multiple critical security issues ranging from XSS vulnerabilities to directory indexing, exposed configuration files, and misconfigured headers.
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 directory indexing was enabled and file permissions allowed direct access to wp-config.php, while a theme template echoed user input without sanitisation.
Impact
An attacker could read database credentials and secret keys, potentially leading to full server compromise, and could run script in a victim's browser via the reflected XSS.
What the attacker needed
Target runs WordPress; directory indexing enabled; wp-config.php readable via web
The fix
The text says the vendor scheduled a patch; recommended fixes are disabling directory indexing, protecting wp-config.php, sanitising input, and setting security headers.
How it was found
- Scan headers and SSL with Nikto and curl.
- Probe common WordPress plugin and theme directories.
- Find that the theme inc directory was openly indexed.
- Download wp-config.php directly with curl.
- Manually inspect theme files for reflected parameters.
- Test a script payload in the unsanitised comment parameter and see it execute.
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.
A WordPress site left a folder listing open and let anyone download its main configuration file. That file holds the database password and secret keys, so an attacker could read or change site data. Separately, a comment field echoed user input without cleaning it, letting an attacker run script in a visitor's browser.
What is Info disclosure?
Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.