Skip to content

Website or application hacked: the first steps

Google suddenly shows pages under your domain with products you have never sold. Visitors end up on someone else’s website, or your hosting provider has suspended your hosting because spam is being sent from it. The first impulse is to delete everything and restore a backup. That is exactly what often makes things worse: the traces are gone, the hole stays open, and the attacker gets back in the same way. The first hours decide how clean your website or application is afterward.

By Dimitri König9 min read

How you notice a hack of your website

A hack of your website or application usually comes to light in roundabout ways, because attackers rarely announce themselves:

  • Unknown pages in Google. A search for site:yourdomain.ch shows pages with medication, branded goods or gambling that you never created. Often only Google and visitors coming from search get to see these pages, not you when you visit the site directly.
  • Redirects. Visitors end up on someone else’s website, sometimes only on their phone or only on their first visit.
  • Warnings. Google flags your website in the search results as possibly hacked, or the browser shows a red warning page. The “Security issues” report in Google Search Console lists what Google has found.
  • Suspended hosting or email. Your hosting provider has found malicious code or noticed spam sent through your server.
  • Unknown accounts and files. An admin account nobody created, PHP files in the upload folder, files with a recent modification date, new cron jobs.
  • Unusual load and costs. The server runs at its limit all the time, or the bill from the cloud platform or the AI service keeps rising because someone is using your computing power or your API keys.
  • Data anyone can read. With apps built on Supabase or Firebase, it’s often not a break-in in the classic sense: the database access rules allowed too much from the start.

Not every disruption of a website is a hack. On a large TYPO3 website I took over, the login was broken, and a hack seemed the obvious suspect. The cause was the login itself, which ran through the customer’s ERP, not an attack. That’s why the logs come first, then the verdict. If your application only shows errors or a blank white page, the article Getting your web application running again is more likely to help.

The first hours after a hack: what to do right away

  1. Delete nothing. Every deleted file and every overwritten log will be missing later, when searching for the way in.
  2. Preserve the current state. A copy of the files, the database and the server logs, stored off the server. Many hosting providers keep access logs only for a limited time. Add screenshots of what you see, with date and time.
  3. Lock and change access. From a device you know is clean: hosting account, SFTP or FTP, SSH, database, the application’s admin accounts, email accounts and API keys for payment providers, email delivery, cloud and AI services. Deactivate unknown admin accounts instead of deleting them. Wherever possible, turn on two-factor authentication.
  4. Inform your hosting provider. Your hosting provider sees access at server level, has dated backups and can suspend individual services if needed. Ask for the logs and for the backups from the last few weeks.
  5. Limit the damage. If your website redirects visitors, spreads malicious code or sends spam, replace it with a maintenance page. For a shop, check whether the checkout has been tampered with. If payment data could be affected, inform the payment provider.
  6. Don’t just overwrite. Don’t restore a backup or “reinstall everything” before the current state is preserved and the way in is known.

Who is responsible for which part after a hack, the hosting provider, your former developer or you, is covered in the article Who is responsible: hosting provider, developer or you? If your developer can’t be reached and the access is in their name, the immediate actions when the developer can’t be reached help.

Why “just set it up again” often isn’t enough after a hack

An attacker who got into a website once makes sure they can come back. According to Sucuri’s report on 2023, 49 percent of the websites they cleaned up had at least one back door: a hidden file or a piece of code that keeps access open. A freshly installed website with the old data, the old theme or the old backup can bring that back door right back in.

When a hacked website is set up again, the vulnerability itself also remains a risk. According to Sucuri’s report on 2023, 39.1 percent of infected CMS websites were out of date at the time of infection. If the hole is still there after setting things up again, the attacker gets back in the same way.

