Skip to content

Detecting and Removing Hacks and Malware

A practical guide to detecting and removing a hack on your site: signs of infection, scanning tools, isolating the site and taking a backup, checking files and the database, removing malicious code or restoring from a clean backup, closing the entry hole, resetting all credentials, getting the Google warning lifted, and hardening the site to prevent another hack.

Securityخالد الراشد31 min read
Illustration of a magnifier revealing a bug on a code page and moving it to quarantine, representing detecting and removing malware
On this page

Discovering that your site has been hacked is an alarming moment, but panic is the worst thing you can do. Deleting files at random, hastily restoring an old backup, or changing a single password and relaxing are all mistakes that prolong the disaster instead of ending it. A successful hack leaves more than one trace behind: code injected into legitimate files, hidden backdoors that reopen the way in, planted admin accounts, and scheduled tasks that re-plant the infection after every cleanup. Dealing with this requires an organized response plan that separates three distinct tasks: containing the damage, investigating its cause, then recovering and closing the hole. This reference guide takes you through these stages in the right order, with diagnostic tables, ready-to-use scanning commands and checklists. Read it through first to understand the logic, then use it as a work list to apply to your site step by step. And if your site is not infected yet, this is the best time to read it: prevention is far cheaper than cure.

The hack response and malware removal cycle1 · DetectSymptoms or a security scan2 · Isolate + back upMaintenance mode + evidence backup3 · Full scanFiles + database4 · Clean/restoreRemove malware or use a clean backup5 · HardenClose the entry hole + passwords6 · MonitorPrevent a repeatDon't just clean — close the entry hole or the hack will return
The hack response cycle: detect > isolate and back up > full scan > clean or restore cleanly > harden and close the entry hole > monitor to prevent a repeat.

How do you know your site has really been hacked?

Before any cleanup, you need to confirm that there is an infection and determine its nature. Some symptoms are explicit and unmistakable, while others are hidden and appear only under certain conditions, such as a redirect that shows up only for visitors coming from Google search results, not when you type the address directly. A skilled attacker deliberately uses this kind of camouflage so the site looks normal to its owner for as long as possible. That is why you should not rely on your own browsing alone; check from several angles: a private browser window without being logged in, a mobile device, and a search engine.

Common signs of infection

The following table links the main signs to what they usually mean, so you can read the symptoms quickly and direct your scan:

SignWhat it usually meansWhere to check
A browser warning: "Deceptive/dangerous site"Listed by Google Safe BrowsingOpen the site in Chrome/Firefox
A warning in Google Search ConsoleMalware or hacked content detectedThe "Security issues" section
Redirects for search visitors onlyAn injected redirect conditional on the referrerVisit via a search result
Strange spam pages or postsInjected content (pharma, gambling, counterfeits)A site: search on Google
Sudden slowness or high CPU loadCryptomining or the server being used in an attackThe hosting panel/process monitoring
A message from your hosting providerMalicious activity or outgoing spam detectedYour email + the hosting panel
Admin accounts you did not createA backdoor with full privilegesThe user list
Recently modified files you never touchedInjected code or a web shellFile manager/SSH
The site's email goes to spam for everyoneThe server is being used to send spam + a blacklistA send test + blacklist tools
Garbled Google search results for your addressInjection into page titles/descriptionsA site: search

Confirming the infection before cleaning

Before you start, establish the facts. Record exactly what you saw: the symptom, when it first appeared and on which pages. Use a neutral external scanning tool (one that scans the site as a visitor sees it) to confirm an injection or a blocklist listing. Check Google Search Console and your Bing Webmaster account. And examine the access logs in your hosting for suspicious requests or an unusual spike. This documentation is not bureaucracy: the date of the first infection will determine which backup is still clean, and the request pattern may reveal the entry hole early on.

What types of malware infect websites?

