How-To · 6 min read

Virtual Patching: Block Zero-Days With WAF Custom Rules Before You Can Upgrade

A new CVE lands and you cannot patch every host today. Virtual patching with WAF custom rules buys safe time. Here is how to write one that holds.

A translucent teal shield patching a glowing crack over source code on monitors

It's 4pm on a Friday. A CVE drops, it's rated critical, and the proof-of-concept is already on your timeline. Your fix needs a vendor release, a staging soak, and a change window on Tuesday. So what protects you over the weekend?

That gap — between "a vulnerability is public" and "every server is patched" — is where most real-world breaches happen. Virtual patching is how you shrink it. You put a rule in front of the app that rejects the exact request shape the exploit needs, and you sleep a little better while the proper fix works its way through.

When it's the right call

Reach for a virtual patch when the maths doesn't work any other way: the CVE is live but your upgrade genuinely needs time; the broken component is something you don't own and can't edit; or you need the same protection across a lot of hosts and you need it from one place. It is a bridge. The best virtual patches are narrow, written down, and deleted the moment the real fix lands everywhere.

What separates a good rule from a dangerous one

A good rule matches the trigger, not a vibe. Tie it to the one field, header, path or parameter the exploit depends on, and your false-positive rate rounds to zero. Reach for something broad — "block every upload" — and yes, you're protected, but you've also broken your checkout flow. Scope broad rules to the routes that actually need them.

Pick the gentlest action that does the job, too. WAFio gives you Block, Allow, Challenge and Log. My advice: never ship a new rule straight to Block. Start it in Log, let it run against live traffic for a bit, and read what it catches. Log records the match and lets the request carry on through the engines, so you learn the rule's true hit list without taking anyone down. Once it only ever lights up on attacks, flip it to Block.

And run it early. Match & Act rules fire before semantic analysis and OWASP CRS, so a matching Block ends a known-exploit request immediately — which is the whole point.

A quick worked example

Say the advisory tells you the exploit ships a form field with a particular name. That's your entire rule: one condition checking that the field exists, action Block, and — please — a note in the description with the CVE and the permanent fix, so whoever finds this rule in six months knows why it's there and when to kill it. WAFio can match against the URI, method, headers, cookies, query params, JSON pointers, form fields and multipart parts, so most published indicators collapse to a single line.

The parts people forget

Give every virtual patch an expiry date. A rule with no owner quietly becomes permanent, and permanent "temporary" rules are how rule sets rot. Tie it to the rollout ticket and close both together.

Keep testing for bypass. Your WAF and your app don't parse bodies identically, so try a few encodings and oddball inputs — and keep upgrading the actual software, because that's still the only thing that ends the story. When in doubt, narrow beats broad: a blunt rule is fine for the first hour of an incident, but trade it for a precise one as you learn how the exploit really moves.

From fire drill to muscle memory

When your custom rules and your detection engines live in the same place, a scary disclosure turns into a routine you've run before: write it in Log, confirm, Block, patch, remove. Walk through it in the WAFio demo, or grab the docs and add your first rule.

See WAFio protect a live application.