Corporate WordPress Security and Maintenance Guide

A corporate WordPress security and maintenance guide: plugin inventory, updates via a test environment, user and permission management, hardening, backup verification and incident response.
Technical summary
Technology
WordPress, WP-CLI, 2FA, OWASP
Topic
WordPress security
Level
Intermediate
In this article9 sections

Most security incidents on corporate WordPress sites come not from WordPress core but from plugins that aren’t updated, shared “admin” accounts and backups that have never been restored. Core is regularly updated software with a security team; the weak link is usually what’s been added around it. The framework below gives, in order, the steps applied in the field for operating a corporate WordPress site securely, from component management to incident response.

1. Component management: few, trustworthy, up to date

  • Take a plugin inventory: each plugin’s purpose, owner, last update date and alternative.
  • Replace plugins that haven’t been updated for a long time or have been abandoned by their developer.
  • Delete unused plugins and themes completely.
  • Keep licenses for licensed (premium) components in the organization’s name; otherwise updates can’t be received.

You can take the inventory in a few seconds with WP-CLI: wp plugin list --fields=name,status,version,update shows which plugins aren’t up to date, and wp theme list shows inactive themes. The picture we see most often in the field is five or six plugins the agency installed during development that nobody remembers. Each one is a separate attack surface. A plugin whose purpose can’t be written down is deleted.

2. A controlled update process

Both postponing updates and applying them live without testing are risky. The recommended process:

  1. Updates are applied in a test environment that’s a copy of the live site (repeatably, with WP-CLI).
  2. Critical pages, forms, payment and membership functions are tested.
  3. A backup is taken in the live environment, updates are applied and the same tests are repeated.
  4. A change log is kept: date, component, old/new version, test result.

When critical security updates are released, this process is accelerated; routine updates follow a two-week or monthly schedule.

The value of a test environment depends on it being the same as live. A copy running a different PHP version, without the cache layer or with missing plugins won’t catch the problem. Also disable outgoing email in the test environment; order or form notifications going to customers during testing is a common accident. Checking the PHP error log after an update is the first check. The reason for a white screen is written there.

3. Users and authentication

  • A separate account for each person; no shared “admin” account.
  • Least privilege: the Editor role, not Administrator, for content editors.
  • Two-factor authentication (2FA) for administrators and editors.
  • Accounts of departing employees are closed the same day; a quarterly user review is carried out.
  • Rate limiting and brute-force protection on the login page (at the server or CDN layer).
  • XML-RPC is disabled if not used; the REST API’s user listing endpoint is evaluated.

See the number of administrators with one command: wp user list --role=administrator. If the list shows former agency staff, test accounts or unrecognized users, close those first. When deleting an account, don’t forget to reassign its content to another user; otherwise posts linked to it as author may be deleted too.

4. Hardening

  • File editing from the admin panel is disabled (DISALLOW_FILE_EDIT).
  • File permissions are set correctly; wp-config.php is protected, and security keys are randomly generated and unique to the site.
  • Running PHP in the uploads folder is blocked.
  • Version information and unnecessary files (readme, sample configuration) are closed off from the outside.
  • Security headers (HSTS, X-Content-Type-Options, Referrer-Policy) are added; CSP is tried in report mode.
  • PHP and database versions on the server are kept within support.

The generally accepted starting point for file permissions is 755 for directories and 644 for files; wp-config.php can be kept more restricted. A directory with 777 permissions is a door opened to solve a problem and then forgotten. The malicious files found most often in the field are PHP files under wp-content/uploads; disabling PHP execution in this directory at the web server level largely defeats this class of attack. Before adding HSTS, make sure all subdomains are ready for HTTPS; it’s hard to roll back because of browser caching.

5. Backups: not just taken, but restorable

Backups should cover the database and files including wp-content, be stored off the server (a different location/account) and be verified at intervals by actually restoring them. Against ransomware and account takeover risks, it’s recommended that at least one backup copy is immutable or kept with access in a separate structure. The retention period should be set taking into account that an infection may be noticed late.

A backup plugin’s “successful” notification doesn’t prove the backup opens. Do the restore test in an empty test environment: import the database, extract the files, bring the site up on a different domain and check a few pages, a form and the admin panel. An untested backup isn’t a backup. A backup kept on the same server doesn’t count as a backup strategy either; when the server is compromised, the backups are deleted or encrypted too.

6. Monitoring

  • File integrity checks: changes in core files and unexpected PHP files in the uploads folder.
  • Vulnerability notifications: tracking published vulnerabilities related to the plugins in use.
  • Monitoring of availability, certificate expiry and form delivery.
  • Recording administrator logins and role changes.

For core integrity, the WP-CLI command wp core verify-checksums compares core files against the checksums on WordPress.org; for plugins, wp plugin verify-checksums --all only works for plugins in the WordPress.org directory. Running these checks as a scheduled task and receiving the output by email is more reliable than a warning screen in the panel that nobody opens.

7. Incident response

In a security incident, order matters: a snapshot backup to record the state; changing all administrator, FTP/SSH and database passwords and the WordPress security keys; restoring from a clean source; finding the entry point (an unpatched plugin, a compromised account) and closing it; and requesting a review in Search Console to remove search engine warnings. A post-incident lessons-learned meeting and a process update should follow.

A clean-up done without finding the entry point recurs within a few days. In the web server access logs, the first request to the suspicious file and the POST requests before that date usually show the trail. That’s why logs should be copied before the clean-up. Scan the database too: unrecognized administrator users and unexpected entries added to the wp_options table are common persistence methods.

Layered protection

Measures inside WordPress should be complemented by controls at the edge and server layers: WAF and rate limiting on a CDN such as Cloudflare, and a firewall and isolation on the server. Details are on our web application security and WAF page. For independent penetration testing and vulnerability scanning, you can work with Eretek Cybersecurity.

If several sites are hosted on the same server, each site should run with a separate system user and a separate PHP-FPM pool. An infection spreads easily between sites running under a single user. If a CDN is used, having the server accept HTTP traffic only from the CDN’s IP ranges prevents the WAF from being bypassed via the direct IP.

Frequently asked questions

Is installing a security plugin enough?

No. Security plugins make some checks easier; but on their own they aren’t enough without up-to-date components, few plugins, strong authentication, correct file permissions, protections at the server and edge layers, and verified backups.

Is deactivating unused plugins enough?

Deactivated plugin code stays on the server, and some vulnerabilities can be exploited by accessing the file directly. Unused plugins and themes should be deleted completely.

What should be done first when a site is hacked?

A backup of the current state is taken (for forensic analysis), admin and server passwords and keys are changed, the site is restored from a clean backup or a clean installation, and the entry point is found and closed. Deleting only the visible malicious code leads to reinfection.

To run these processes regularly and with reporting, see our WordPress security, updates and maintenance service.

Support

Contact us for support or a discovery session on this topic.

Contact form
[email protected]

Eretek Web

We build and maintain corporate websites, WordPress and CMS platforms, intranet and SharePoint portals, document management, and form and approval workflows, and keep them secure and up to date.

Knowledge Center

Other articles