Not all infections behave the same way. Understanding the type of malware determines where you look and how you clean. Some lives in the files, some in the database, and some spreads across both and re-plants itself through a scheduled task. The following table summarizes the most common types:

TypeWhat it doesWhere it usually hides
Code injectionInserts malicious PHP/JS code into legitimate filesTheme headers, plugin files, functions.php
BackdoorReopens the attacker's access after cleanupFiles with misleading names, the uploads folder, wp-config
Malicious redirectSends the visitor to a fraudulent site.htaccess, the theme header, the database
Ad/link injection (spam/SEO)Injects hidden spam links or pagesThe posts and options tables in the database
PhishingPlants pages impersonating banks/services to steal dataHidden subfolders inside the site
CryptominerConsumes server resources for hidden miningScheduled scripts, JS code on the front end
Card skimmerIntercepts payment data on checkout pagesJS code on the checkout page/in the database
Web ShellA full browser-based control interface for the serverA standalone PHP file with a random name

The key difference between these types is that some are visible and annoying (page defacement, pop-up ads) while others are silent and profitable for the attacker (card skimming, mining, phishing). The silent ones are the most dangerous because they last longer, so don't settle for fixing what you can see; always assume there is an accompanying backdoor until proven otherwise, because backdoors are the number one reason a hack returns after a seemingly successful cleanup.

What are the response steps, in the right order?

The order is not a detail; it is the essence of success. Each step paves the way for the next, and doing one before another can undo all the work. The following table summarizes the complete sequence, and then we detail each stage in its own section:

OrderStepGoalCommon warning
1Confirm and document the infectionKnow its type and extentDon't clean before you understand
2Isolate the site (maintenance mode)Stop the damage and protect visitorsDon't let it keep serving infected pages to visitors
3Take a full backup as evidencePreserve the state before making changesEven the infected copy is useful for analysis
4Full scan (files + DB + cron + .htaccess + users)Identify every infected locationDon't stop at the files alone
5Manual cleanup or a clean restoreRemove all malicious codeA clean restore is usually safer
6Close the entry holePrevent a return through the same doorWithout it, the hack recurs immediately
7Reset all credentials and keysInvalidate any stolen accessThorough: WP, DB, hosting, FTP and salts
8Get delisted by Google and blacklistsRestore trust and trafficOnly after confirming the site is fully clean
9Harden to prevent a repeatRaise the cost of the next hackSecurity is a process, not a one-off task

Steps 1–2: confirm, then isolate

Once the infection is confirmed, isolate the site immediately. Isolation serves two purposes: it prevents further damage (more planted files, spam being sent, visitors being infected), and it protects you from worsening blocklist listings. Put the site into maintenance mode or take it offline temporarily at the server level. If it is a commercial site, temporary isolation is cheaper than leaving an infected checkout page stealing your customers' cards. And if you are on shared hosting and your host notified you of the infection, coordinate with them, since isolating some paths may be necessary to protect the other accounts on the same server.

Step 3: take an evidence backup before any change

Before you delete a single character, take a full backup of the current state, files and database together, and store it in isolation, away from the clean backups. This infected copy is valuable: it reveals how the attacker got in and what they planted, allows comparison with a clean copy later, and helps if you need an expert or a legal report. Don't restore over it, and don't trust it as a working copy; treat it as evidence only. Name it clearly and include the date it was taken.

How do you scan your site thoroughly?

An incomplete scan is worse than no scan, because it gives you false reassurance. A single infection can spread across the files, the database and scheduled tasks at the same time, and cleaning one place while leaving another means an immediate return. Check all of the following places without exception.

Available scanning tools

A variety of tools reveals what a single tool misses. The following table compares the common categories:

