Appearance
Virtual patches Since v0.1
A virtual patch is a narrow signature rule for one weakness a scanner found: one attack class, on one path, method and parameter. You import a scanner report, review the proposed patches and apply them as a new configuration version. Normal values still pass. When the application is fixed, the next scan shows which patches can go.
Before you begin
- Role:
operatorfor the application. - A report from ZAP (JSON or XML), Nuclei (JSON lines), Burp Scanner (XML issues export) or the
waap-findings/v1JSON format. The format is recognised by its content. - Patches follow the signatures mode. Try them in
detectfirst if the application is inblockand the parameter carries unusual values.
Import a report
Importing changes nothing. At most 50 MiB and 10,000 findings.
text
1. Open Applications > All applications > the application > Request checks > Virtual patches.
2. Open the Reports tab and select Import a report.
3. Choose the report file.sh
waap vpatch import -app shop -f zap.json
waap vpatch list -app shop
waap vpatch show -app shop -report IDEach finding shows its proposed patch (attack class, target, method and path), or why it cannot be patched: no attack class (a missing header, for example), or odd characters in the path or parameter. Show findings that cannot be patched lists them all.
Apply patches
Tick findings, or Choose every patchable finding, preview the changes and apply them. Findings already patched are skipped.
text
1. On the Reports tab, open the report and tick the findings (or Choose every patchable finding).
2. Select Preview changes, add a comment and select Apply.sh
waap vpatch apply -app shop -report ID -all -dry-run
waap vpatch apply -app shop -report ID -all -m "patch scanner findings"yaml
# applications[].policy.virtual_patches
- id: vp-0007
class: sqli
target: "arg:id"
paths: ["/items"]
methods: [GET]Enforce one patch
Set Enforce to block on a patch and it refuses what it matches even while the application or the signatures module is in detect. The other rules keep logging. The patches list marks it "enforced", and its event reason says enforced (mode detect, action block). Protect-now patches from an assessment issue are set this way.
text
1. Open the Edit patches tab and set Enforce to block on the patch.
2. Select Preview changes, then Apply.sh
waap rules get -app shop -list virtual_patches > patches.yaml
# set enforce: block on the patch, then
waap rules set -app shop -list virtual_patches -f patches.yaml -m "enforce vp-0007"yaml
- id: vp-0007
enforce: blockHigh availability
A configuration with an enforced patch is configuration format 3. In a pair, upgrade the standby first.
Write a patch by hand
For a finding from a manual test or another tool, add a patch on the Edit patches tab with an ID vp-N, attack class, target, paths, methods and enforce. Or write the finding in the waap-findings/v1 format and import it.
Remove patches after the fix
Import the next scan. Patches whose finding the newer report of the same scanner no longer has show "not in REPORT" under Fixed upstream?. Choose the patches fixed upstream, preview and apply to remove them.
text
1. On the Patches tab, select the patches marked as fixed upstream.
2. Select Preview changes, then Apply.sh
waap vpatch remove -app shop -fixed -m "fixed upstream"
waap vpatch remove -app shop -id vp-0007 -m "obsolete"Reports are replicated to a standby and included in backups. Delete one with Delete this report (waap vpatch delete-report -app shop -report ID). Its patches stay.
What a patch refuses
Only its attack class, on its path, method and target. Events name the patch (vp-0007), its rules (300070 to 300079) and the matched parameter. Exceptions and staged rules take the patch's rule range.
Settings reference
Patch
| Setting | What it does | Default | Allowed values | Applies in |
|---|---|---|---|---|
id | Names the patch; rules are 300000 + N*10 to +9. | assigned on import | vp-0001 to vp-9999 | all |
class | The attack class. | none (required) | sqli, xss, path_traversal, rfi, cmdi, code_injection, ssti, xxe, open_redirect | all |
target | Where the attack is. | none (required) | arg:NAME, header:NAME, cookie:NAME, body, any_arg, path | all |
paths | Paths the patch covers. | none (required) | 1 to 20; start with /, exact or ending in * | all |
methods | Limits to these methods. | any | uppercase methods | all |
enforce | Refuse even in detect. | empty (follows the signatures mode) | block, empty | all |
scanner, report, finding, comment | Where it came from, and a note. | none | up to 200 characters, no control characters | all |
Limits
| Limit | Value |
|---|---|
| Patches per application | 1000 |
| Report size and findings | 50 MiB, 10,000 |
| Reports kept per application | 100 |
| Paths per patch | 20 |
Troubleshooting
A finding cannot be patched
- Cause: the scanner gave no attack class, or the path or parameter has characters a patch cannot hold.
- Fix: write the patch by hand with a plain path, or fix the application.
A patch blocks a valid request
- Cause: the parameter carries values that look like the attack class.
- Check: the event names the patch and the matched value.
- Fix: add an exception for the patch's rule range, or remove the patch.