GenWebSec: Adaptive Web Application Firewall Hardening with Co-Evolving LLM Attack and Defense Agents
Vahid Babaey, Arun Ravindran
Large language models (LLMs) enable attackers to rapidly generate and adapt exploit payloads in response to defensive updates, outpacing manual web application firewall (WAF) rule maintenance. Evaluating automated defenses solely against static attack corpora leaves open whether synthesized rules remain compact and effective when attackers adapt. We present GenWebSec, an execution-grounded framework that pairs LLM attack and defense agents in a closed WAF hardening loop. Generated exploits are validated through live application execution and WAF replay; the defender then synthesizes rules individually or in groups under coverage-checked admission and strict benign false-positive bounds before renewed attack search challenges the updated defense. Across six custom SQL injection (SQLi) and cross-site scripting (XSS) targets protected by ModSecurity WAF with OWASP Core Rule Set (CRS) 4.29.0, 78.0-99.6% of application-valid payloads bypassed CRS, and every confirmed bypass also evaded Coraza and BunkerWeb WAFs under the same ruleset. On matched fixed corpora, grouped synthesis reduced median rule counts from 93.5-297 (per-payload) to 1-3 per page while blocking 99.6-100% of bypasses.…