Support

Akeeba Backup for Joomla!

#8833 Will Akeeba Backup Pro restore a site with a moved Configuration.php

Posted in ‘Akeeba Backup for Joomla! 4 & 5’
This is a public ticket

Everybody will be able to see its contents. Do not include usernames, passwords or any other sensitive information.

Environment Information

Joomla! version
n/a
PHP version
n/a
Akeeba Backup version
n/a

Latest post by nicholas on Thursday, 31 March 2011 04:36 CDT

user8399
Hi, my websites have recently come under attack and I'm looking at ways to increase their security. One sensible suggestion is to move the configuration.php outside of the public_html directory.

It's documented on Joomla's site here:
http://docs.joomla.org/Security_and_Performance_FAQs#Moving_sensitive_files_outside_the_web_root

I know that Akeeba Backup Pro (v3.1.5) would be able to include the moved configuration.php as part of the backup if you configured it correctly. My question is, what would happen with Kickstart during a restoration process? Would it pick up on the moved configuration file?

Thanks in advance.

Dominic

nicholas
Akeeba Staff
Manager
I would hardly consider moving the configuration.php file a security measure by any means. Here's why.

Plan A. As an attacker, if I find a direct file inclusion vulnerability on your site, I can always dump the contents of your defines.php and see the new path. Exploiting the same vulnerability I can launch a second attack to dump the contents of the moved file. I have your database passwords.

Plan B. With a rogue upload vulnerability, I would be able to upload a small PHP script to include or scan defines.php, include the configuration.php file and var_dump an instance of it. I have your database passwords.

Plan C. With an arbitrary code execution attack vector (remote file inclusion, arbitrary eval(), etc) I can simply var_dump an instance of JConfig.

Making the point simpler: If Joomla! can read the file, anyone -except a totally stupid attacker- can read it, too.

My advice is to use sane security practices to minimise the possibility of an attack like the one I described. Admin Tools' Web Application Firewall and .htaccess Maker really help towards that goal. Updating your software as soon as a new release is out is also a much needed security practice. Protecting your administrator area with a password or a secret word is very important. Using a strong password (ideally: 14 or more characters with lowercase/uppercase letters, digits and symbols) is of paramount importance, i.e. there's no point moving your configuration.php file if your SA login is admin/admin ;) All and all I find that the myth of adding security by moving the configuration.php is worth of a Mythbusters-style bust.

That said, if you move your configuration.php file, the backup will be made successfully, but the restoration is another story. When you restore your site, the restoration script will write a (now unused) configuration.php file in your site's root. This means that Joomla! will still try to find the moved file. If it does, it will use that file's information which -if different than the file written by the restoration script, at least in the db connection fields- will lead to an error. If it the moved file no longer exists, tough luck, you will still get an error. As a result, after the restoration, you will have to manually create a new configuration.php file inside the location where you chose to move your configuration.php file. This beats the purpose of easy restoration, but is doable.

Nicholas K. Dionysopoulos

Lead Developer and Director

πŸ‡¬πŸ‡·Greek: native πŸ‡¬πŸ‡§English: excellent πŸ‡«πŸ‡·French: basic β€’ πŸ• My time zone is Europe / Athens
Please keep in mind my timezone and cultural differences when reading my replies. Thank you!

user8399
Thank you Nicholas for your comprehensive answer. If security can be improved in other ways and it complicates backup restoration to move configuration.php, then I agree, it's not worth doing.

We already use quite complex passwords. They don't seem to have done us much good so far but if you can get the contents of configuration.php, it doesn't matter how complex the database password is.

In the attack scenarios you mentioned, are there any php.ini settings that you think are worth specifying that would make those attacks more difficult?

The Admin Tools features you described; are they in the free version or the professional version?

Dominic

nicholas
Akeeba Staff
Manager
Dominic,

I would bet an arm and a leg that the attacker never got your database passwords. The easiest, fastest and least intrusive way of gaining access to a site or defacing it is to exploit SQL injection vulnerabilities, i.e. exploit a vulnerable extension to run arbitrary SQL commands against the site's database. If I find a vulnerable extension on your site I can grant myself Super Administrator privileges and log into your site in two minutes flat. It's that fast. You need to ensure that your extensions are not vulnerable. If unsure check the Vulnerable Extensions List. Items in red must be uninstalled ASAP. Items in green must be upgraded ASAP.

Regarding the attack scenarios I mentioned, the only thing you can do to mitigate one of those attacks is to disable URL fopen() wrappers in your php.ini. For everything else you need to follow the other security practices I mentioned.

The Web Application Firewall and .htaccess Maker are features of the (subscription based) Admin Tools Professional.

Nicholas K. Dionysopoulos

Lead Developer and Director

πŸ‡¬πŸ‡·Greek: native πŸ‡¬πŸ‡§English: excellent πŸ‡«πŸ‡·French: basic β€’ πŸ• My time zone is Europe / Athens
Please keep in mind my timezone and cultural differences when reading my replies. Thank you!

Support Information

Working hours: We are open Monday to Friday, 9am to 7pm Cyprus timezone (EET / EEST). Support is provided by the same developers writing the software, all of which live in Europe. You can still file tickets outside of our working hours, but we cannot respond to them until we're back at the office.

Support policy: We would like to kindly inform you that when using our support you have already agreed to the Support Policy which is part of our Terms of Service. Thank you for your understanding and for helping us help you!