DEV Community

Cover image for Information Exposure from Error Messages, Version Info and debug.log — Showing as Little as Possible
Susumu Takahashi
Susumu Takahashi

Posted on Originally published at en.wpmm.jp

Information Exposure from Error Messages, Version Info and debug.log — Showing as Little as Possible

The tools we use to investigate problems on a site — on-screen errors, debug logs, version labels — can show internal details to anyone if they are left on in public. This article walks through where a WordPress site commonly says too much about itself, the principle of exposing only what is needed, and what to check on your own site. It is general guidance, not a guarantee of any outcome.

What "information exposure" means

Information exposure is not an intrusion or a defacement. It is a state where internal details that need not be visible can be read from outside. By itself it does not necessarily cause harm. But facts such as where files sit on the server, which software is in use, and how a failing process flows can help someone understand your site once they are combined with some other weakness.

Earlier articles in this series (forgotten files in the public directory, how credentials leak, keeping secrets out of logs) dealt with leaks of the content itself. This one asks a different question: is the site talking about itself too much?

Four places where sites say too much

1. Error messages on screen

PHP errors and warnings can appear directly on the page. That is convenient during development, but on a live site visitors can see things like:

  • where files are located on the server (paths)
  • which plugin or theme failed, and in which process
  • for database errors, parts of what was being processed

To an ordinary visitor this is noise. To someone studying the site it is a clue. It also simply breaks the page layout, which is a problem for operations too.

2. Debug log files

WordPress can write debug output to a file (the WP_DEBUG family of settings covered in our wp-config.php constants article). The point to check is whether the place it writes to can be read from outside.

If the default location sits inside the public web directory, some setups allow the file to be opened by address if its name is known. A log accumulates a history of errors, so the paths and process details above end up collected in one place, for a long time.

The common entry point is simple: debugging gets switched on for an investigation and is never switched back.

3. Version labels

WordPress core, themes and plugins may show version numbers in page output or in bundled files:

  • a generator label in the page source
  • numbers appended to the end of loaded file addresses
  • readme-style files shipped with a package

Knowing a version lets an outsider guess whether that version has known issues. But this is easy to misread: hiding a version label is not a substitute for updating. If old software keeps running, the problem is still there. Hiding is a supporting measure to show less, not the core of your defense.

4. How usernames appear

Author pages and certain list-style outputs can reveal login names. Knowing a login name narrows down who a password guess should target. Separating the display name from the login name and switching off unnecessary public output are reasonable reviews. Again, this is not a replacement for strong passwords and two-factor authentication; it is another layer that reduces what is visible.

The principle: only to those who need it, only as much as they need

The four cases share one principle:

Show information only to the people who need it, and only as much as they need.

Troubleshooting detail is needed by administrators and not by visitors. So the destination and range of that information should be separate.

Information Who needs it How to think about exposure
Error details Admins, developers Keep off the screen; record somewhere non-public
Debug log Admins, developers Keep outside the public area; turn off when done
Version info Admins Generally no need to show it; prioritize updating
Usernames The user, admins Separate display name from login name

What to check on your own site

Start with read-only checks, on your own site only.

Are errors appearing on screen?

Open public pages in a browser where you are not logged in and see whether errors or warnings show up. If they do, the usual approach is to stop displaying them on screen and keep recording them instead. The wp-config.php article explains what the relevant settings mean.

Is debugging still switched on?

Check whether debug-related settings were left enabled after an investigation. The basic habit is to enable them only when needed and revert when finished.

Can the log file be read from outside?

If you use a debug log, open its address in a browser where you are not logged in. If the contents appear, it can be read from outside. Review it in one of these ways:

  • change the output location to somewhere outside the public area
  • deny access to that file in the web server configuration
  • if the investigation is finished, turn debugging off and tidy up the accumulated log

If it turned out to be readable, look at what had been written in it. If anything authentication-related is mixed in, revoke and reissue it, as described in the earlier articles.

Leftover files

Check the public area for readme-style files and development leftovers. The forgotten files article covers that check.

Limits of this approach

These measures reduce information; they do not remove problems. Keep in mind:

  • hiding information does not remove the problem of software that is not updated; removing a version label does not mean the site is safe
  • a design that depends on secrecy ("it is fine if nobody knows") breaks as soon as one piece leaks
  • when changing settings, take a backup first and check the pages afterwards; a wrong edit can stop the site from displaying
  • on a live site, keep a record of what you changed

The core of defense is what earlier articles covered: updates, least privilege, stronger authentication and backups. Reducing exposure sits outside that core, as a supporting layer that makes the site harder to read.

Summary

  • Debugging aids (on-screen errors, debug logs, version labels) make the site talk about itself if left on in public
  • The principle: only to those who need it, only as much as they need
  • You can start checking by viewing your own site in a logged-out browser
  • Hiding information is no substitute for updates or stronger authentication; it is a layer on top

Next time we look at the legal side of what a site owner should know when personal data has leaked.

Top comments (0)