Guides · 11 min read

How to Audit WordPress Security at Every Layer

By WP Vanguard Team

How to Audit WordPress Security at Every Layer

Ask someone to audit a WordPress site's security and they'll almost always start, and stop, in the same place: check plugin versions, look for weak passwords, maybe run a malware scan. That's real work, but it covers one layer out of three. The network in front of WordPress and the server underneath it get skipped because they don't feel like "WordPress problems". Attackers don't share that assumption.

This guide walks through all three layers in order, with the settings to check at each one. It replaces three shorter guides we published separately (network, hosting and the overview), because the layers only make sense together: each one can undo the work you did on the others.

Key finding

Audit from the outside in: network edge first, then the server, then WordPress itself. A leaked origin IP lets an attacker walk around a perfectly patched site.

The three layers at a glance

Layer What it covers Where you check it
1. Network edge DNS, CDN and WAF, TLS, security headers From outside, no server access needed
2. Server Account isolation, PHP, SSH, database, uploads, backups Shell access on the host
3. WordPress install Core, plugins, themes, users, file integrity WP-CLI or the dashboard

Layer 1: The network edge

This is everything between a visitor and your server. It's the first thing an attacker touches and, done right, the place where most automated attacks stop before WordPress sees a single request. A plugin vulnerability scan can't see any of it.

Hide your origin IP address

If your domain is proxied through Cloudflare (the orange cloud) but an old DNS record still points straight at your server's real IP, an attacker who finds it can skip your WAF and hit the origin directly.

Configure the WAF and CDN

A CDN set to "DNS only", or a WAF whose rules aren't tuned for how WordPress works, does nothing for security.

Harden TLS

A certificate that exists isn't the same as one that's configured well.

Set security headers

Most WordPress installs ship with none of these, and a CDN can add them at the edge with no plugin and no code change.

Clean up DNS hygiene

If you're starting from nothing, work in this order: proxy the DNS records and lock the origin firewall to CDN addresses, then set TLS to Full (Strict) and enable HSTS, then rate-limit the login endpoints, then add the headers. Each step closes a gap the previous one left open.

Layer 2: The hosting and server

This is the machine WordPress runs on, and it's invisible to any scan that only talks to your site over HTTP. A WordPress install can be perfectly configured and still be compromised because the server underneath runs an end-of-life PHP version, allows password SSH logins, or lets PHP execute inside the uploads folder.

Isolate every site

Shared hosting that puts several WordPress installs under one system user turns one compromised site into a compromised server. If a plugin bug lets an attacker write a file, and every site shares file permissions, they can reach all of them.

Keep PHP current and locked down

Lock down SSH and server access

Harden the database

Stop PHP executing in uploads

The uploads directory should hold images, PDFs and media, never executable code. Most successful WordPress compromises drop a PHP backdoor into wp-content/uploads/ because it's writable and, on a misconfigured server, still executable. Block it at the server, not with a plugin:

# nginx
location ~* /wp-content/uploads/.*\.php$ {
    deny all;
}
# Apache (.htaccess inside wp-content/uploads/)
<FilesMatch "\.php$">
    Require all denied
</FilesMatch>

Watch out

A clean uploads folder today doesn't mean it stays clean. Re-check it on a schedule for PHP files that don't belong.

Back up like you expect to need it

A basic checklist says "set up backups". These are the parts that make a backup useful when you need it.

Watch the server, not just the site

Layer 3: The WordPress install

This is the layer most audits already cover, and it still deserves a proper pass. With WP-CLI on the server, each check takes a line.

Versions. Core, plugins and themes should all be current, and anything abandoned should go.

wp core version
wp plugin list --fields=name,version,update
wp theme list --fields=name,version,update

Then check what you run against known disclosures. Our guide to checking plugins against known vulnerabilities covers how, and the weekly patch list shows what's being attacked right now.

Users. List every administrator and ask whether you recognise each one. An admin account you didn't create is a finding.

wp user list --role=administrator --fields=ID,user_login,user_email,user_registered

File integrity. WordPress publishes checksums for core and for plugins from the directory, so modified files stand out.

wp core verify-checksums
wp plugin verify-checksums --all

Premium plugins and themes have no public checksums, which is where a malware scan earns its place. If anything looks wrong, our guides to signs your site has been hacked and PHP backdoors in WordPress show what to look for, and the malware removal guide covers cleanup.

Configuration. Check that wp-config.php isn't readable from the web, that file editing is disabled in the dashboard with DISALLOW_FILE_EDIT, and that the rest of the security checklist is done.

Why the order matters

A misconfigured network layer can undo hardening at the other two. A leaked origin IP lets an attacker bypass your WAF and hit a patched WordPress install directly. A weak server layer can undo application fixes too: DISALLOW_FILE_EDIT doesn't matter if PHP can execute in the uploads folder regardless.

Fixing layer 3 alone closes the door WordPress controls and leaves the other two open. That's why we audit from the outside in.

Running the full audit in three passes

  1. Check the edge. DNS records, TLS mode, WAF rules and headers. You need no server access, only tools that see your site the way a visitor or an attacker does.
  2. Check the server. SSH, PHP settings, database exposure, upload execution and backups. This needs shell access, which is why most surface scanners skip it.
  3. Check the install. Versions against known vulnerabilities, the admin list, file integrity and malware signatures.

WP Vanguard's free surface scan covers most of layer 1 (TLS, headers, exposed paths, WAF and CDN detection) without any credentials. The deep scan connects over SSH and covers layer 3 fully, plus the parts of layer 2 visible from inside the server: PHP version, file permissions, uploads execution and cron integrity.

It doesn't replace asking your host about account isolation, or locking down your registrar, because those decisions sit outside anything a scan of the server can see. What it does is tell you, in one pass, which of the three layers still needs attention.

wordpress-security-audit wordpress-network-security wordpress-hosting-security server-hardening defense-in-depth

Related reading

Check Your WordPress Site Security

Free scan, no login required. Find vulnerabilities before attackers do.

Scan Your Site Free

Get weekly WordPress security tips

Vulnerability alerts, plugin updates, and security guides. No spam. Unsubscribe any time.

WP Vanguard is built by Wbcom Designs, makers of Reign, Jetonomy, Listora, and more. Explore our WordPress products →
← Back to Blog