Virus attack on Joomla 3 (hacked): How to Clean the Site and Safely Upgrade to Joomla 4

If your web-site was hacked by bots or attackers, or simply infected with a virus, the first reaction of many owners is to urgently click the "Update" button, hoping that the new version will patch the security vulnerabilities.
It is already 2026, yet surprisingly, many businesses fail to keep up with the IT and web industries or update their website software; while Joomla 6 has already been released, many company websites are still running the outdated Joomla version 3! This is despite the fact that official support for Joomla 3 (specifically version 3.10, the final stable release in that branch) ended on August 17, 2023—nearly three years ago!
However, if your old Joomla site has been hacked or an issue has arisen a website virus is already active, updating to the latest version in this state is strictly prohibited.
A simple update will not remove all malicious code. Instead, it may carry hacker tools and existing vulnerabilities into the new system, potentially breaking the website completely. If your website has suffered a cyberattack, a safe migration is only possible after a complete cleanup. Only then should you upgrade to Joomla 4, or even better, to Joomla 5.
Below is a step-by-step guide on how to recover a Joomla 3 website and successfully migrate it to a modern platform.
1. Remove malware and fix security vulnerabilities
- Create a backup: Before making any changes, download all website files via FTP and export the database (a full backup) using your hosting control panel.
- Perform a deep scan: Use specialized tools (for example, AI-Bolit) by uploading them to the website's root directory, or scan the downloaded files with a local antivirus program on your computer.
- Remove web shells and malicious code: Attackers often inject malicious code into .php files inside the /images/ or /tmp/ directories, or infect website files with malware by modifying the active template. Locate the infected files, clean them, or replace them with clean copies from the original Joomla distribution.
- Change all credentials: Immediately after cleaning the website, change the passwords for the Joomla administrator account, the MySQL database, FTP/SFTP accounts, and your hosting control panel.
2. Preparing to migrate from Joomla 3 to Joomla 4
A direct migration from older Joomla releases is not possible. A transitional "bridge" is required.
- Update to Joomla 3.10: This is the final release of the Joomla 3 branch, specifically designed to prepare websites for migration.
Go to Components -> Joomla Update and install version 3.10.x. - Review installed extensions: Check all third-party components, plugins, and modules. Make sure compatible Joomla 4 versions are available. Completely remove extensions that are no longer maintained or no longer used.
- Run the Pre-Update Check: In the Joomla Update component, switch the update channel to "Joomla Next." The system will automatically analyze your website and generate a detailed report showing which items are ready for migration and which ones will block the upgrade.
3. Joomla 4 migration process
- Disable incompatible plugins: Deactivate or remove outdated templates and extensions marked as incompatible by the system.
- Start the upgrade: Once the built-in updater confirms your website is ready and Joomla 4 is available, begin the installation process.
- Update databases: Updating is essential. Joomla 3 works with MySQL 5.6+ and MariaDB 5.6+/10.0+, whereas Joomla 4 requires MySQL 8.0+ and MariaDB 10.4.0+.
- Update PHP: Joomla 3 requires PHP version 7 (typically 7.2 or 7.3); these are outdated versions with numerous vulnerabilities and security risks, so you must upgrade to PHP 8.0, with PHP 8.2–8.3 being the recommended versions.
- Final testing: After the migration is complete, clear your browser cache (Ctrl + F5) and carefully test all website pages, contact forms, and frontend navigation.
Need help with your migration?
To help us recommend the best solution for your website, please answer a few questions in the comments or through our contact form:
- Which major extensions are installed on your website (e-commerce components such as VirtueMart or JoomShopping, forums, etc.)?
- Are you using a custom Joomla template or a commercial theme from providers such as JoomShaper, Gavick, or RocketTheme?
- Have you already run the built-in Pre-Update Check tool, and if so, what warnings did it report?
4. Upgrading to Joomla 5: A Safe Migration Guide
To make your website even more secure, we recommend upgrading your Joomla installation to version 5. Moving to the latest release significantly improves protection against future cyberattacks, as the developers have completely redesigned the security architecture, enhanced encryption mechanisms, and optimized the code to meet modern web security standards. However, unlike previous releases, Joomla 5 has stricter server environment requirements.
Mandatory database upgrade: Migrating to MySQL 8 and PHP 8
The key technical requirement of this migration is that upgrading from MySQL 5 to MySQL 8 (MySQL 8.0+ or MariaDB 10.4+) is mandatory. Older MySQL 5.x versions are obsolete, no longer receive security updates, and are not supported by the new CMS. Without upgrading the database server, the Joomla 5 installer will simply block the upgrade process.
In addition, you should upgrade PHP to version 8.
Step-by-step migration from Joomla 4 to Joomla 5
- Step 1. Run a full compatibility check (Pre-Update Check): Make sure your current Joomla 4 installation has been updated to the latest release in the 4.4.x branch. Open the Joomla Update component and review the compatibility reports for all third-party extensions.
- Step 2. Create a fresh backup: Since the migration affects both the file structure and the database, create a complete backup of your website using your hosting control panel or the Akeeba Backup extension.
- Step 3. Upgrade MySQL on your hosting server: Log in to your hosting control panel (cPanel, ISPmanager, DirectAdmin, etc.). Open the database management or website settings section and switch the database version from MySQL 5.x to MySQL 8. If this option is unavailable, contact your hosting provider with a request such as: "Please migrate my website database to a server running MySQL 8.0." Also verify that your server is running PHP 8.1 or later.
- Step 4. Enable the backward compatibility plugin: Joomla 5 includes the built-in Behavior - Backward Compatibility plugin. Make sure it is enabled, allowing older Joomla 4 extensions to continue working correctly in the new environment.
- Step 5. Start the upgrade: After your server has been upgraded to MySQL 8 and Joomla confirms the system is ready, switch the update channel to "Joomla Next" and begin the Joomla 5 installation.
Once the upgrade is complete, be sure to clear both your website cache and browser cache, then test your page loading speed. Running Joomla 5 on MySQL 8 will significantly improve website performance while providing stronger protection against future hacking attempts.
st. Akhmatova 9/18
st. Chornovola 2-A
Sat. 11-00 -16: 00