CIDADAXSEC
← All topics
Practitioner

Information disclosure

Information disclosure leaks sensitive data through error messages, debug pages, backup files, or version control history.

Material

Information disclosure happens when the application or its infrastructure returns more than the task requires. Small details such as internal filenames, framework versions, or credentials inside error messages often become the first foothold that collapses layered defenses.

How it works

Debug settings meant for development frequently reach production, and a forgotten debug page stays reachable through a URL that is never linked. Backup archives, old exports, and version control directories are also routinely left in the web root with no protection.

http
GET /download?file=report.pdf HTTP/1.1
Host: lab.cidadaxsec.local
Cookie: session=3f9a1c7e
Accept: */*

HTTP/1.1 500 Internal Server Error
Content-Type: text/html

<pre>java.nio.file.NoSuchFileException: /var/www/app/data/reports/2024/invoice-8812.pdf</pre>
bash
for path in /.git/config /app.zip /backup.zip /.env /debug /trace.axd; do
  code=$(curl -s -o /dev/null -w "%{http_code}" "https://lab.cidadaxsec.local$path")
  echo "$code $path"
done

# unduh backup yang ketemu
curl -sS -o app.zip "https://lab.cidadaxsec.local/app.zip"

Attack vectors

  • Verbose error messages leaking stack traces, absolute paths, and internal class names.
  • Debug or tracing pages still live in production, such as a framework diagnostic endpoint.
  • Backup and old archives with zip, bak, or old suffixes that stay downloadable.
  • Version control history: .git/HEAD or .git/logs/HEAD can be read to restore deleted files.
  • Excessive headers such as server banners, library versions, and X-Powered-By.

Small leaks tend to chain. An absolute path from an error message reveals the app folder, a file listing reveals the framework, and a stray config file may hold API keys that make the next leak far worse.

Preventing

  • Turn off verbose errors in production: serve a generic error page and keep details in server-side logs only.
  • Remove backups, archives, and version control directories from the web root, then rebuild on every release.
  • Block debug pages and diagnostic endpoints with web server rules rather than by merely hiding links.
  • Allowlist response headers and strip banners that advertise software versions.
  • Audit periodically the endpoints that can return files from disk, and restrict the reachable directories.
http
GET /download?file=report.pdf HTTP/1.1
Host: lab.cidadaxsec.local

HTTP/1.1 404 Not Found
Content-Type: application/json
Server: nginx
X-Request-Id: 7c1e2b

{"error":"not_found","requestId":"7c1e2b"}

Labs

  • Information disclosure in error messages
  • Information disclosure on debug page
  • Source code disclosure via backup files
  • Authentication bypass via information disclosure
  • Information disclosure in version control history
The truly sensitive values usually live in configuration files, not in code. Search config files, environment files, and API keys periodically, and make sure they sit outside any downloadable path.

Labs in this topic

Labs run on a domain separate from this site, so a payload cannot reach your account session.

Labs for this category land in Phase 2. The material is readable now.

Challenges in this category

Challenges from the PortSwigger Web Security Academy. The original labs run on PortSwigger domains, so the link opens there.