What a web application firewall does, and why ModSecurity still matters

A network firewall decides which addresses and ports may connect. It can't tell a normal page view from a request that carries SQL injection, because both arrive on port 443. A web application firewall (WAF) sits inside the web server, reads each HTTP request (URL, headers, cookies and body) and decides whether it looks like an attack.
ModSecurity in one paragraph
ModSecurity is the open-source WAF engine used by most hosting control panels. Version 2 runs as an Apache module (and is supported by LiteSpeed); version 3, called libmodsecurity, works with nginx through a connector. On its own it does nothing: it runs rules, written in its SecRule language, against each request and response.
Where the rules come from
- The OWASP Core Rule Set (CRS) is the free, community-maintained baseline. It detects broad attack classes: SQL injection, cross-site scripting, remote file inclusion, PHP and shell injection, protocol abuse and scanners.
- Vendor rule sets add targeted rules, often for specific applications and new vulnerabilities.
- Your own rules handle what's unique to your sites.
Anomaly scoring
Modern CRS doesn't block on the first suspicious sign. Each matching rule adds points to an anomaly score; the request is blocked only when the total crosses a threshold. That keeps a single odd-looking parameter from breaking a page while still stopping requests with several attack traits.
Virtual patching
When a vulnerability is published in a plugin or framework, it can take days or weeks before every site is updated. A virtual patch is a narrow WAF rule that blocks the exploit pattern in the meantime. It doesn't fix the code, but it buys time, and it protects every site on the server at once.
Running it without breaking sites
- Start in detection mode (
SecRuleEngine DetectionOnly) on a busy server, read the audit log for a few days, then switch toOn. - Turn on the CRS application exclusions for software you run (WordPress, Drupal, Nextcloud, phpMyAdmin) so admin screens keep working.
- Exclude, don't disable: remove a single rule for a single path rather than switching rules off everywhere.
- Test the config before reloading (
apachectl -t,nginx -t), and keep the previous rules to roll back to.
Why a WAF is still worth it
Most sites run third-party code that the owner didn't write and can't audit. A WAF is the layer that stops the common exploit traffic before it reaches that code, and the place where a fix can be deployed in minutes instead of waiting for every site to update.
TurnUpSecurity Shield keeps a ModSecurity rule set updated on every server it protects (as a vendor on cPanel, and directly in nginx, Apache and OpenLiteSpeed elsewhere), tests each update against the web server config, and rolls back automatically if anything fails.