Smart Web Support logo Smart Web SupportPlain answers for keeping a small business website running
Security and Backups

What to Do in the First Hour After Your Site Is Hacked

A tailor in Dhanmondi rang me on a Thursday morning because his customers were seeing a page about cheap medicine instead of his shirt catalogue.

A laptop showing a hosting file manager sorted by modified date beside a phone displaying a browser malware warning

A tailor in Dhanmondi rang me on a Thursday morning because his customers were seeing a page about cheap medicine instead of his shirt catalogue. He had already done three things: deleted the plugins folder, changed his WordPress password, and restored the backup from the night before. All three felt sensible. Two of them made the cleanup harder and the third put the infection straight back on the server.

The first hour after you find out decides whether this costs you an afternoon or three weeks of lost search traffic. Almost nobody uses that hour well, because the instinct is to start deleting, and deleting is the one thing that should wait.

Why the obvious moves backfire

Restoring last night's backup is the most common mistake I see, and it is the most expensive. Infections sit quietly for weeks before they do anything visible. By the time a spam page appears in Google, the backdoor has usually been in your files for ten to thirty days, so the backup from last night contains it. You restore, the site looks clean for a day, and the same page comes back. I have watched an owner do that loop four times before calling anyone.

Deleting the suspicious files has a different problem. Those files tell you how the attacker got in, which plugin was outdated, and what else they touched. Delete them and you are left guessing, which usually means the hole is still open. A tailor reinfected within six hours twice because the original entry point was an old contact form plugin nobody had looked at.

The third instinct, changing the WordPress admin password, is correct and incomplete. It does nothing about active sessions, nothing about the hosting account, and nothing about a second administrator account the attacker created. Changing one password while four other doors stand open just makes you feel better.

The first hour, in order

Work through these in sequence. The whole list takes forty to sixty minutes on a small business site, less if your hosting panel is one you know.

  1. Take a copy of the site exactly as it is. Full file archive and a database dump, downloaded to your own machine and labelled with the date. This is your evidence and your safety net, and it costs five minutes.
  2. Write down what you can see and when. The spam page URL, the redirect destination, the warning in Google Search Console with its detection date, any email from the host. The detection date is what tells you which backup is safe to use later.
  3. Rotate the credentials that matter, not just the one. Hosting panel, SFTP or FTP users, the database user in wp-config.php, and every WordPress administrator. Then replace the authentication keys and salts in wp-config.php, which logs out every active session including the attacker's.
  4. Check the user list twice. Once in the WordPress dashboard and once in the database table directly, because some malware hides accounts from the admin screen. Look for administrators you do not recognise and for subscriber accounts created in the last month.
  5. Sort the files by date modified and look at the top. Core files that changed on a day you did nothing are the clearest signal you will get. Pay attention to index.php in the site root, the .htaccess file, wp-config.php, anything with a .php extension inside the uploads folder, and the mu-plugins folder, which is a favourite hiding place because it loads automatically and is empty on most sites.
  6. Decide whether to take the site offline. If it is serving malware or redirecting visitors, a maintenance page protects your customers and your search listing. If it is a hidden spam directory with no visible damage, leaving it up while you work is usually fine.
  7. Only now start removing anything. With a copy saved, a timeline written and the doors locked, deletion is safe.

If you keep a record of every change you make to the site, this is the moment it earns its keep, because you can compare the modified file dates against your own work. The habit is described in keeping a WordPress change log so fixes are reversible.

The counter-take: a scan is not a cleanup

The standard advice is to install a security plugin, run a malware scan, and delete what it flags. Every plugin vendor says so and it is the first result for every search on the subject. I use those tools weekly and I would still call that advice misleading.

A scanner compares your files against known bad patterns and against the official copies of WordPress core and of plugins from the directory. That works well for core files and for anything popular. It works badly for a custom theme, for a paid plugin the scanner has no reference copy of, and for freshly written code that matches no signature. The scan comes back clean and the site is not.

What works more reliably is replacement rather than inspection. Delete WordPress core entirely and reinstall it from a fresh download. Delete every plugin folder and reinstall each one from its source. Do the same with the theme if you can get an original copy. What you cannot replace wholesale is the uploads folder and the database, so those are the two places that need to be read by a human.

