
More than 90,000 cyberattacks against WordPress-based websites are recorded every minute on a global scale. Contrary to what many people think, the vast majority of these attacks are not conducted by human hackers targeting your company personally, but by automated networks of robots (botnets) that incessantly scan the internet in search of known loopholes, weak passwords and vulnerable default settings.
As the most used content management system (CMS) in the world, powering more than 43% of the entire internet, WordPress is a priority target for attackers. However, the core of the system is extremely secure; breaches almost always result from negligent permissions configuration, weak passwords, and outdated plugins. Implement a solid posture of security in WordPress requires the application of the principle of layered security (Defense in Depth).
The 8 Essential Layers of Protection for WordPress
1. Strong Authentication and Deletion of the “admin” User
Brute force attacks attempt thousands of password combinations per minute at the login screen. To neutralize this threat:
- Delete the Default User “admin”: Create a new admin user with a unique name and not publicly associated with published articles, deleting the original generic login.
- Two-Factor Authentication (2FA) Required: Implement 2FA for all edit or admin level accounts through authenticator apps (Google Authenticator or Authy). Even if the password is compromised, access remains blocked.
- Login Attempt Limitation: Temporarily block the visitor’s IP after 3 to 5 consecutive incorrect password attempts.
2. Disabling File Editing in the Dashboard
By default, the WordPress dashboard allows you to edit theme and plugin PHP files through the browser. If an attacker gains administrative access, they will use this area to inject backdoors. Block this by adding this constant to your file wp-config.php:
define('DISALLOW_FILE_EDIT', true); 3. Blocking PHP Execution in the Uploads Folder
The folder /wp-content/uploads/ must exclusively receive static media (images, videos, PDFs). Hackers often try to upload scripts .php malicious disguised as an image. Block execution by adding a directive to your Nginx web server or creating a file .htaccess inside the folder with:
<Files *.php>
deny from all
</Files> 4. Configuration File Protection (wp-config.php)
O wp-config.php stores the MySQL database credentials and security keys (salts). Protect the file by setting strict permissions on the server (chmod 600 or chmod 640) and block direct access via Nginx or Apache with rules that return the status 403 Forbidden.
5. Strict Application of the Principle of Least Privilege
Never use easy passwords or share administrative credentials with marketing teams or writers. Each contributor must have their own user strictly associated with the required permission level (Subscriber, Contributor, Author or Editor), without privileges for installing plugins or modifying themes.
6. Disabling XML-RPC and REST API Protection
The legacy archive xmlrpc.php was created to enable remote connections in the past, but today it is primarily used to launch massive denial of service (DDoS) and brute force attacks. If you don’t use the official WordPress mobile app or legacy Jetpack integrations, disable XML-RPC access in your server rules.
7. Web Application Firewall (WAF) with Cloudflare
The best way to protect the server is to prevent malicious traffic from even reaching it. Enabling a WAF at the CDN edge (like Cloudflare) filters out SQL Injection, Cross-Site Scripting (XSS), and automated bot attacks before the request even reaches your WordPress.
8. Immutable and Isolated Offsite Backups
Even with all defenses active, a contingency plan is mandatory. Maintain daily automatic backup routines recorded on external cloud servers that have accidental overwrite protection (Object Lock / WORM), ensuring that you can restore your clean website at any time.
Table: Matrix of Attack Vectors and Mitigation Actions
| Most Common Attack Vector | Probability | Severity of Damage | Technical Defense Mechanism |
|---|---|---|---|
| Brute Force Attack on Login Screen | Most High | Total (If password is weak) | 2FA Mandatory + Attempt Limit |
| PHP Shell Upload in Forms | Medium / High | Critical (Server Access) | Blocking PHP execution in /uploads/ |
| Vulnerability in Outdated Plugin | Most High | Critical (Malware injection) | Regular updates on Staging + WAF |
| SQL Injection via URL Parameters | Average | High (Data leak) | Query sanitization + Cloudflare WAF |
| Amplified Attack via XML-RPC | High | High (Memory exhaustion) | Full file lock xmlrpc.php |
WordPress Security FAQ
Does changing the WordPress login URL (wp-login.php) really protect you?
Change the URL of the login screen (for example to /restricted-access/) is a “security by obscurity” technique. It helps reduce noise in server logs caused by simpler bots, but is no substitute for strong passwords, 2FA, and blocking malicious IPs at the server edge.
What to do immediately if your website is hacked?
Put the site in maintenance mode, immediately change the database, dashboard and SFTP/SSH passwords, restore a reliable backup from before the date of infection, and perform a scan with specialized tools to locate possible backdoors left by the attacker.
Need to perform an in-depth security audit on your company’s WordPress and shield your infrastructure against intrusions? Discover our services security and web engineering by Carlos Xavier and protect your business operation.
Leave a Reply