This guide is for anyone who looks after several WordPress sites and wants a weekly check for known security holes in their plugins. The WordPress updates screen only tells you that a newer version exists. It never warns you that the version you run has a publicly disclosed vulnerability. It also stays silent about abandoned plugins, because a plugin whose author walked away never offers an update.
The answer is a short weekly routine built on WPScan, a command-line scanner backed by a large database of WordPress vulnerabilities. You list every plugin each site really runs over SSH, match those versions against the WPScan API (its online lookup service), and get one short list with a deadline on each row. By the end, you will also have triage rules that separate patch-now from patch-this-week, plus a plan for plugins that will never get a fix.
What you’ll accomplish
- A working WPScan CLI install with an API token, and a clear picture of what a remote scan cannot see.
- A local inventory collector that reports every plugin on every site you operate, deactivated ones included.
- A matcher that turns that inventory plus the WPScan feed into one triage list, deduplicated by slug so you stay inside the API rate limit.
- Triage rules that set the deadline from reachability, not from the CVSS number alone.
- A path for abandoned plugins where no fix will ever ship, and a weekly schedule nobody has to remember.
Prerequisites
Shell access to the servers hosting the sites, and WP-CLI available as wp. Root is not required; the collector runs as each site’s own user. You also need jq and curl on the machine that assembles the report, plus a WPScan account for the API token.
The WPScan CLI is a Ruby gem, so the host you run it from needs a Ruby toolchain and the libcurl development headers: ruby ruby-dev libcurl4-openssl-dev make zlib1g-dev on Debian and Ubuntu, ruby ruby-devel libcurl-devel gcc make zlib-devel on AlmaLinux or Rocky. None of it needs to run on the web servers — put it on a management host.
Know the data sources before you build on them. WPScan maintains the largest community-curated WordPress vulnerability database behind an HTTP API; the free tier is capped at 25 API requests per day, which is fine for one small site and nowhere near enough to walk a fleet naively. Paid tiers raise that ceiling. Patchstack runs a second database with a public web front end and a virtual-patching product, and fits better when you need mitigation for a plugin that will never be fixed — but its API sits behind its paid plans. The third signal costs nothing and is the one people forget: WordPress.org closes a plugin’s directory listing when it is pulled for a security issue or abandoned, and that closure is machine-readable.
Scan only sites you own or operate under contract. Running an enumeration tool against somebody else’s install is unauthorized regardless of intent, and aggressive detection generates enough traffic to look like a real attack in their logs.
How it works
A vulnerability scanner does three separable things, and most setups disappoint because they treat them as one. It determines what is installed, matches that against a database of disclosures, and ranks the matches. Only the middle step is a solved problem.
The real question is where the inventory comes from. wpscan --url fingerprints the site from outside: generator tag, readme files, known asset paths. That is the right tool when you have just inherited a site and have no shell on it yet, and the wrong tool as a recurring job against your own servers. It misses what it cannot see — a deactivated plugin, a plugin whose assets never appeared on the pages it crawled, a version hidden because the readme was removed — and it is noisy, generating hundreds of 404s per site that your own intrusion detection will flag.
The reliable input is local. wp plugin list --format=json and wp core version, run on the host as the site’s own user, are ground truth: exact versions, deactivated plugins included, no guessing and no traffic. Feed that into the matcher instead.
The second thing worth designing deliberately is triage. A CVSS score describes a vulnerability in the abstract; it knows nothing about your deployment. A contributor-level stored XSS on a site with two editors and closed registration is a different problem from the same finding on a membership site with ten thousand accounts. Three questions settle the deadline.
Step-by-step
-
Install the WPScan CLI on a management host. Install the toolchain, then the gem.
sudo apt install -y ruby ruby-dev libcurl4-openssl-dev make zlib1g-dev gem install wpscan wpscan --versionwpscan --versionprints the version and the local database timestamp. A gem build that fails while compilingethonortyphoeusis missing the libcurl headers above, not a Ruby problem. -
Add the API token and check your quota before spending it. Generate a token in your WPScan account, export it, and ask the API what is left.
export WPSCAN_API_TOKEN='your-token-here' curl -s https://wpscan.com/api/v3/status \ -H "Authorization: Token token=$WPSCAN_API_TOKEN"You get back a small JSON object along the lines of
{"plan":"free","requests_remaining":25,"requests_limit":25}. That number is the entire budget for the day, and every plugin lookup spends one. Step 6 is built around it. -
Run one remote scan, so you know what it does and does not catch. Against a site you operate:
wpscan --url https://example.com/ \ --api-token "$WPSCAN_API_TOKEN" \ --enumerate vp,vt \ --plugins-detection passive \ --format cli --output /tmp/wpscan-example.txtThe interesting part of the output:
[+] WordPress version 6.5.2 identified (Insecure, released on 2024-04-09). | Found By: Rss Generator (Passive Detection) [+] acme-forms | Location: https://example.com/wp-content/plugins/acme-forms/ | Version: 2.4.1 (100% confidence) | [!] The version is out of date, the latest version is 2.4.3 | | [!] 1 vulnerability identified: | [!] Title: Acme Forms < 2.4.3 - Unauthenticated Arbitrary File Upload | Fixed in: 2.4.3Now compare that plugin list against what the site really has. It will be shorter.
--plugins-detection passivereports only plugins whose assets appeared in the HTML it fetched;aggressiveprobes thousands of known paths, finds more, and hammers your own server to do it. Either way a deactivated plugin is invisible here — and a deactivated plugin is still a file the web server will hand to anyone who asks. -
Collect the real inventory on one host first. As the site’s user, in the install directory:
wp core version wp plugin list --format=json --fields=name,version,status,update_versionYou get a bare version string, then a JSON array with one object per plugin —
active,inactiveandmust-usealike. Compare its length with the plugin count from step 3. The difference is what remote fingerprinting missed on your own site. -
Collect across the fleet into one file. Keep a list of sites as
user@host:/path/to/installlines, then walk it. Each line of the result is one plugin on one site:while read -r target; do host="${target%%:*}"; path="${target#*:}" ssh -n "$host" "wp --path='$path' plugin list \ --format=json --fields=name,version,status" \ | jq -c --arg site "$target" \ '.[] | {site:$site, slug:.name, version:.version, status:.status}' done < sites.txt > inventory.ndjson wc -l inventory.ndjson jq -r .slug inventory.ndjson | sort -u | wc -lThe first count is total plugin installations across the fleet; the second is the number of distinct slugs. That second number is a small fraction of the first — 40 sites might share 55 distinct plugins — and that ratio is what makes the API budget workable. An
sshline producing no JSON usually means WP-CLI is not onPATHfor a non-interactive shell; call it by absolute path. -
Fetch the feed once per distinct slug, and cache it. Loop over the deduplicated slugs, not over the inventory:
mkdir -p feed jq -r .slug inventory.ndjson | sort -u | while read -r slug; do [ -s "feed/$slug.json" ] && \ [ -z "$(find "feed/$slug.json" -mtime +1)" ] && continue curl -sS "https://wpscan.com/api/v3/plugins/$slug" \ -H "Authorization: Token token=$WPSCAN_API_TOKEN" \ -o "feed/$slug.json" sleep 1 doneEach response is a JSON object keyed by the slug, holding
latest_version,last_updatedand avulnerabilitiesarray whose records carrytitle,cvss,fixed_inandreferences. Thefind -mtime +1guard means a re-run inside 24 hours costs zero requests. An error body or an HTTP 429 means you hit the daily cap — the cache is what keeps you under it. -
Match inventory against feed. Version strings do not compare correctly as text, so use
sort -V:jq -r '[.site,.slug,.version] | @tsv' inventory.ndjson | while IFS=$'\t' read -r site slug version; do [ -s "feed/$slug.json" ] || continue jq -r --arg s "$slug" \ '.[$s].vulnerabilities[]? | [(.cvss.score // "-"), (.fixed_in // "NONE"), .title] | @tsv' \ "feed/$slug.json" | while IFS=$'\t' read -r score fixed title; do if [ "$fixed" = "NONE" ]; then printf '%s\t%s\t%s\tNO FIX\t%s\t%s\n' "$site" "$slug" "$version" "$score" "$title" elif [ "$(printf '%s\n%s\n' "$version" "$fixed" | sort -V | head -1)" = "$version" ] \ && [ "$version" != "$fixed" ]; then printf '%s\t%s\t%s\t%s\t%s\t%s\n' "$site" "$slug" "$version" "$fixed" "$score" "$title" fi done done | sort -u > triage.tsvtriage.tsvis the deliverable: site, slug, installed version, fixing version (orNO FIX), CVSS score, title. An empty file is a legitimate result — the fleet is current against everything disclosed so far.NO FIXrows go to step 9. -
Check the WordPress.org closure signal for anything suspicious. This is the free source that catches abandonment, which no vulnerability feed reports as such:
curl -s -o /dev/null -w '%{http_code}\n' \ 'https://api.wordpress.org/plugins/info/1.2/?action=plugin_information&request[slug]=acme-forms'200means the plugin is still listed, and the full response carriesversion,last_updatedandtested.404means the directory listing is gone — the plugin was closed or removed, and no update will ever arrive through the normal channel. Run this across every slug, not just the ones with findings: a plugin closed six months ago with no disclosed CVE is still a plugin nobody maintains. Auditing a fleet for abandoned plugins covers the follow-up. -
Act on each row, using the decision tree, not the score. For a normal finding with a fix, back up first and update by version so the result is reproducible:
wp db export "/tmp/pre-patch-$(date +%F).sql" wp plugin update acme-forms --version=2.4.3 wp plugin get acme-forms --field=versionThe last command must print
2.4.3. The WP-CLI plugin command reference documents--dry-runfor previewing a batch.For a
NO FIXrow on a plugin you still need, virtual-patch it: block the vulnerable route at the edge while you arrange a replacement. Scope the Cloudflare custom rule to the one endpoint rather than the whole plugin, so the site keeps working:(http.request.uri.path contains "/wp-content/plugins/acme-forms/upload.php")Set the action to Block and confirm the rule fires before calling it mitigated. Cloudflare WAF rule patterns for WordPress covers the common cases. A virtual patch buys time; the row stays open until the plugin is gone or replaced.
-
Schedule the whole thing weekly. Put steps 5 through 8 in one script and run it from the management host under systemd or cron:
15 4 * * 1 /usr/local/bin/wp-vuln-sweep.sh 2>&1 | logger -t wp-vulnHave the script exit non-zero when
triage.tsvis non-empty and let your existing alerting react, rather than emailing a report per site. Weekly catches disclosures inside the window that matters; monthly does not.
Validate it works
Create a known-vulnerable state on a staging copy by pinning an old version of a plugin you control, then run the sweep.
wp plugin update acme-forms --version=2.4.1
bash /usr/local/bin/wp-vuln-sweep.sh
grep acme-forms triage.tsv
The grep must return a row naming 2.4.1 and the fixing version. If it does not, work backwards: is the slug in inventory.ndjson, is feed/acme-forms.json present and non-empty, and does jq '.[].vulnerabilities | length' feed/acme-forms.json return more than zero? Whichever answer is no is your broken stage. Then confirm the loop closes:
wp plugin update acme-forms --version=2.4.3
bash /usr/local/bin/wp-vuln-sweep.sh
grep -c acme-forms triage.tsv
A count of 0 means the finding cleared through the same pipeline that raised it. That round trip — raised, patched, verified gone — is the part worth testing, because a scanner nobody can close a ticket with gets ignored within a month.
Troubleshooting
Every scan reports zero vulnerabilities, on every site. The token is missing or not being read. wpscan prints No WPScan API Token given, as a result vulnerability data has not been output and otherwise looks like a normal successful scan, which is how this goes unnoticed for months. Re-check /api/v3/status as in step 2, and confirm the variable survives into cron — cron does not read your shell profile.
The feed loop stops partway and later files are empty. You exhausted the daily request allowance. Count distinct slugs before running it, keep the 24-hour cache from step 6, and if the fleet is genuinely larger than the free tier allows, move to a paid tier or split the sweep across days by slug. Do not remove the sleep.
A plugin has a real vulnerability but never appears in triage.tsv. Two usual causes. It is not in the WordPress.org directory — a premium or bespoke plugin has no slug the API knows, so track it manually against the vendor’s own changelog. Or the version string is non-standard, something like 2.4.1-beta, which sort -V orders in a way you did not intend. Print the comparison for that row and check it by eye.
Remote scanning your own site trips your WAF or fills the logs with 404s. Expected, and a reason to prefer the local inventory for routine work. If you must scan remotely, allow the source address, keep --plugins-detection passive, and add --throttle to slow the request rate. Do not disable the WAF to make a scan finish.
A site turns up with plugins or versions nobody deployed. Stop treating it as a patching problem: that pattern points at a compromise, and patching over a live backdoor changes nothing. Work the malware scan and clean runbook first.
When this is the wrong approach
Scanning only ever finds what somebody has already disclosed. A vulnerability being exploited quietly this week, and the bespoke plugin your agency wrote that nobody has ever reviewed, are both invisible to every feed in this guide. Treat a clean triage.tsv as evidence you are current with public knowledge, not as evidence the site is safe.
It is also not a substitute for backups. The measure of a backup is not that it exists but that you have restored one recently onto a scratch host and watched the site come up. Until then, the recovery plan for a bad patch or a real breach is a guess.
For a single small site with a handful of plugins, this pipeline is more machinery than the problem needs: turn on automatic plugin updates, subscribe to a vulnerability mailing list, and spend the saved effort on off-site backups. It earns its keep once the number of installs exceeds what one person holds in their head, or when someone external asks you to evidence a patching process.
And if the finding count is high because nobody has owned these sites for a year, scanning is the wrong first move — inventory and clean-up come first. The post-takeover hardening checklist is the better starting point when you have just been handed a fleet.
Running WordPress that earns real money deserves an operator — Stack Harbor runs that stack under Enterprise WordPress; book an infrastructure consult.