Diensten Tarieven Blog Over ons Contact
|
Monitor met security code en hacking interface

WordPress gehackt? Stap-voor-stap herstelplan WordPress hacked? Step-by-step recovery plan

Belangrijk

Is je site gehackt? Wijzig nog geen wachtwoorden voordat je weet of er een keylogger actief is. Volg eerst de stappen hieronder in de juiste volgorde.

Lees ook: Website niet bereikbaar? Zo los je downtime op

Een gehackte website is stressvol, maar het is bijna altijd herstelbaar. De meeste WordPress-hacks zijn geautomatiseerd. bots scannen het internet af op bekende kwetsbaarheden en injecteren spam-links, redirect-scripts of cryptominers. Het is zelden een gerichte aanval op jou persoonlijk.

Hoe herken je een hack?

Niet elke hack is meteen zichtbaar. Sommige malware is ontworpen om maandenlang onopgemerkt te blijven. Let op deze signalen:

Hulp nodig? Bekijk onze website hulp utrecht pagina.

Google waarschuwing: “Deze site kan schadelijk zijn” in zoekresultaten

Onbekende redirects: bezoekers worden doorgestuurd naar spam-sites

Vreemde gebruikers: admin-accounts die je niet hebt aangemaakt

Gewijzigde bestanden: bestanden met recente wijzigingsdatums die je niet hebt aangeraakt

Spam in je content: Japanse/Chinese tekens of farmaceutische links in je pagina’s

Trage site: cryptominers of spam-scripts vreten server-resources

E-mail blacklisting: je domein stuurt spam en wordt geblokkeerd

Eerste stappen: schade beperken

Zet je site in onderhoudsmodus

Voorkom dat bezoekers malware te zien krijgen. Voeg dit toe aan je .htaccess of gebruik je hostingpanel om de site tijdelijk offline te halen.

Maak een backup van de huidige staat

Ja, ook van de gehackte versie. Je hebt deze nodig om te analyseren wat er is gebeurd en om data te herstellen als het mis gaat.

Controleer je hostingpanel

Log in bij je hosting en check of er andere sites op hetzelfde account zijn aangetast. Cross-site contaminatie is een veelvoorkomend probleem bij shared hosting.

Malware opsporen en verwijderen

Nu begint het echte werk. Je moet elk bestand controleren op verdachte code. Malware verstopt zich vaak in:

LocatieWat je zoektWaarom hier?
wp-config.phpOnbekende require of include regelsWordt als eerste geladen
.htaccessRedirect-regels naar externe domeinenBeïnvloedt alle pagina’s
wp-content/uploads/PHP-bestanden (horen hier niet)Schrijfbaar voor WordPress
wp-includes/Gewijzigde core-bestandenWordt zelden gecontroleerd
Thema’s & pluginsGeobfusceerde code (base64_decode, eval)Worden niet bijgewerkt
Terminal: Verdachte PHP-bestanden vinden in uploads
find wp-content/uploads/ -name "*.php" -type f
# Er horen GEEN .php bestanden in uploads te staan.
# Alles wat je hier vindt is vrijwel zeker malware.
Terminal: Zoeken naar geobfusceerde code
# Zoek naar veelvoorkomende malware-patronen
grep -r "base64_decode" wp-content/ --include="*.php"
grep -r "eval($_" wp-content/ --include="*.php"
grep -r "str_rot13" wp-content/ --include="*.php"

Tip

Download een schone kopie van WordPress van wordpress.org en vergelijk de wp-includes/ en wp-admin/ mappen met die op je server. diff -r laat exact zien welke bestanden zijn gewijzigd.

Website herstellen

Vervang WordPress core-bestanden

Download een verse kopie van wordpress.org. Vervang wp-admin/ en wp-includes/ volledig. Raak wp-content/ en wp-config.php niet aan.

Herinstalleer plugins en thema’s

Verwijder alle plugins en thema’s en installeer ze opnieuw vanuit de officiële bronnen. Gebruik nooit “nulled” (gekraakte) plugins. dat is de #1 bron van malware.

Reset alle wachtwoorden

WordPress admin, FTP, database, hosting panel, en e-mail. Gebruik een wachtwoordmanager en genereer wachtwoorden van minimaal 16 tekens.

Wijzig database-prefix en security keys

Genereer nieuwe salt keys via api.wordpress.org/secret-key en plak ze in wp-config.php. Dit logt alle sessies uit.

