That wp-config dot bak file you saved for safety is actually handing your database password to hackers on a silver platter
Youre tweaking your wp-config file, maybe changing a database name or flipping debug mode on, and you think to yourself, "You know what, let me just save the old version as a .bak real quick, just in case I mess something up." It feels safe. It feels responsible. It feels like youre being a careful developer.
But heres the brutal truth nobody tells you. That innocent little .bak file sitting right there in your public html folder is basically a neon sign screaming "hack me" to every single bot and attacker crawling the web. And the worst part? When someone types yourdomain dot com slash wp-config.php.bak into their browser, guess what happens? The file doesnt execute. It doesnt hide. It doesnt protect itself. It just opens up like a book and shows every single secret your WordPress site has.
And we are talking about the good stuff here. Your database name, your database username, your database password, the host, those fancy salt keys that keep your cookies secure, and sometimes even API credentials if youve added custom constants over the years. Thats literally the whole keys to the castle. With that info, an attacker can log into your database directly, pull your entire user table, reset admin passwords, inject malicious scripts, or just wipe everything out of spite. Its not paranoia, its happened to way too many sites already.
And heres the thing that really gets me. These bots are not sophisticated. Theyre not targeting you specifically. Theyre just scanning millions of sites every single day looking for file extensions like .bak, .old, .backup, .save, or even that annoying tilde character that some editors leave behind. The moment you upload that backup file, its only a matter of hours, sometimes minutes, before some automated script finds it and logs it for later abuse. Its like leaving your front door wide open and hoping nobody walks in.
So please, do yourself a huge favor right now. Open up your FTP client or your cPanel file manager and go straight to your WordPress root folder, the same place where your main wp-config file lives. Take a good hard look at whats in there. If you see any file with wp-config and then a dot and something like bak, old, backup, save, or even a squiggly line at the end, download that file to your local computer immediately. Keep it somewhere safe on your own machine. And then delete it from the server without a second thought. Do not hesitate, do not negotiate, just get rid of it.
And while you are at it, do a quick sweep for other dangerous leftovers. Maybe you dropped a database export as a dot sql file a few months ago and forgot about it. Maybe you saved a backup of your htaccess file or your php ini. Those are just as dangerous because they can also be read directly through the browser. Same rule applies, grab a local copy if you really need it for reference and then wipe it off the remote server.
The safe way to handle backups is keeping them outside the public web root, like one folder above where your public html sits, or just storing them locally on your hard drive, or using a proper version control system with a private repository. Never ever leave anything readable inside that web accessible folder. Its not worth the risk.
I know this sounds like one of those overly cautious tech rants, but I promise you, this is one of the easiest and most common entry points for attackers. Its completely preventable and takes less than two minutes to fix. Go check your site right now, seriously, do not put this off until later.