Add virtual patches for PHP2Shell, Log4Shell, Shellshock and other CVEs #13
Loading…
Reference in a new issue
No description provided.
Delete branch "virtual-patches"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Adds Coraza virtual-patch rules for named, widely exploited CVEs, with PHP2Shell first.
What changes
internal/waf/rules/virtual-patches.conf(new, embedded in the binary): one rule per CVE. Each adds a critical finding (+5) at any paranoia level and names its CVE inmsg, so the model and the decision log see which exploit a request resembles.waf.go: loads the file before CRS'sREQUEST-949, so the score is in the total. It also keeps rule ids 1000000–1099999 inMatchedRules. Before this,Evaluatedropped every id outside the CRS range.suspicion.go): adds matching markers, soCENTINELA_WAF=headerdeployments also escalate these requests.Rules
PHP_SESSION_UPLOAD_PROGRESSfieldThe PHP2Shell rule follows the ColibriSec advisory. This PR leaves out the advisory's second rule (1009619,
MULTIPART_STRICT_ERROR), because the WAF already scores that case as 200003.Heartbleed has no rule. It is a TLS heartbeat bug and never reaches HTTP inspection, so the fix is to patch OpenSSL where TLS terminates.
Notes for review
CENTINELA_WAF_HARD_BLOCKif it is set. When CRS also matches, both scores count.session.upload_progress.name.Testing
TestVirtualPatchesMatchExploits: each rule fires and scores on its exploit shape. With the rules file unloaded, this test fails.TestVirtualPatchesIgnoreBenign: no patch fires on look-alikes. These are a file upload,${name}text,?-1and?-sort=, a CSSclass=param, a JSON body and a mid-word soft hyphen.go test ./...passes.🔎 ojo scan results
No findings.