How the cleanup of a hacked website works

  • Comparison with the original. Core and packages are checked against the official versions, for WordPress with wp core verify-checksums, for projects with Composer or npm through a clean reinstall from the lock file. Custom code is compared with the state in the Git repository. If there isn’t one, the oldest clean backup serves as the reference.
  • Check the database. Users and permissions, injected scripts in content and settings, changed redirects and email addresses.
  • Check the server. Cron jobs, .htaccess, stored SSH keys, executable files in upload and cache folders, emails in the queue.
  • Renew all secrets. Passwords, database credentials, API keys and tokens. For WordPress, this includes the keys in wp-config.php, so that all existing sessions become invalid.
  • Close the hole. Install updates, replace vulnerable plugins or packages, close open database rules, fix insecure upload functions in your own code.
  • Inform Google. If your website is flagged as hacked in Search Console, request a review after the cleanup. According to Google, it takes from a few days to a few weeks.

Finding the cause of the hack

Without the cause of the hack, every cleanup is only a pause. The access logs and the modification dates of the files usually show when and how the attacker got in. Typical ways in for attackers:

  • Outdated software. A CMS, a plugin, an extension, a framework or a package with a known vulnerability. Vulnerabilities are exploited quickly: according to Patchstack, in the WordPress ecosystem in 2025, the weighted median time until a newly disclosed vulnerability was first exploited was 5 hours.
  • Stolen credentials. An FTP password that sat in an agency’s email program for years, an admin password that was also used elsewhere, a former employee’s account.
  • Open database rules and keys in the frontend. For AI-built apps, Wiz counts database tables that are open to everyone and API keys in browser code among the typical mistakes. In 2025, a vulnerability involving insufficient access rules was published for Lovable (CVE-2025-48757, severity 9.3 out of 10). Lovable considers the rules to be its customers’ responsibility; for your data, that changes nothing.
  • Compromised packages. In September 2025, according to the US agency CISA, the “Shai-Hulud” worm infected more than 500 npm packages and harvested developers’ credentials, tokens and cloud keys.
  • Insecure forms and uploads in your own code, through which files can be uploaded or commands injected.

With the emergency fix from Unique-P, the search for the cause ends with a status report: what happened, since when, which data was affected and what was changed.

What differs by technology after a hack

Where to look first after a hack depends on the technology:

  • WordPress: Plugins and themes, the upload folder, admin accounts and the core checksums. If a core update ran unattended on a WordPress version before 7.1.4, include the time of that update in the check: an actively exploited flaw (CVE-2026-119977) strikes exactly then. More on taking over a WordPress website.
  • TYPO3: Extensions, back-end users and access to the Install Tool. With Composer installations, the core and extensions can be cleanly reinstalled.
  • PHP applications and shops: Laravel, Symfony, Shopware, Magento or a custom build. Configuration files with keys, upload functions and, for shops, the checkout: has foreign JavaScript been inserted there that skims payment data? More on the PHP application takeover page.
  • JavaScript and Node.js apps: Dependencies from npm, environment variables on platforms such as Vercel or Netlify, the build pipeline and tokens at npm and GitHub. See JavaScript and TypeScript applications.
  • AI-built apps: The access rules of every table and every storage bucket (Row Level Security in Supabase, Security Rules in Firebase), keys in the frontend and the question of who owns the accounts on the platform. The warning signs are in the article AI-built app: warning signs before your first real customer.

Duty to report under data protection law

If personal data is affected by a hack, such as customer accounts, orders or form submissions, you may be required to report it under Swiss data protection law. Under Art. 24 of the Swiss Federal Act on Data Protection (FADP), you as the controller must report a data security breach to the Federal Data Protection and Information Commissioner (FDPIC) as soon as possible if it is likely to result in a high risk for the people concerned. The FDPIC runs a reporting portal for mandatory reports.

If your hosting provider or your agency processes personal data on your behalf, the FADP requires them to inform you of every data security breach.

Whether a hack has to be reported to the FDPIC is a legal question, and the criteria are in the FDPIC’s guide on Art. 24 FADP (PDF, in German). The technical investigation gives you the facts for it: what was affected, since when and to what extent.

Keeping your website from being hacked again

  • Updates on a fixed schedule, for core, plugins, extensions and packages, tested beforehand.
  • Two-factor authentication for all admin and hosting access, and personal accounts instead of shared ones.
  • Only the permissions that are needed. Accounts of former employees and previous agencies are removed.
  • Backups off the server, several generations, with a restore that has actually been tried.
  • Monitoring: File changes, new admin accounts, error logs and Search Console notifications.
  • Code in Git: With the code in Git, you can see what changed and when.