Tool/categoryHow it worksEspecially good at detectingNote
Sucuri SiteCheckAn external scan from the visitor's sideVisible injections and blocklist listingsFree, superficial (cannot see the files)
Wordfence ScanAn internal scan that compares against the original core filesFile modifications and backdoorsStrong at detecting WordPress injections
MalCare / Imunify360A deep server-side scan + cleanupComplex account-level infectionsUsually through your hosting
VirusTotalScans a URL/file with dozens of enginesConfirms the reputation of a file or addressFor confirmation, not a full scan
Server scan (SSH commands)Manual search for suspicious patternsWhat ready-made tools missRequires experience and caution
Google Search ConsoleThe "Security issues" reportGoogle's view of the siteWhere you request delisting later

Common hiding places

Know the map of hiding places so you know where to direct your scan. The following table lists the recurring locations:

LocationWhat is usually planted thereHow to check
Modified core filesInjections into the original WordPress filesCompare with a clean copy of the same version
The uploads folder wp-content/uploadsMalicious PHP files (which should not be there)Search for any .php inside it
functions.php and the theme headerRedirect code or ad injectionCheck the beginning/end of the file
The .htaccess fileMalicious redirect rulesOpen it and review every line
The database (wp_options, wp_posts)Hidden links/scripts and redirectsSearch the tables for suspicious patterns
Scheduled tasks (Cron / WP-Cron)Re-planting the infection periodicallyReview the scheduled tasks
UsersA planted admin accountReview the user list and roles
Standalone files with random namesA web shell or backdoorSearch for recent, unfamiliar files

Scanning files for suspicious patterns

Over SSH, you can search for the functions that are common in malicious code (used to obfuscate its content and execute it). These commands are read-only diagnostics: they identify candidates for manual review and delete nothing. Remember that the presence of these functions does not necessarily mean an infection (some legitimate plugins use them), so review each result yourself before taking any action:

bash
# Search for commonly abused functions (candidates for review only)
grep -rEn "base64_decode|eval\(|gzinflate|str_rot13|assert\(|create_function" /path/to/site/

# PHP files inside the uploads folder — they should not be there at all
find /path/to/site/wp-content/uploads/ -type f -name "*.php"

# Files modified in the last 7 days (compare with when you last touched the site)
find /path/to/site/ -type f -name "*.php" -mtime -7

# Very recent files that may have been planted during the hack
find /path/to/site/ -type f -mtime -2 -ls

Comparing files with a clean copy

The most powerful way to detect injections in core and plugin files is to compare them (diff) with an original clean copy of exactly the same version, downloaded from the official source. Any difference in files that are supposed to be unchanging is a warning sign:

bash
# Download the official core for the same version into a separate folder, then compare
diff -rq /path/to/clean-core/ /path/to/site/ | grep -E "differ|Only in /path/to/site"

# Inspect a specific suspicious file before any decision
diff /path/to/clean-core/wp-settings.php /path/to/site/wp-settings.php

Scanning the database and scheduled tasks

The database is an often-overlooked hiding place. Search the wp_options table (especially values such as siteurl and home, which can be injected) and wp_posts for scripts, iframe elements or hidden external links. And review scheduled tasks carefully: a malicious cron job can re-plant everything an hour after your cleanup. Check both the server's cron and WordPress's internal scheduler (WP-Cron):

bash
# Server cron jobs for the current user (review any unfamiliar line)
crontab -l

# System scheduled tasks (review them read-only)
ls -la /etc/cron.* 2>/dev/null

# Via WP-CLI: list the scheduled tasks in WordPress
wp cron event list

How do you clean the site: manual cleanup or a clean restore?

You have two paths, and each has its place. But the general rule for most site owners is clear: restoring from a trusted clean backup taken before the hack is the safest and fastest option. Manual cleanup is precise but carries the risk of leaving a single backdoor behind that undoes all the effort. The following table weighs the two:

CriterionRestoring from a clean backupManual cleanup
Safety from infection remnantsHigh (it replaces everything)Depends on your accuracy (risk of a remaining backdoor)
SpeedFast if a sound backup is availableSlow and requires experience
Loss of recent contentPossible (anything after the backup date)Usually no loss
Experience requiredLowHigh
Best forMost sites that have sound backupsNo clean backup, or a limited, known infection

