Every few weeks we run a maintenance pass over the servers we look after. One step is a hunt for leftover files in web roots: the fix_something.php , test2.php , debug_login.php and install.php files that pile up on any server that has been alive long enough. They are worth hunting. On one pass we found a debug script that printed a payment provider's API credentials to anyone who opened it, an installer that still created an admin/admin123 account, and a "test" file that dumped server details.
So the hunt is useful. It is also how we broke a live product page on a customer site, and the way it happened is worth writing down, because the check we relied on looked solid and was not.
The rule we had
The rule was reasonable on paper:
Find files whose names match a leftover pattern: fix* , test* , debug* , check* , verify* , *_backup.php , *-old*.php , setup*.php , phpinfo* .
For each match, search the code base for references to the file name.
If nothing references it, move it to a quarantine directory…