SANS ISC InfoSec Forums

Since we started to work with computers, we always heard the following advice: "Make backups!". Everytime you have to change something in a file or an application, first make a backup of the existing resources (code, configuration files, data). But, if not properly managed, backups can be evil and increase the surface attack of your web application. Just take an example:

You maintain a Wordpress website for your company and, before changing the configuration, you make a backup of the main configuration file.

# cd /var/www/htdocs
# cp -p wp-config.php wp-config.php.bak

Alternatively, you can also archive the directory content:

# zip -r backup.zip .

For the same reasons, you can also make a backup of the SQL databases or user files.

Now, you can edit them and if everything goes wrong, just revert to the previous version. Looks so far so good! But, often, people forget to protect the backup (which is created with the web site UID or a wrong umask - making it readable by anybody).

What am I talking about this? For a few days, I detected a lot of scans for "backup" files across multiple websites:

I think I prefer a system where the system is tested on a staging server and any meaningful config changes are made there and not on a live system. Also, keep old versions in a configuration management system (CVS, SVN, GIT, ClearCase, etc.) that is properly secured.

A lot of time this doesn't work because clients want a test environment that is publicly accessible. Adding firewall rules for certain IP addresses only works when they are utilizing statics. Still no excuse for allowing backup files to be accessible on the web.

This applies not only to backups that you maintain, but also to backups that your service providers might perform. I came across a situation about two years ago where my trash collector changed online payment services. The previous payment service kept an archive of the payment site - complete with cardholder data - on a browseable directory. See https://www.securityforrealpeople.com/2015/04/dont-get-pwned-by-former-service.html

Xavier, your recommendations are solid. The only thing I would add is to make sure in your business agreements and/or due diligence, to make sure your service providers follow the same practices - and to ensure business agreements specify what happens to your data when you cease doing business with a provider.