Hacked website recovery help in Canada follows the same core technical process as anywhere in the world, but Canadian site owners also face specific legal reporting obligations and local resources worth knowing. If your site has been compromised, the most important thing you can do right now is act quickly — every hour of delay gives attackers more time to steal data, infect visitors, and entrench backdoors that survive a simple restore. This guide walks you through the entire recovery process in plain, practical language, even if you have no security background.
How Do I Know My Website Has Actually Been Hacked?
Before you panic, confirm the compromise is real. Common signs include:
- Google Search Central (Google Search Console) sends you a security alert or your site appears with a "This site may be hacked" warning in search results.
- Visitors report being redirected to unrelated or suspicious websites.
- Your hosting provider has suspended your account and cited malware or abuse.
- You notice unfamiliar admin accounts, new files you did not create, or modified timestamps on core files.
- Antivirus tools flag your site's pages.
- Your site is loading slowly, crashing, or sending spam emails without your knowledge.
If two or more of these apply, treat it as a confirmed compromise and move immediately to containment.
Step 1: Contain the Damage Immediately
Take Your Site Offline or Into Maintenance Mode
Your first priority is to stop the bleeding. Putting your site in maintenance mode or temporarily taking it offline prevents your visitors from being exposed to malware, phishing pages, or drive-by downloads. Most content management systems (CMS) like WordPress, Joomla, or Drupal have a built-in maintenance mode, or your hosting control panel (cPanel, Plesk) may offer a way to temporarily suspend the site.
Change All Passwords Right Now
Change every password associated with your website before cleaning anything, because attackers almost always steal credentials:
- Hosting control panel (cPanel, Plesk, etc.)
- FTP / SFTP accounts
- Database passwords (found in your CMS config file — e.g.,
wp-config.phpfor WordPress) - CMS admin accounts
- Your domain registrar account
- Any email accounts tied to the site
Use long, randomly generated passwords (16+ characters with mixed case, numbers, and symbols) and store them in a reputable password manager.
Revoke Unknown API Keys and Tokens
Check your hosting and any connected third-party services (payment gateways, email delivery services, CDN providers) for API keys or OAuth tokens you do not recognise. Revoke them immediately.
Step 2: Preserve Evidence (This Matters for Canadian Law)
Do not wipe everything immediately. Under Canadian federal law, if personal data belonging to individuals has been exposed, you may have obligations under the Personal Information Protection and Electronic Documents Act (PIPEDA) — or provincial equivalents such as Quebec's Law 25 (Bill 64). Evidence preservation supports any mandatory breach notifications and potential law enforcement investigations.
What to Preserve
- Full server access logs (Apache:
/var/log/apache2/access.log; Nginx:/var/log/nginx/access.log) - CMS and application error logs
- A full file system snapshot or backup taken after the attack (label it clearly as "compromised")
- Screenshots of defaced pages, spam content, or phishing pages
- Database dumps in their compromised state (clearly labelled)
Store these copies somewhere separate from your live server.
Report to the Relevant Canadian Authorities
- Canadian Centre for Cyber Security (CCCS / Cyber.gc.ca): Canada's national authority for cybersecurity. You can report incidents at cyber.gc.ca/en/incident-management. They provide free guidance and can escalate to law enforcement.
- Royal Canadian Mounted Police (RCMP) — National Division Cybercrime: If financial fraud or data theft is involved, file a report with the RCMP or your local police service. You can also report cybercrime through the Canadian Anti-Fraud Centre (CAFC) at antifraudcentre-centreantifraude.ca.
- Office of the Privacy Commissioner of Canada (OPC): If personal data was breached, PIPEDA requires you to notify the OPC and affected individuals of any breach that poses a "real risk of significant harm." Notification must happen "as soon as feasible." Quebec's Law 25 imposes even stricter timelines (72 hours to the Commission d'accès à l'information for serious incidents).
Step 3: Identify How the Attack Happened
Cleaning your site without understanding the entry point is the single most common reason sites get re-hacked within days. OWASP (the Open Web Application Security Project) consistently identifies the top attack vectors — and most compromised Canadian sites fall into predictable categories:
Check for These Common Entry Points
- Outdated CMS, themes, or plugins: The majority of WordPress hacks exploit known vulnerabilities in plugins or themes that have not been updated. Check your update history and cross-reference with the WPScan Vulnerability Database or NIST National Vulnerability Database (NVD).
- Weak or reused passwords: Brute-force and credential-stuffing attacks are rampant. Review your server authentication logs for repeated failed login attempts.
- Insecure file uploads: If your site accepts user-uploaded files, attackers may have uploaded a web shell (a script that gives them remote control). Look for
.phpfiles in upload directories like/wp-content/uploads/. - SQL injection or cross-site scripting (XSS): Review your access logs for unusual query strings containing characters like
',--,UNION SELECT, or<script>. - Compromised third-party service: A plugin, theme, or connected SaaS tool may have been the entry point. Check vendor security advisories.
- Stolen FTP or SSH credentials: Check whether the attacker accessed your server via FTP or SSH and from what IP address.
Use Log Analysis to Find the Attack Timeline
Open your access logs and look for the earliest signs of unusual activity — unfamiliar IP addresses, requests to admin pages from unknown locations, or large data transfers at odd hours. Tools like GoAccess (open source) can help visualise log files.
Step 4: Clean Your Website
Option A: Restore from a Clean Backup
If you have a verified clean backup taken before the compromise date:
- Verify the backup's integrity and confirm it predates the attack using your log analysis.
- Delete all current site files from the server — do not just overwrite, because malware can hide in directories that a simple overwrite misses.
- Restore the backup files via SFTP or your hosting control panel's restore tool.
- Restore the database from the clean backup.
- Immediately apply all available updates before bringing the site back online.
Important: If you cannot verify when the backup was taken relative to the attack, do not use it as your sole recovery method — it may already be infected.
Option B: Manual Cleaning
If no clean backup exists, or if you want to verify a restored backup is genuinely clean:
For WordPress Sites
-
Re-download WordPress core files from wordpress.org/download and replace all files in your root directory and
wp-admin/andwp-includes/folders. Do not replacewp-content/orwp-config.phpyet. -
Audit
wp-config.phpfor injected code — it should contain only database credentials, salts, and standard configuration. Regenerate your salts at api.wordpress.org/secret-key/1.1/salt/. -
Audit the
wp-content/directory: Remove all inactive themes and plugins. Re-download active plugins from wordpress.org/plugins or official sources and replace the plugin files. Check the/uploads/folder for.phpor.jsfiles that should not be there. -
Audit the database: Look for injected
<script>tags, base64-encoded strings, oreval()calls in post content, widget data (wp_optionstable), and user records. Use phpMyAdmin's search function or a WP-CLI command like:wp db search "<script" --all-tables
-
Check
.htaccess(Apache) for redirect rules you did not add. A clean WordPress.htaccessis short and well-documented on the WordPress Codex.
For Other CMS Platforms (Joomla, Drupal, Magento, etc.)
Follow the same principle: replace core files from official sources, audit configuration files, and scan the database for injected content. Each platform's official documentation provides canonical file lists.
Scan With a Reputable Malware Scanner
Do not rely on a single tool. Cross-check with two or more:
-
Sucuri SiteCheck (free, online): sitecheck.sucuri.net
-
VirusTotal (submit your URLs)
-
Wordfence (WordPress plugin with server-side scanning)
-
Maldet / Linux Malware Detect (LMD): A command-line scanner for Linux servers. Install it on your server and run a full scan:
maldet --scan-all /home/yourusername/public_html
-
ClamAV: Open-source antivirus for Linux servers. Run with:
clamscan -r /home/yourusername/public_html
Remove Backdoors
Attackers almost always plant backdoors — hidden files or injected code that lets them re-enter even after you change passwords. Common backdoor patterns include:
- Files named to mimic legitimate scripts (e.g.,
wp-logln.php,adminer.php) - PHP files in image directories (
/uploads/) - Obfuscated code using
base64_decode,eval,gzinflate,str_rot13, orpreg_replacewith the/emodifier - Modified legitimate files with injected code at the top or bottom, sometimes hidden with whitespace or null bytes
Search for these patterns using a server-side command (Linux):
grep -rl "base64_decode" /home/yourusername/public_html --include=".php" grep -rl "eval(" /home/yourusername/public_html --include=".php"
Investigate every result. Not all base64_decode or eval calls are malicious (some legitimate plugins use them), but each one needs to be verified.
Step 5: Harden Your Site Before Going Back Online
Restoring your site without hardening it is like mopping the floor without fixing the leaking pipe. CISA (the U.S. Cybersecurity and Infrastructure Security Agency) and the Canadian Centre for Cyber Security both publish hardening guides aligned on these fundamentals:
Apply All Updates
Update your CMS core, every plugin, every theme, and your server-side software (PHP version, MySQL/MariaDB, web server). Running PHP 7.4 or below is a significant risk — as of 2024, PHP 8.1+ is the recommended minimum supported version.
Implement Multi-Factor Authentication (MFA)
Enable MFA on your hosting control panel, your CMS admin login, and your domain registrar. For WordPress, plugins like WP 2FA or Google Authenticator (by miniOrange) add this reliably.
Install a Web Application Firewall (WAF)
A WAF filters malicious traffic before it reaches your site. Options include:
- Cloudflare (free tier available, widely used in Canada)
- Sucuri Firewall (paid, specialised for CMS sites)
- ModSecurity (open-source WAF module for Apache/Nginx, configured with OWASP Core Rule Set)
Restrict File Permissions
Overly permissive file permissions are a classic hardening failure. Recommended settings:
- Directories:
755(owner can write; group and public can read and execute) - Files:
644(owner can write; group and public can read) wp-config.php(or equivalent CMS config):440or400
Set these via SFTP client or with the command:
find /home/yourusername/public_html -type d -exec chmod 755 {} ; find /home/yourusername/public_html -type f -exec chmod 644 {} ;
Disable Directory Listing
Add the following to your .htaccess (Apache) to prevent attackers from browsing your file structure:
Options -Indexes
Limit Login Attempts
Use a plugin or server-level rule to block IP addresses after repeated failed login attempts. For WordPress, Limit Login Attempts Reloaded is a well-regarded option. At the server level, Fail2Ban can be configured to block brute-force attempts against SSH and web applications.
Implement a Content Security Policy (CSP)
A CSP HTTP header tells browsers which sources of content are trusted, reducing the risk of cross-site scripting (XSS) attacks loading malicious resources. Add it via your .htaccess or server configuration. The OWASP CSP Cheat Sheet is the definitive reference.
Set Up Automated Backups
Ensure you have a working, tested, off-site backup routine before you go live. Many Canadian hosting providers offer automated backups, but verify:
- Backups are stored off-server (not just on the same hosting account)
- You can actually restore from them (test this)
- Backups run at least daily
Step 6: Remove Google's Security Warnings
If Google flagged your site as dangerous, it will not automatically clear the warning after you clean the site. You must request a review.
- Log into Google Search Console (search.google.com/search-console).
- Navigate to Security & Manual Actions → Security Issues.
- Review the listed issues, confirm they are resolved, and click Request Review.
- Provide a brief explanation of what was compromised, what you cleaned, and what you hardened.
Google typically completes reviews within 1–3 days for straightforward cases, though complex situations can take longer. The warning will be removed once Google's reviewers confirm the site is clean.
Similarly, if your site was blacklisted by other services (McAfee SiteAdvisor, Norton Safe Web, Spamhaus, etc.), each has its own removal request process.
Step 7: Monitor Continuously Going Forward
Recovery is not a one-time event. The Canadian Centre for Cyber Security recommends ongoing monitoring as a baseline security practice.
- Set up Google Search Console alerts so you are notified of future security issues immediately.
- Install server-level monitoring: Tools like Auditd on Linux log file system changes, which can catch attackers modifying files.
- Use uptime and change monitoring: Services like UptimeRobot (free tier) alert you when your site goes down. Sucuri and Wordfence offer file integrity monitoring.
- Review logs regularly: Set a weekly reminder to scan your access and error logs for anomalies.
- Schedule penetration testing: For business-critical sites, commissioning periodic penetration tests by a qualified professional (look for OSCP-certified testers or firms certified under the CREST framework) is a worthwhile investment.
When to Hire a Professional
If you are not comfortable working in the server command line, if sensitive customer data has been stolen, if the attack is ongoing, or if you have tried cleaning the site and it keeps getting re-hacked, hire a professional incident response firm. Look for providers with:
- Demonstrated experience in web application security and CMS malware removal
- Familiarity with Canadian privacy law (PIPEDA, Quebec Law 25)
- Clear deliverables: a written report, not just "we cleaned it"
The Canadian Centre for Cyber Security maintains a list of qualified cybersecurity service providers at cyber.gc.ca. The CyberSecure Canada certification program also identifies trustworthy small-business-focused providers.
Frequently Asked Questions
How long does hacked website recovery take in Canada?
Recovery time depends on the severity of the compromise. A straightforward malware injection on a well-backed-up WordPress site can be resolved in a few hours. A complex attack involving database manipulation, multiple backdoors, and data theft can take several days — especially when legal breach notification obligations under PIPEDA or Quebec's Law 25 add administrative steps. Starting quickly always shortens total recovery time.
Do I legally have to report my website hack in Canada?
It depends on whether personal information was accessed or stolen. Under PIPEDA, Canadian private-sector organisations must report data breaches
