phpwarden

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.

Read the docsInstall the CLI

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

Built to stay out of the way

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

TestResult
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 limit6 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