Choose a backup that you are confident predates the first infection (this is where the documentation from step 1 proves its value). Remember that a silent hack can go unnoticed for weeks, so don't settle for the latest backup; go back to the earliest point you trust to be clean. Restore the files and the database together. And before putting the site back online, update everything (core, plugins and themes), close the hole and reset the credentials; otherwise you are restoring the very open door the attacker came in through. As for content published after the backup date, re-enter it manually after checking it, not through a partial restore that may bring the infection back.

The manual path: when, and why to be careful

You resort to manual cleanup if you have no trusted clean backup, or if the infection is limited and its location is fully known. Its foundation is replacement, not patching: replace the core, plugin and theme files with complete original copies from the official sources instead of trying to "fix" the injected files line by line. As for files with no official replacement (such as wp-config.php and the database), clean them very carefully after understanding every change. The governing rule: don't declare success until you are sure every backdoor and malicious scheduled task has been removed, since they are the main cause of reinfection. At the slightest doubt, go back to the clean-restore path.

How do you close the entry hole?

This step is the difference between a lasting fix and an inevitable return. Cleanup removes the symptoms; closing the hole removes the cause. If you clean without knowing how the attacker got in, you are just waiting for them to come back. Identify the entry vector and close it before putting the site back online. The following table lists the most common vectors and how to close them:

Entry vectorHow it is exploitedHow to close it
An outdated plugin/theme with a vulnerabilityExploiting a published vulnerability before the updateUpdate immediately or remove the affected component for good
A pirated (nulled) plugin/themeComes injected with malware from the moment it is installedDelete it and replace it with an official copy
A weak/leaked passwordAutomated guessing or credential stuffingStrong, unique passwords + 2FA + limited login attempts
Lax file permissions (777)Any process can write and inject codeSet 644 for files and 755 for folders
An unsanitized file uploadUploading a web shell through an exposed formBlock PHP execution in the uploads folder + update
An outdated PHP/server versionExploiting a server-level vulnerabilityUpdate the PHP version and the software
Contaminated shared hostingInfection from another account on the same serverIsolate the account + coordinate with the host
An exposed wp-config or other sensitive fileReading the database credentials and keysRestrict access + tighten permissions

Diagnosing the vector starts with the evidence you collected: the date of the first infected file, the access logs around that time, and the component where the infection was concentrated. If all the injected files belong to a particular plugin, it is the prime suspect. If the injection was preceded by a flood of login attempts in the logs, the vector is most likely a password. Don't guess and move on; the point you don't close is the one they come back through. And if you use cPanel, see the guide to securing cPanel, since the vector may be at the account level, not in WordPress alone.

How do you reset all credentials and keys?

Assume that all credentials are exposed, because they most likely are. An attacker who reached your files has seen wp-config.php and everything in it: the database name, its password and the encryption keys. Changing the WordPress password alone is not nearly enough. Reset everything, in this order, to avoid breaking the connection between the site and its database:

  1. WordPress keys and salts: generate new values from the official generator and put them in wp-config.php. This invalidates all active sessions immediately, so the attacker is kicked out even if they are logged in.
  2. The passwords of all users: especially administrators. Force a full reset, and don't stop at your own account.
  3. The database password: change it from the hosting panel, then update the value in wp-config.php to match.
  4. Hosting/cPanel credentials: the main account password and the control panel.
  5. FTP/SFTP and SSH accounts: change their passwords or delete any you don't recognize, and regenerate SSH keys.
  6. API keys and any external secrets: payment gateways, email services, cloud storage; any of them may have leaked.

And most importantly after the reset: review the user list and delete any admin account you did not create. Backdoors are not only files; a planted admin account is a backdoor with full privileges, and it may be hidden from the usual list view, so check at the database level if necessary.

