Block exploits of what your site actually runs
phpwarden shield is one PHP file loaded before your application. It checks each request for
exploit attempts against the exploited vulnerabilities installed on this site, and only those. It logs
first and blocks only the rules you promote.
Why per-site rules
A generic firewall applies the same patterns to every site, so it has to be broad, and broad patterns catch
ordinary traffic. phpwarden already knows what is installed on a site and which of those vulnerabilities attackers
are using (CISA KEV, EPSS). phpwarden shield policy turns that into rules for those vulnerabilities only,
scoped to the vulnerable component's own entry points: the plugin's AJAX action, the package's route, the file
that should never be reachable. Upgrade the component and its rule is dropped.
$ phpwarden shield policy /var/www/shop --php-version 8.3.10 --php-sapi fpm
wrote phpwarden-shield.policy.json and phpwarden-shield.policy.php (6 rule(s), mode: log)
+ phpunit-eval-stdin CVE-2017-9841 phpunit/phpunit: installed 5.6.2 is affected; exploited in the wild
+ laravel-ignition-execute-solution CVE-2021-3129 facade/ignition: installed 2.5.1 is affected; exploited in the wild
+ generic-php-stream-wrapper-in-param any: generic exploit-in-progress check
...
The library has 33 rules: 29 for 28 widely exploited PHP, Composer and WordPress vulnerabilities with documented
request shapes, plus four generic checks that are almost never legitimate: a php:// or phar://
wrapper in a parameter, a php.ini directive assigned in the query, a serialized object when a package with a known
gadget chain is installed, and traversal toward wp-config.php or .env.
Log first, block later
- Every rule starts in log-only mode. Nothing is blocked until you promote it.
phpwarden shield promoteswitches a rule to blocking only once the policy has been in place for 7 days, only if its hits don't look like ordinary traffic, and only with an explicit--i-understand-this-blocks-requestsflag. On the dashboard it is a per-rule button with the same conditions (Pro and Team).- "Back to log-only" returns every rule to logging in the dashboard policy; download the new policy to apply it, or create
phpwarden-shield.offfor an immediate stop.
Built to stay out of the way
- Fails open. An unreadable policy, an exception while matching, or the 5 ms time budget: the shield steps aside and your site carries on.
- Kill switch. Create a file named
phpwarden-shield.offnext to the agent, or setPHPWARDEN_SHIELD=off. - Private logs. JSON lines with short, redacted excerpts; no request bodies; secret-looking values masked; rotation at a size cap. Send a summary to your dashboard if you want to see hits there.
- No extensions. Pure PHP, 7.4 to 8.5.
Rate limits
Since 2.4.0 the policy also limits each client on the endpoints brute force goes for: WordPress login, password
reset, xmlrpc and system.multicall, Laravel login and reset, writes to components that have rules,
and a burst guard on rule paths. Limits log first like every rule and answer 429 once promoted. Counters use
APCu or a small file store, and any error lets the request through. Behind a CDN, --trust-proxy
takes the forwarded client address only from your proxy's range.
It does not replace the edge: every request still reaches PHP, and there are no challenges or bot scoring. The edge pairing guide covers Cloudflare and nginx.
Measured
| Test | Result |
|---|---|
| Ordinary requests matched, all 33 library rules switched on (14,291 generated GETs and POSTs) | 0 |
| Exploit-shape requests logged by the intended rule (real agent) | 39 of 39 |
| Added latency per request, 50-rule policy | +0.07 ms median, +0.10 ms p95 |
| Rate limits: ordinary requests that tripped a limit (300 clients) | 0 of 6,000 |
| Rate limits: abuse scenarios caught by the right limit | 6 of 6 |
The method, the request corpus and the scripts are in the published benchmark. The ordinary traffic was generated, not taken from a live site.
What it is not
- It is not an edge firewall. Its rate limits slow brute force, but it does not absorb DDoS, filter bots or terminate TLS; keep Cloudflare or your host's edge protection for that.
- It protects only against the vulnerabilities in the policy. It is a stopgap until you upgrade, not a reason not to.
- It runs before your application, so it sees the request, not which code path runs. Each rule matches the documented exploit shape, not every possible variant.