Toekomstige hacks voorkomen

  • WordPress, thema’s en plugins altijd up-to-date houden
  • Geen “nulled” (gekraakte) plugins of thema’s gebruiken
  • Sterke, unieke wachtwoorden met een wachtwoordmanager
  • Twee-factor authenticatie (2FA) op alle admin-accounts
  • Beperk login-pogingen (Limit Login Attempts of vergelijkbaar)
  • Verwijder ongebruikte thema’s en plugins volledig
  • Regelmatige backups op een externe locatie (niet op dezelfde server)
  • Monitoring instellen (Wordfence, Sucuri, of uptime-check)

Belangrijkste takeaway

De meeste hacks zijn te herleiden tot verouderde software of zwakke wachtwoorden. Regelmatig updaten en sterke wachtwoorden met 2FA zijn je beste verdediging. Herstel altijd vanuit schone bronbestanden, niet door individuele regels code te verwijderen.

Gerelateerde artikelen

Important

Has your site been hacked? Don't change any passwords yet until you know whether a keylogger is active. Follow the steps below in the correct order first.

A hacked website is stressful, but it's almost always recoverable. Most WordPress hacks are automated: bots scan the internet for known vulnerabilities and inject spam links, redirect scripts or cryptominers. It's rarely a targeted attack on you personally.

How to recognize a hack

Not every hack is immediately visible. Some malware is designed to remain undetected for months. Watch for these signs:

Google warning: "This site may be harmful" in search results. Unknown redirects: visitors are sent to spam sites. Strange users: admin accounts you didn't create. Modified files: files with recent modification dates you didn't touch. Spam in your content: Japanese/Chinese characters or pharmaceutical links in your pages. Slow site: cryptominers or spam scripts consuming server resources. Email blacklisting: your domain is sending spam and getting blocked.

First steps: limiting damage

Put your site in maintenance mode

Prevent visitors from seeing malware. Add this to your .htaccess or use your hosting panel to temporarily take the site offline.

Back up the current state

Yes, even the hacked version. You'll need it to analyze what happened and to restore data if something goes wrong.

Check your hosting panel

Log into your hosting and check whether other sites on the same account are affected. Cross-site contamination is a common problem with shared hosting.

Finding and removing malware

Now the real work begins. You need to check every file for suspicious code. Malware often hides in:

LocationWhat to look forWhy here?
wp-config.phpUnknown require or include linesLoaded first
.htaccessRedirect rules to external domainsAffects all pages
wp-content/uploads/PHP files (shouldn't be here)Writable by WordPress
wp-includes/Modified core filesRarely checked
Themes & pluginsObfuscated code (base64_decode, eval)Not kept updated
Terminal: Finding suspicious PHP files in uploads
find wp-content/uploads/ -name "*.php" -type f
# There should be NO .php files in uploads.
# Anything you find here is almost certainly malware.
Terminal: Searching for obfuscated code
# Search for common malware patterns
grep -r "base64_decode" wp-content/ --include="*.php"
grep -r "eval($_" wp-content/ --include="*.php"
grep -r "str_rot13" wp-content/ --include="*.php"

Tip

Download a clean copy of WordPress from wordpress.org and compare the wp-includes/ and wp-admin/ directories with those on your server. diff -r shows exactly which files have been modified.

Restoring your website

Replace WordPress core files

Download a fresh copy from wordpress.org. Replace wp-admin/ and wp-includes/ entirely. Don't touch wp-content/ and wp-config.php.

Reinstall plugins and themes

Delete all plugins and themes and reinstall them from official sources. Never use "nulled" (cracked) plugins, as they're the #1 source of malware.

Reset all passwords

WordPress admin, FTP, database, hosting panel, and email. Use a password manager and generate passwords of at least 16 characters.

Change database prefix and security keys

Generate new salt keys via api.wordpress.org/secret-key and paste them in wp-config.php. This logs out all sessions.

Preventing future hacks

  • Keep WordPress, themes and plugins up to date at all times
  • Never use "nulled" (cracked) plugins or themes
  • Strong, unique passwords with a password manager
  • Two-factor authentication (2FA) on all admin accounts
  • Limit login attempts (Limit Login Attempts or similar)
  • Completely remove unused themes and plugins
  • Regular backups to an external location (not the same server)
  • Set up monitoring (Wordfence, Sucuri, or uptime checks)

Key takeaway

Most hacks can be traced back to outdated software or weak passwords. Regular updates and strong passwords with 2FA are your best defense. Always restore from clean source files, not by removing individual lines of code.