Main Page
From MyJoomlaSecurity - Joomla Security Guide wiki
|
[edit] Joomla Security Guide
[edit] 8 MOST effective tips to optimize your Joomla website security[edit] Use the latest Joomla security update[edit] Be on the lookout for latest exploitsYou can check for available Joomla exploits @ Joomla Exploits Aggregator [edit] Use secure username and password for administrators[edit] Don't tell everyone about your configuration[edit] Change the default database prefix (jos_)Most SQL injections that are written to hack a Joomla! website, try to retrieve data from the jos_users table. This way, they can retrieve the username and password from the super administrator of the website. Changing the default prefix into something random, will prevent (most / all) SQL injections. You can set the database prefix when installing your Joomla! website. If you've already installed Joomla! and want to change your prefix, do the following: 1. Log on to your Joomla! back-end.
2. Go to your global configuration and search for the database
3. Change your database prefix (Example: fdasqw_) and press Save.
4. Go to phpMyAdmin to access your database.
5. Go to export, leave all default values and press Start. Exporting the database can take a while.
6. When done, select all code and copy it to notepad (or any other text editor)
7. In phpMyAdmin, select all tables and delete them
8. In notepad, do a Search & replace (Ctrl + H). Set the searchterm to jos_ and change it
into your new prefix
(Example: fdasqw_). Press "Replace all".
9. Select everything in your notepad file and copy it. In phpMyAdmin, go to SQL, paste the
queries and press Start.
[edit] Remove version number / name of extensionsMost vulnerabilities only occur in a specific release of a specific extension. Showing MyExtension version 2.14 is a really bad thing. You can modify this message to only the name of the extension by doing the following: 1. Retrieve all files of the extension from your server.
2. Open up Dreamweaver.
3. Load any file from the extension that you just downloaded to your local machine.
4. Use the Search function and set the search to Search through specified folder. Navigate to the
folder where you
downloaded the exploit to.
5. Set the search term to "MyExtension version 2.14" and press OK.
6. When found the correct file, remove the version number.
7. Upload the changed file to your server and check if the changes are made.
[edit] Use a SEF componentMost hackers use the Google inurl: command to search for a vulnerable exploit. Use Artio, SH404SEF or another SEF component to re-write your URL's and prevent hackers from finding the exploits. Additionally, you'll get a higher rank in Google when using search engine friendly URL's. Keep Joomla! and extensions up to date This one is pretty obvious. Always check for the latest versions of Joomla! and the extensions you're using. Many vulnerabilities are resolved most of the times in later versions. [edit] Use the correct CHMOD for each folder and fileSetting files or folders to a CHMOD of 777 or 707 is only necessary when a script needs to write to that file or directory. All other files should have the following configuration: * PHP files: 644 * Config files: 666 * Other folders: 755 [edit] Delete leftover filesWhen you installed an extension that you didn't like, don't set the extension to unpublished. If you do, the vulnerable files will still be on your website. So simply use the un-install function to totally get rid of the extension.
[edit] For additional countermeasures that will enhance your website security follow these steps.[edit] Choose a Qualified Hosting ProviderThe most important decision
Shared server risks
Avoid sloppy server configurations
Configuring Apache Use Apache .htaccess See also .htaccess examples
Joomla ships with a preconfigured .htaccess file but *you* need to choose to use it. The file is called htaccess.txt to use it rename it to .htaccess and place it in the root of your webpage.
Use Apache mod_security
Configuring MySQL Secure the database
Configuring PHP Understand how PHP works
Use PHP5
Use local php.ini files
There are a few important things to keep in mind. 1. Local php.ini files only have an effect if your server is configured to use them. This includes a php.ini file in your http_root directory. You can test whether or not these file affect your site by setting an obvious directive in the local php.ini file to see if it affects your site. 2. Local php.ini files only effect .php files that are located within the same directory (or included() or required() from those files). This means that there are normally only two Joomla! directories in which you would want to place a php.ini file. They are your http_root(your actual directory name may vary), which is where Joomla's Front-end index.php file is located, and the Joomla! administrator directory, which is where the Back-end administrator index.php file is located. Other directories that don't have files called via the Web do not need local php.ini files. 3. If you have a php.ini file in every directory, some script probably did this for you. If you didn't intend it to happen, you probably should root them out, but given #2 above, you probably only have to panic about the php.ini files in http_root and the administrator directories. Use PHP disable_functions
disable_functions = show_source, system, shell_exec, passthru, exec, phpinfo, popen, proc_open Use PHP open_basedir
The restriction specified with open_basedir is a prefix, not a directory name. This means that open_basedir = /dir/incl allows access to /dir/include and /dir/incls if they exist. To restrict access to only the specified directory, end with a slash. For more information, see PHP Security and Safe Mode Configuration Directives. open_basedir = /home/users/you/public_html In some system configurations, at least with PHP 4.4.8, the use of the trailing slash to restrict the access to only the specified directory may cause Joomla to warn JFolder::create: Infinite loop detected when saving the Back-End Global Configuration. This warning is triggered because PHP file_exists() function fails, for example, when asked if /home/user/public_html/joomla_demo exists and open_basedir is set to /home/user/public_html/joomla_demo/ (see the trailing slash). Additionally, if open_basedir is set it may be necessary to set PHP upload_tmp_dir configuration directive to a path that falls within the scope of open_basedir or, alternatively, add the upload_tmp_dir path to open_basedir using the appropriate path separator for the host system. open_basedir = /home/users/you/public_html:/tmp PHP will use the system's temporary directory when upload_tmp_dir is not set or when it is set but the directory does not exist, therefore it may be necessary to add it to open_basedir as above to avoid uploading errors within Joomla. Adjust magic_quotes_gpc
Joomla! 1.5 ignores this setting and works fine either way. For more information, see PHP Manual, Chapter 31. Magic Quotes. magic_quotes_gpc = 1 Don't use PHP safe_mode
safe_mode = 0 Don't use PHP register_globals
If your site is on a shared server with a hosting provider that insists register_globals must be on, you should be very worried. Although you can often turn register_globals off for your own site with a local php.ini file, this adds little security as other sites on the same server remain vulnerable to attacks which can then launch attacks against your site from within the server. For more information, see ZEND Chapter 29. Using Register Globals. register_globals = 0 Don't use PHP allow_url_fopen
allow_url_fopen = 0 Setup a backup and recovery process The most important rule:' Thou shalt at all time be able to return your site to a previous working state through regular use of a strong, off-site backup and recovery process. Be sure your backup and recovery process is in place and tested BEFORE you go live. This is the single best way (and often the only way) to recover from such inevitable catastrophes as: 1. A compromised/cracked site. 2. Broken site due to a faulty upgrade. 3. Hardware failure, such as dead hard drives, power failures, server theft, etc. 4. Authoritarian government intervention. (More common than some think.) 5. Needing to quickly relocate to a new server or hosting provider. [edit] Site Administration
Follow a password leveling scheme
Maintain a strong site backup process
Perform automated intrusion detection
* Google Search * Wikipedia Article
* Joomla! Version Checking * Joomla! Component/Module Version Checking * Exploit Checking
[edit] Secure Testing and DevelopmentDevelop locally, deploy globally
Use an IDE
Use a versioning system
Setup a backup process first The most important rule Thou shalt at all time be able to return your site to a previous working state through regular use of a strong, off-site backup and recovery process. Be sure your backup and recovery process is ready and tested BEFORE your site goes live. This is the single best way (and often the only way) to recover from such inevitable catastrophes as: 1. A compromised/cracked site. 2. Broken site due to a faulty upgrade. 3. Hardware failure, such as dead hard drives, power failures, server theft, etc. 4. Authoritarian government intervention. (More common than some think.) 5. Needing to quickly relocate to a new server or hosting provider. |