At Unique-P, most of these safeguards against another hack are covered by ongoing maintenance and support. How vulnerable your application is today is shown by the Takeover Assessment, with review modules for PHP, JavaScript and TypeScript, WordPress and AI-built apps.

Help with the hack cleanup

Hack cleanup is available for all technologies Unique-P supports: PHP applications, WordPress, TYPO3, shops, JavaScript and Node.js apps, and AI-built apps. It starts with the emergency fix for hacked websites and applications: preserve the current state, clean up, close the hole, renew access, with an initial assessment usually on the same business day. After that, if you like, come the Takeover Assessment and ongoing support, so the next attack finds no open door.

Sources

  1. [1]2023 Hacked Website & Malware Threat Report · Sucuri, June 2024
  2. [2]State of WordPress Security in 2026 · Patchstack
  3. [3]Bericht zu Sicherheitsproblemen · Google Search Console-Hilfe
  4. [4]Leitfaden des EDÖB betreffend die Meldung von Datensicherheitsverletzungen und Information der Betroffenen nach Art. 24 DSG · EDÖB, Version 1.2 of April 23, 2025
  5. [5]wp core verify-checksums · WP-CLI, WordPress.org
  6. [6]WordPress 7.1.4 Security Release · WordPress.org, October 28, 2026
  7. [7]Widespread Supply Chain Compromise Impacting npm Ecosystem · CISA, September 23, 2025
  8. [8]Common Security Risks in Vibe-Coded Apps · Wiz, September 18, 2025
  9. [9]CVE-2025-48757 · Tenable, May 30, 2025

Frequently asked questions.

Can I just restore a backup?

Restoring a backup after a hack is only safe if you know since when the attacker was inside, and the hole has been closed. Otherwise you may restore a backup with a back door, or the old vulnerability lets them straight back in. According to Sucuri’s report on 2023, almost half of the websites they cleaned up had at least one back door. A backup is valuable, for comparison and for clean data, but not as a quick fix.

Should I take the website offline?

Take a hacked website offline if it redirects visitors to other sites, delivers malicious code, sends spam or data could be leaking, and use a simple maintenance page. Don’t delete anything while doing so; the files are needed to find the cause. If none of this applies, your website can often keep running until the cleanup begins.

How can I tell whether my website has been hacked?

Whether your website has been hacked often doesn’t show when you visit it yourself, because spam pages and redirects are only shown to Google or to visitors coming from search. Check the “Security issues” report in Google Search Console, search for site:yourdomain.ch, look at the list of admin accounts and read the emails from your hosting provider.

Is a security plugin or a malware scanner enough?

A security plugin or malware scanner isn’t enough after a hack. A scanner finds known patterns and is a good first indicator, but it doesn’t find everything, and it doesn’t close the hole the attacker came in through. With custom code, no scanner knows what the code should look like. Only a comparison with the original code shows that.

Do I have to report the incident?

You have to report a hack to the Swiss Federal Data Protection and Information Commissioner (FDPIC) if personal data is affected, such as customer accounts, orders or form submissions, and this is likely to result in a high risk for the people concerned. As the controller, you must then notify the FDPIC as soon as possible (Art. 24 FADP). Whether that applies is a legal assessment, and the criteria are in the FDPIC’s guide. The technical investigation gives you the facts for it.

My app was built with AI. Can it even be hacked?

Yes, an AI-built app can be hacked too, and often no break-in is needed at all. In apps built on Supabase or Firebase, tables are quite often wide open because the access rules are missing or too generous, or keys sit in code that every browser loads. Then anyone with a bit of know-how can read or change data.

Check an AI-built app for warning signs

How quickly can I get help?

With the emergency fix from Unique-P, you usually get an initial assessment of a hack on the same business day. Three pieces of information are enough for that: what you noticed, since when and what has already been tried. Access is only needed for the cleanup.

Emergency fix for hacked websites