How do you get delisted by Google and blacklists?

If Google has flagged your site as a "deceptive site" or a warning appears in the browser, traffic collapses even after cleanup, because the listing is not lifted automatically. You need to request a review, but only after you are completely sure the site is clean, because a review request for a site that is still infected is rejected and delays the process. Follow these steps:

  1. Confirm the site is completely clean: rescan it with more than one tool, and make sure the files, the database and scheduled tasks are free of any remnants.
  2. Request a review in Google Search Console: in the "Security issues" section, explain what you found and how you cleaned it, then request a review.
  3. Do the same in Bing Webmaster Tools if your site is listed there too.
  4. Request removal from other blocklists: some services list infected domains independently of Google; check with reputation lookup tools and submit a removal request to each one.
  5. Deal with email spam: if your server was sending spam, your domain may be listed on email blacklists. After stopping the source, request removal and enable SPF, DKIM and DMARC records to restore your sending reputation.

The review can take anywhere from hours to days. Don't submit repeated requests in a hurry, as that can delay it. Make sure the cleanup is airtight the first time.

How do you harden the site to prevent another hack?

Cleanup takes you back to square one; hardening keeps you from ending up there again. A site that has been hacked once is a tempting target for repeat attempts, because attackers keep lists of sites they have already compromised. Build stacked layers of defense, each of which buys time and raises the cost of a hack.

WordPress security layers (defense in depth)Automatic backupsRegular updates (core/plugins/themes)Firewall / WAFStrong login + two-factor authSSL / HTTPSWordPress coreEach layer reduces risk — don't rely on just one
Layered defense for WordPress: backups, updates, a WAF, strong login + 2FA, and SSL/HTTPS around the core.

The essential layers of protection

The following table summarizes the pillars of hardening after cleanup:

LayerWhat it doesPriority
Regular updatesCloses vulnerabilities before they are exploitedCritical
Two-factor authentication (2FA)Makes a stolen password worthlessCritical
WAF firewallBlocks the attack before it reaches the siteHigh
Strong, unique passwordsDefeats guessing and reuseHigh
Correct file permissions (644/755)Prevents code injectionHigh
Principle of least privilegeLimits the damage from any compromised accountMedium
Blocking PHP execution in the uploads folderDisables an uploaded web shellMedium
File integrity monitoringDetects injections earlyMedium
Tested off-site backupsThe last safety netCritical

