Harden a WordPress or web application: WAF and rate limiting, security headers and CSP, TLS, login protection, file permissions, updates, scanning and clean-up.
Most compromised websites are hit through outdated plugins, weak logins or exposed admin interfaces. A layered hardening approach blocks the common paths.
1. Keep software current
Update WordPress core, themes and plugins promptly, remove anything unused, and choose plugins with active maintenance. Subscribe to vulnerability feeds and prioritize updates for issues being exploited.
2. Web application firewall and rate limiting
Use a WAF at the edge (Cloudflare, Sucuri, hosting WAF) to block known attack patterns, bad bots and brute force. Rate limit /wp-login.php, /xmlrpc.php and search endpoints.
3. TLS and security headers
Strict-Transport-Security: max-age=31536000; includeSubDomains
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
Referrer-Policy: strict-origin-when-cross-origin
Permissions-Policy: camera=(), microphone=(), geolocation=()
Content-Security-Policy: default-src 'self'; ...Roll out CSP in report-only mode first to find blocked resources, then enforce. Test with securityheaders.com and Mozilla Observatory.
4. Login and accounts
- MFA for all administrators and editors.
- Unique strong passwords in a password manager; remove unused accounts.
- Limit login attempts; change or protect the default login URL if helpful.
- Block user enumeration (
?author=1and the REST users endpoint for unauthenticated users). - Use least-privilege roles.
5. Files and server
- Correct permissions (directories 755, files 644,
wp-config.php600 or 640). - Disable file editing in the dashboard:
define('DISALLOW_FILE_EDIT', true);. - Block PHP execution in upload folders and protect
.htaccess,wp-config.phpand backups. - Remove
readme.html,license.txt, install scripts and default placeholder files. - Hide version fingerprints and generator tags.
6. Monitoring and backups
File integrity monitoring, malware scans, login and admin activity logs, and offsite backups with restore tests.
7. If you are compromised
- Take the site offline or into maintenance mode; preserve a forensic copy.
- Reset all passwords, salts and API keys.
- Identify the entry point (outdated plugin, stolen credentials).
- Replace core files from clean sources, remove backdoors and unknown admin users.
- Patch, harden, then request review if search engines flagged the site.
IT Guiders audits, hardens and cleans websites and monitors them afterwards.
website security hardening
