Information disclosure leaks details that make other attacks easier, even if each piece seems harmless on its own. By reducing what the server reveals, you raise the cost for attackers during their reconnaissance phase.

What is an information disclosure vulnerability and how does it work?

Information disclosure occurs when a web server, application, or underlying system sends data that should remain private. The data can appear in HTTP headers, HTML source, error messages, or publicly accessible files. Attackers collect these clues to identify software versions, server configurations, file system layout, and even secret keys. The more precise the information, the easier it is to match known vulnerabilities to the target.

Which kinds of data are commonly exposed?

Type Typical source
Server name and version Server or X-Powered-By HTTP headers
Application and language versions HTML comments, meta tags, or query strings
Internal file paths PHP or WordPress error messages showing wp-content/plugins/...
API keys and secrets Inline JavaScript, hidden form fields, or public config files
Detailed error messages Stack traces printed to the browser on failure
Backup or configuration files Files like wp-config.php.bak, phpinfo.php, or .env left in the web root
Directory listings Auto-indexing when no index.php or index.html exists

These items are the exact clues attackers look for when running an outside vulnerability scan.

How can I see what information I am currently leaking?

  1. Open a browser’s developer tools and inspect the Response Headers for Server, X-Powered-By, or custom headers.
  2. View the page source and search for version numbers, comments, or obvious keys.
  3. Request a non-existent URL (e.g., /does-not-exist) and observe the error page for file paths or stack traces.
  4. Use a command-line tool like curl -I https://example.com to see raw headers.
  5. Check the web root for stray files (*.bak, *.old, .env).
  6. Verify that directory indexing is disabled by navigating to a known empty folder.

Step-by-step guide to stop information disclosure

  1. Hide server and language versions
    • In the web server configuration, set ServerTokens Prod and ServerSignature Off (Apache) or server_tokens off; (nginx).
    • Remove X-Powered-By by setting expose_php = Off in the PHP configuration, or with Header unset X-Powered-By (Apache) or fastcgi_hide_header X-Powered-By; (nginx).
  2. Add protective security headers
    • Include Content-Security-Policy, X-Content-Type-Options: nosniff, X-Frame-Options: SAMEORIGIN, and Referrer-Policy: strict-origin-when-cross-origin. See the detailed guide on security headers.
  3. Turn off detailed errors in production
    • In wp-config.php set define('WP_DEBUG', false); and define('WP_DEBUG_DISPLAY', false);.
    • Configure PHP’s display_errors = Off and log_errors = On in php.ini.
  4. Remove stray backup and config files
    • List candidates in the web root with find . -type f \( -name "*.bak" -o -name "*.old" -o -name ".env" \), check each one, and remove only the files you are sure are not needed (move secrets out of the web root rather than deleting them).
    • Harden file system permissions; see the guide on file permissions.
  5. Disable directory listings
    • Apache: Options -Indexes inside the site’s <Directory> block.
    • nginx: autoindex off; in the server block.
  6. Audit client-side code for secrets
    • Search repository for strings that look like keys (AKIA, sk_, Bearer ) and ensure they are never committed to public directories.
    • Replace embedded keys with server-side calls that keep secrets out of the browser.

Common mistakes when trying to fix information disclosure

  • Turning off all headers - removing every custom header can break integrations; keep only those needed for security.
  • Leaving debug constants in production - WP_DEBUG may be set to true in a staging environment and accidentally deployed.
  • Deleting files without backup - a blanket find … -delete can remove legitimate configuration files; always review before deletion.
  • Relying solely on plugins - core server settings must be adjusted; a plugin that hides versions does not change the underlying web server configuration.
  • Forgetting sub-domains - each virtual host may have its own config; apply changes to all sites on the server.

What the fixes cannot do

  • They do not protect against vulnerabilities that are exploited without needing version information (e.g., generic SQL injection). Other layers of security are still required.
  • Security headers improve client-side enforcement but cannot stop a determined attacker who already has server access.
  • Removing exposed keys from the front end prevents theft, but if the keys were already compromised they must be revoked and regenerated.
  • Disabling directory listings stops casual browsing; an attacker who knows exact file names can still request them directly.

How Silent Threads helps

Silent Threads' scanners check for common leaks: publicly reachable files such as .env, .git, wp-config.php backups, debug logs and phpinfo pages, open directory listings, and debug or display_errors settings that print internal details. The Secret Scanner (Pro) looks for keys and passwords left in your files. Close what they find, and you take away the map attackers use to plan their approach.

The short version

Information disclosure gives attackers a roadmap. Hide server and application versions, suppress detailed errors, remove stray files, disable directory listings, and add standard security headers. Regularly scan your own site to see what an external tool would discover, and keep file permissions tight.