Updates alone close off the source of most hacks, because most infections exploit known vulnerabilities in outdated plugins and themes. Enable automatic updates for security fixes, and delete (don't just deactivate) every component you don't use. Two-factor authentication, meanwhile, is the strongest single layer because it defeats the most common entry vector: signing in with a stolen or guessed password. For the full details of hardening WordPress, see the guide to securing a WordPress site, and for the encryption that protects credentials in transit, see installing an SSL certificate and enabling HTTPS.

Backups as a recovery plan

The most important lesson from this whole experience: a clean backup would have turned the disaster into a passing incident. Adopt the 3-2-1 rule (three copies, on two media, one off-site), and automate backups so they are uploaded automatically to external storage separate from the server. Most importantly, keep a chain of backups going back several weeks, because a silent hack sometimes means the latest backup is infected and you need an older clean restore point. And test restores regularly: a backup that has never been test-restored = no backup.

Three layers of safe backupsSnapshotOff-siteApplicationInfra snapshotFull off-site copyApplication copyFast restoreOf the whole serverProtects againstServer failureFiles + databaseKept separately
Three layers of protection: a fast snapshot, a full copy off the server (off-site), and an application/database-level copy.

For network-level protection before traffic reaches your server, a cloud CDN/WAF layer adds an important defense against automated attacks and distributed denial-of-service attacks. See DDoS protection to understand this layer and how it complements WordPress hardening.

Protection layers at the CDN edgeVisitor(or attack)DDoS protectionWAFEdge cacheHidden originIP not exposedMalicious traffic is blocked at the edge before reaching the server
Edge security: traffic passes through DDoS protection, then the WAF, then the cache, so malicious traffic never reaches the origin hidden behind the CDN.

The post-cleanup checklist

Before you declare the site clean and secure, review every item:

ItemRequired state
Confirm removal of all injected files and backdoors✓ Confirmed with more than one tool
Check the database for hidden injections✓ Clean
Review scheduled tasks (cron + WP-Cron)✓ No malicious tasks
.htaccess reviewed and clean✓ No malicious redirects
Delete any planted admin accounts✓ Done
Close the entry hole (update/delete/fix)✓ Closed
Reset all passwords✓ Thorough (WP/DB/hosting/FTP)
Generate new salts and keys✓ Updated
Full updates (core/plugins/themes)✓ Latest version
Google review request/blacklist removal✓ Submitted after cleanup
Enable 2FA + WAF + off-site backups✓ Enabled
Test a backup restore✓ Successful

Common problems and fixes after cleanup

Even after careful work, leftover problems may appear. The following table links the symptoms to their causes and fixes:

ProblemLikely causeFix
The hack returns within daysA backdoor or cron job that was not removedDeep scan + clean restore + remove every malicious cron job
The "deceptive site" warning remainsDelisting was not requested, or infection remnants remainConfirm the site is clean, then request a review
Spam pages still appear in search resultsA database injection that was not cleanedClean the tables + request reindexing
The site's email goes to spam for everyoneListed on email blocklistsStop the source + request removal + SPF/DKIM
Persistent slowness/high loadA leftover mining script or a malicious cron jobReview processes and scheduled tasks
Unable to log in to the dashboard after cleanupNew salts invalidated the session (normal)Log in again with the new credentials
A "mixed content" warning after the restoreLeftover http:// linksFix the links and force HTTPS

When should you call in a professional?

Not every hack is one you should handle yourself, and there is no shame in asking for help. Use a specialized cleanup service or a security expert if any of the following applies: the site is commercially sensitive (a store that processes payments or holds customer data), the infection is complex and keeps coming back despite your efforts, you lack the technical experience to work safely with SSH and the database, or the time window is tight and leaves no room for trial and error. Many hosting companies offer managed scanning and cleanup (sometimes through server-level tools such as Imunify360), which is a fast, reliable option if you are not sure. A professional's fee is usually far lower than the cost of a commercial site staying infected or getting hacked again and again.

Expert tips for a cleaner response

Once you have mastered the basics, raise your readiness with these practices:

  • Document everything during the response: the symptoms, the dates, the infected files and the steps taken. This speeds up any later investigation and helps if the incident recurs.
  • Always work on a copy: carry out the cleanup and any experiments in an isolated staging environment before touching the live site, whenever possible.
  • Assume there is a backdoor until proven otherwise: it is the main reason a hack returns. Don't declare success until you are sure it has been removed.
  • Monitor file integrity going forward: a tool that alerts you as soon as any core file is modified catches the next infection in its first hours.
  • Monitor for at least two weeks after cleanup: scan daily and review the logs. Many leftover infections show up within this window.
  • Restrict PHP execution where it is not needed: blocking PHP execution in the uploads folder disables any uploaded web shell even if it gets there.

Conclusion

A hacked site is not the end of the world, but handling it the wrong way can drag it out indefinitely. The golden rule is the order: confirm > isolate and take an evidence backup > scan every location > clean or restore from a clean backup > close the entry hole > reset all credentials and keys > get delisted by Google > harden to prevent a repeat. The fatal mistake is jumping to a restore before closing the hole, or declaring success before confirming that every backdoor and malicious scheduled task has been removed. Above all, remember that the best response to a hack is for it never to happen: regular updates, two-factor authentication, a firewall, correct permissions and tested off-site backups; these layers are the difference between a site that holds up and a site that gets hacked again and again. Apply the checklist, keep monitoring after cleanup, and make security part of your site's routine, not a reaction after it is too late.

Frequently asked questions

How can I tell quickly that my site has been hacked? The main signs: a browser or Google warning about a "deceptive/dangerous site," strange redirects for visitors (especially those coming from search results), spam pages or posts appearing, unexplained slowness or high CPU load, a message from your hosting provider, admin accounts you did not create, or your site's email landing in spam. Confirm the suspicion with a neutral external scanning tool and with the Google Search Console report before you start any cleanup.

Should I delete the site and start over right away? Don't rush. Before deleting anything, isolate the site and take a full backup as evidence, because it reveals how the attacker got in and helps prevent a repeat. Then restore from a clean backup taken before the hack instead of rebuilding from scratch, whenever one is available. Most importantly, don't restore before closing the entry hole, or the hack will happen again immediately.

Which is safer: manual cleanup or restoring from a backup? For most site owners, restoring from a trusted clean backup taken before the hack is the safest and fastest option, because it replaces everything and reduces the risk of a backdoor remaining. Manual cleanup is more precise but carries the risk of leaving a single malicious file behind that undoes all the effort; it is suitable when you have no clean backup or when the infection is limited and its location is fully known.

Why does the hack come back after I cleaned the site? The most common cause is a backdoor that was not removed, a scheduled task (cron) that re-plants the infection, or the original entry hole being left open so the attacker came back through it. The fix is a deep scan covering the files, the database and all scheduled tasks, a complete clean restore, and actually closing the hole before putting the site back online.

Is changing the WordPress password enough? Not at all. An attacker who reached your files has seen wp-config.php with all its secrets. Reset everything: the passwords of all users, the database, the hosting/cPanel, FTP/SSH, API keys, and generate new salts in wp-config.php to invalidate all active sessions immediately and kick the attacker out even if they are logged in.

How do I get Google's "deceptive site" warning removed? Once you are completely sure the site is clean (files, database and scheduled tasks), go to the "Security issues" section in Google Search Console and request a review, explaining what you found and how you cleaned it. Don't request a review for a site that is still infected, or it will be rejected and delayed. The review can take anywhere from hours to days.

Where does malicious code usually hide? Usually in several places at once: modified core files, PHP files planted in the uploads folder, functions.php and the theme header, the .htaccess file (redirects), and inside the database (the options and posts tables), plus scheduled tasks that re-plant the infection. That is why a thorough scan of all these places is essential; cleaning one place and leaving another means an immediate return.

Do scanning tools detect every infection? No tool is perfect. An external scan (such as Sucuri SiteCheck) detects visible injections and blocklist listings but cannot see the files. An internal scan (such as Wordfence) compares against the original core files and detects modifications and backdoors. It is best to combine more than one tool with a manual review and a comparison of the files against a clean copy, because what one tool misses another may catch.

Can an infection spread between sites on shared hosting? Yes, and it is a real risk. On shared hosting, a hack can spread between accounts on the same server if permissions or isolation are weak. If you suspect this, coordinate with your hosting provider to isolate your account and scan the other sites, and move critical sites to an isolated environment (such as a VPS) to prevent cross-contamination.

How long does it take to clean a hacked site? It varies a lot: a simple infection with a clean backup ready can be resolved in an hour or two (restore + close the hole + reset credentials). A complex infection spread across the files, the database and scheduled tasks, or the lack of a clean backup, can take hours to days. Don't rush at the expense of accuracy; an incomplete cleanup means the hack returns and the process starts all over again.

When should I call in a security expert instead of handling it myself? If the site is commercial and processes payments or stores customer data, if the infection keeps coming back despite your efforts, or if you lack the experience to work safely with SSH and the database. Many hosting companies offer a fast, reliable managed cleanup service. A professional's fee is usually far lower than the cost of a site that stays infected or keeps getting hacked again.

Sources

Frequently asked questions

How can I tell quickly that my site has been hacked?

The main signs: a browser or Google warning about a "deceptive/dangerous site," strange redirects for visitors (especially those coming from search results), spam pages or posts appearing, unexplained slowness or high CPU load, a message from your hosting provider, admin accounts you did not create, or your site's email landing in spam. Confirm the suspicion with a neutral external scanning tool and with the Google Search Console report before you start any cleanup.

Should I delete the site and start over right away?

Don't rush. Before deleting anything, isolate the site and take a full backup as evidence, because it reveals how the attacker got in and helps prevent a repeat. Then restore from a clean backup taken before the hack instead of rebuilding from scratch, whenever one is available. Most importantly, don't restore before closing the entry hole, or the hack will happen again immediately.

Which is safer: manual cleanup or restoring from a backup?

For most site owners, restoring from a trusted clean backup taken before the hack is the safest and fastest option, because it replaces everything and reduces the risk of a backdoor remaining. Manual cleanup is more precise but carries the risk of leaving a single malicious file behind that undoes all the effort; it is suitable when you have no clean backup or when the infection is limited and its location is fully known.

Why does the hack come back after I cleaned the site?

The most common cause is a backdoor that was not removed, a scheduled task (cron) that re-plants the infection, or the original entry hole being left open so the attacker came back through it. The fix is a deep scan covering the files, the database and all scheduled tasks, a complete clean restore, and actually closing the hole before putting the site back online.

Is changing the WordPress password enough?

Not at all. An attacker who reached your files has seen wp-config.php with all its secrets. Reset everything: the passwords of all users, the database, the hosting/cPanel, FTP/SSH, API keys, and generate new salts in wp-config.php to invalidate all active sessions immediately and kick the attacker out even if they are logged in.

How do I get Google's "deceptive site" warning removed?

Once you are completely sure the site is clean (files, database and scheduled tasks), go to the "Security issues" section in Google Search Console and request a review, explaining what you found and how you cleaned it. Don't request a review for a site that is still infected, or it will be rejected and delayed. The review can take anywhere from hours to days.

Where does malicious code usually hide?

Usually in several places at once: modified core files, PHP files planted in the uploads folder, functions.php and the theme header, the .htaccess file (redirects), and inside the database (the options and posts tables), plus scheduled tasks that re-plant the infection. That is why a thorough scan of all these places is essential; cleaning one place and leaving another means an immediate return.

Do scanning tools detect every infection?

No tool is perfect. An external scan (such as Sucuri SiteCheck) detects visible injections and blocklist listings but cannot see the files. An internal scan (such as Wordfence) compares against the original core files and detects modifications and backdoors. It is best to combine more than one tool with a manual review and a comparison of the files against a clean copy, because what one tool misses another may catch.

Can an infection spread between sites on shared hosting?

Yes, and it is a real risk. On shared hosting, a hack can spread between accounts on the same server if permissions or isolation are weak. If you suspect this, coordinate with your hosting provider to isolate your account and scan the other sites, and move critical sites to an isolated environment (such as a VPS) to prevent cross-contamination.

How long does it take to clean a hacked site?

It varies a lot: a simple infection with a clean backup ready can be resolved in an hour or two (restore + close the hole + reset credentials). A complex infection spread across the files, the database and scheduled tasks, or the lack of a clean backup, can take hours to days. Don't rush at the expense of accuracy; an incomplete cleanup means the hack returns and the process starts all over again.

When should I call in a security expert instead of handling it myself?

If the site is commercial and processes payments or stores customer data, if the infection keeps coming back despite your efforts, or if you lack the experience to work safely with SSH and the database. Many hosting companies offer a fast, reliable managed cleanup service. A professional's fee is usually far lower than the cost of a site that stays infected or keeps getting hacked again.