In the uploads folder, nothing should execute. Search it for files ending in .php.phtml or .shtml and treat every single one as hostile, because a legitimate plugin has no reason to put executable code among your product photos. In the database, the places worth checking by hand are the options table for injected script tags and the posts table for links to domains you do not recognise.

That approach takes longer than a scan and it finishes. A scan plus deletion often does not.

What it costs and when to hand it over

For a straightforward case, a site with twelve plugins and one entry point, I would budget three to five hours. The tedious part is not the cleanup, it is the verification afterwards: requesting a review in Search Console, waiting for the warning to clear, and checking the site daily for a fortnight.

Hand it to someone else when any of three things is true. You handle card payments or store customer records, in which case there are notification obligations and you want a documented cleanup. The site has been reinfected after you cleaned it, which means you missed the entry point. Or the host has suspended the account, since those conversations go faster when someone can describe exactly what was found.

Paid cleanup services have generally quoted me somewhere between a hundred and three hundred US dollars for a single small site, and many hosts sell a malware removal add on for less. For a shop whose site brings in orders, that is cheap compared with two more weeks of a browser warning in front of customers.

Once it is clean, the job that prevents the repeat is the boring one. Pick a backup that runs daily, keep at least thirty days of history so you have a copy from before the next infection, and store it somewhere that is not the same server. Then restore it once, deliberately, to prove it works, exactly as set out in testing a website backup by actually restoring it. The rest of the upkeep jobs sit in the security and backups section.

FAQ

How do I know when my site was first hacked?

The two usable sources are the detection date in Google Search Console and the file modification dates on the server. Hosting access logs help if your plan keeps them long enough, though many only hold a week or two, which is often shorter than the infection has been present.

Can I just restore a backup and move on?

Only if you are confident the backup predates the infection, which usually means going back several weeks rather than one night. Restoring a recent copy almost always brings the backdoor with it, and you lose the chance to find out how they got in.

Will changing my password fix a hacked WordPress site?

No. A password change does not remove files already on the server, does not end existing logged in sessions, and does not touch an extra administrator account the attacker created. It is one step of several, not the fix.

Should I take the site offline while I clean it?

Put up a maintenance page if visitors are being redirected or shown a malware warning, since that protects both your customers and your reputation. For a hidden spam directory with no visible effect, working on the live site is normally acceptable.

FK
Farzana Kabir

Farzana has looked after WordPress sites for clinics, tailors and small shops in Dhaka for nine years, and writes about the upkeep jobs owners skip until something breaks.

More posts by Farzana

More from the blog

01doorganico 084goad 3hot8 4465456 after5internprogram ahandfulofblessings ahmadpc ahomcybersecurity allodialresources annodex antiquesandperiodcollectibles aotc asianworldkashmir beedlectrics bloggertemplatefree bluefeatheragency bodyweightsolution campaign08blog carfixadvisor catstreetcollective cbstvsports cnfanspurchasing committeeof500yearsofdignityandresistance covertopsdjs cs-kaiyuangame cuestacomunicaciontotal cxoutlet dancebetgame deskgearhub destinyvillastay detectmagazine di33 diamondsteelbuildings donmo dyanadropship emarsysfinance emimattl escapechan eskitarih evautoplay everythingweddings-orlando farmzone feedviewerapp foxstudiosscratch gamevui123 gleasongrade greetingsday hacklabasu haskell iw-kaiyun jagoanproperti jilidskripsi joltbusinessfinance juegodepokergratis juegospucca kaeru-festival latestmehndidesigns lestanzediottaviano litemagazines localcommunityhero lustrsazan mariashebets menswheels newwebstechs1 nikkit ootheday oxigenvpn plurfitness prefetial probudgetcarpetcleaning psychicmrsmartin pyaten qvantor rejoignezlogis rexzbot riselayouts ruchin rwxqsgd5 sakaltime shibiaowang shop-bot skrtips spotlesshaven strcoding tetapatrium topselller uneplanteartificielle vipertechcr webtech1223411 wo-kygaming yamaha-mekar yeknava yoybuysheets zenunwa yamaha-mekar jilidskripsi ankertoto ankertoto ankertoto